diff options
2032 files changed, 8512 insertions, 8336 deletions
diff --git a/libc/benchmarks/CMakeLists.txt b/libc/benchmarks/CMakeLists.txt index 48f5f48..4978da6 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 95077cd..c50ae00 100644 --- a/libc/benchmarks/LibcDefaultImplementations.cpp +++ b/libc/benchmarks/LibcDefaultImplementations.cpp @@ -2,7 +2,7 @@ #include "llvm/ADT/ArrayRef.h" #include <cstddef> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { extern void *memcpy(void *__restrict, const void *__restrict, size_t); extern void *memmove(void *, const void *, size_t); @@ -11,7 +11,7 @@ extern void bzero(void *, size_t); extern int memcmp(const void *, const void *, size_t); extern int bcmp(const void *, const void *, size_t); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE // List of implementations to test. @@ -23,31 +23,31 @@ using llvm::libc_benchmarks::MemsetConfiguration; llvm::ArrayRef<MemcpyConfiguration> getMemcpyConfigurations() { static constexpr MemcpyConfiguration kMemcpyConfigurations[] = { - {__llvm_libc::memcpy, "__llvm_libc::memcpy"}}; + {LIBC_NAMESPACE::memcpy, "LIBC_NAMESPACE::memcpy"}}; return llvm::ArrayRef(kMemcpyConfigurations); } llvm::ArrayRef<MemmoveConfiguration> getMemmoveConfigurations() { static constexpr MemmoveConfiguration kMemmoveConfigurations[] = { - {__llvm_libc::memmove, "__llvm_libc::memmove"}}; + {LIBC_NAMESPACE::memmove, "LIBC_NAMESPACE::memmove"}}; return llvm::ArrayRef(kMemmoveConfigurations); } llvm::ArrayRef<MemcmpOrBcmpConfiguration> getMemcmpConfigurations() { static constexpr MemcmpOrBcmpConfiguration kMemcmpConfiguration[] = { - {__llvm_libc::memcmp, "__llvm_libc::memcmp"}}; + {LIBC_NAMESPACE::memcmp, "LIBC_NAMESPACE::memcmp"}}; return llvm::ArrayRef(kMemcmpConfiguration); } llvm::ArrayRef<MemcmpOrBcmpConfiguration> getBcmpConfigurations() { static constexpr MemcmpOrBcmpConfiguration kBcmpConfigurations[] = { - {__llvm_libc::bcmp, "__llvm_libc::bcmp"}}; + {LIBC_NAMESPACE::bcmp, "LIBC_NAMESPACE::bcmp"}}; return llvm::ArrayRef(kBcmpConfigurations); } llvm::ArrayRef<MemsetConfiguration> getMemsetConfigurations() { static constexpr MemsetConfiguration kMemsetConfigurations[] = { - {__llvm_libc::memset, "__llvm_libc::memset"}}; + {LIBC_NAMESPACE::memset, "LIBC_NAMESPACE::memset"}}; return llvm::ArrayRef(kMemsetConfigurations); } llvm::ArrayRef<BzeroConfiguration> getBzeroConfigurations() { static constexpr BzeroConfiguration kBzeroConfigurations[] = { - {__llvm_libc::bzero, "__llvm_libc::bzero"}}; + {LIBC_NAMESPACE::bzero, "LIBC_NAMESPACE::bzero"}}; return llvm::ArrayRef(kBzeroConfigurations); } diff --git a/libc/benchmarks/LibcMemoryBenchmark.h b/libc/benchmarks/LibcMemoryBenchmark.h index f00bed4..5ba8b93 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 4fc6777..acd7c30 100644 --- a/libc/benchmarks/LibcMemoryBenchmarkMain.cpp +++ b/libc/benchmarks/LibcMemoryBenchmarkMain.cpp @@ -21,7 +21,7 @@ #include <cstring> #include <unistd.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { extern void *memcpy(void *__restrict, const void *__restrict, size_t); extern void *memmove(void *, const void *, size_t); @@ -30,7 +30,7 @@ extern void bzero(void *, size_t); extern int memcmp(const void *, const void *, size_t); extern int bcmp(const void *, const void *, size_t); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE namespace llvm { namespace libc_benchmarks { diff --git a/libc/benchmarks/automemcpy/lib/CodeGen.cpp b/libc/benchmarks/automemcpy/lib/CodeGen.cpp index f406009..3837bd9 100644 --- a/libc/benchmarks/automemcpy/lib/CodeGen.cpp +++ b/libc/benchmarks/automemcpy/lib/CodeGen.cpp @@ -62,7 +62,7 @@ namespace functions { // static void memcpy_0xB20D4702493C397E(char *__restrict dst, // const char *__restrict src, // size_t size) { -// using namespace __llvm_libc::x86; +// using namespace LIBC_NAMESPACE::x86; // if(size == 0) return; // if(size == 1) return copy<_1>(dst, src); // if(size < 4) return copy<HeadTail<_2>>(dst, src, size); @@ -249,7 +249,7 @@ static raw_ostream &operator<<(raw_ostream &Stream, const auto &Ctx = FI.Ctx; Stream << "static " << Ctx.FunctionReturnType << ' ' << FI.Name << Ctx.FunctionArgs << " {\n"; - Stream << kIndent << "using namespace __llvm_libc::" << FI.ElementClass + Stream << kIndent << "using namespace LIBC_NAMESPACE::" << FI.ElementClass << ";\n"; for (const auto &I : FI.Individuals) if (I.Element.Size == 0) @@ -428,7 +428,7 @@ namespace configurations { // ------------------------------------------------------------ // e.g. // llvm::ArrayRef<MemcpyConfiguration> getMemcpyConfigurations() { -// using namespace __llvm_libc; +// using namespace LIBC_NAMESPACE; // static constexpr MemcpyConfiguration kConfigurations[] = { // {Wrap<memcpy_0xE00E29EE73994E2B>, "memcpy_0xE00E29EE73994E2B"}, // {Wrap<memcpy_0x8661D80472487AB5>, "memcpy_0x8661D80472487AB5"}, @@ -504,7 +504,7 @@ static raw_ostream &operator<<(raw_ostream &Stream, const Configuration &C) { if (C.Descriptors.empty()) Stream << kIndent << "return {};\n"; else { - Stream << kIndent << "using namespace __llvm_libc;\n"; + Stream << kIndent << "using namespace LIBC_NAMESPACE;\n"; Stream << kIndent << "static constexpr " << C.Type << " kConfigurations[] = {\n"; Stream << C.Descriptors; @@ -542,11 +542,11 @@ static void Serialize(raw_ostream &Stream, Stream << "using llvm::libc_benchmarks::MemmoveConfiguration;\n"; Stream << "using llvm::libc_benchmarks::MemsetConfiguration;\n"; Stream << "\n"; - Stream << "namespace __llvm_libc {\n"; + Stream << "namespace LIBC_NAMESPACE {\n"; Stream << "\n"; codegen::functions::Serialize(Stream, Descriptors); Stream << "\n"; - Stream << "} // namespace __llvm_libc\n"; + Stream << "} // namespace LIBC_NAMESPACE\n"; Stream << "\n"; Stream << "namespace llvm {\n"; Stream << "namespace automemcpy {\n"; diff --git a/libc/benchmarks/automemcpy/unittests/CodeGenTest.cpp b/libc/benchmarks/automemcpy/unittests/CodeGenTest.cpp index b0c5f3a..5084b1d 100644 --- a/libc/benchmarks/automemcpy/unittests/CodeGenTest.cpp +++ b/libc/benchmarks/automemcpy/unittests/CodeGenTest.cpp @@ -63,14 +63,14 @@ using llvm::libc_benchmarks::MemcpyConfiguration; using llvm::libc_benchmarks::MemmoveConfiguration; using llvm::libc_benchmarks::MemsetConfiguration; -namespace __llvm_libc { +namespace LIBC_NAMESPACE { static void memcpy_0xE00E29EE73994E2B(char *__restrict dst, const char *__restrict src, size_t size) { - using namespace __llvm_libc::x86; + using namespace LIBC_NAMESPACE::x86; return copy<Accelerator>(dst, src, size); } static void memcpy_0x7381B60C7BE75EF9(char *__restrict dst, const char *__restrict src, size_t size) { - using namespace __llvm_libc::x86; + using namespace LIBC_NAMESPACE::x86; if(size == 0) return; if(size == 1) return copy<_1>(dst, src); if(size == 2) return copy<_2>(dst, src); @@ -84,7 +84,7 @@ static void memcpy_0x7381B60C7BE75EF9(char *__restrict dst, const char *__restri return copy<Loop<_64>>(dst, src, size); } static int memcmp_0x348D7BA6DB0EE033(const char * lhs, const char * rhs, size_t size) { - using namespace __llvm_libc::x86; + using namespace LIBC_NAMESPACE::x86; if(size == 0) return 0; if(size == 1) return three_way_compare<_1>(lhs, rhs); if(size < 4) return three_way_compare<HeadTail<_2>>(lhs, rhs, size); @@ -95,7 +95,7 @@ static int memcmp_0x348D7BA6DB0EE033(const char * lhs, const char * rhs, size_t return three_way_compare<Align<_16,Arg::Lhs>::Then<Loop<_16>>>(lhs, rhs, size); } static void memset_0x71E761699B999863(char * dst, int value, size_t size) { - using namespace __llvm_libc::x86; + using namespace LIBC_NAMESPACE::x86; if(size == 0) return; if(size == 1) return splat_set<_1>(dst, value); if(size < 4) return splat_set<HeadTail<_2>>(dst, value, size); @@ -108,7 +108,7 @@ static void memset_0x71E761699B999863(char * dst, int value, size_t size) { return splat_set<Align<_16,Arg::Dst>::Then<Loop<_32>>>(dst, value, size); } static void memset_0x3DF0F44E2ED6A50F(char * dst, int value, size_t size) { - using namespace __llvm_libc::x86; + using namespace LIBC_NAMESPACE::x86; if(size == 0) return; if(size == 1) return splat_set<_1>(dst, value); if(size < 4) return splat_set<HeadTail<_2>>(dst, value, size); @@ -121,7 +121,7 @@ static void memset_0x3DF0F44E2ED6A50F(char * dst, int value, size_t size) { return splat_set<Align<_32,Arg::Dst>::Then<Loop<_32>>>(dst, value, size); } static void bzero_0x475977492C218AD4(char * dst, size_t size) { - using namespace __llvm_libc::x86; + using namespace LIBC_NAMESPACE::x86; if(size == 0) return; if(size == 1) return splat_set<_1>(dst, 0); if(size == 2) return splat_set<_2>(dst, 0); @@ -134,7 +134,7 @@ static void bzero_0x475977492C218AD4(char * dst, size_t size) { return splat_set<Align<_32,Arg::Dst>::Then<Loop<_32>>>(dst, 0, size); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE namespace llvm { namespace automemcpy { @@ -163,7 +163,7 @@ void *Wrap(void *__restrict dst, const void *__restrict src, size_t size) { return dst; } llvm::ArrayRef<MemcpyConfiguration> getMemcpyConfigurations() { - using namespace __llvm_libc; + using namespace LIBC_NAMESPACE; static constexpr MemcpyConfiguration kConfigurations[] = { {Wrap<memcpy_0xE00E29EE73994E2B>, "memcpy_0xE00E29EE73994E2B"}, {Wrap<memcpy_0x7381B60C7BE75EF9>, "memcpy_0x7381B60C7BE75EF9"}, @@ -178,7 +178,7 @@ int Wrap(const void *lhs, const void *rhs, size_t size) { reinterpret_cast<const char *>(rhs), size); } llvm::ArrayRef<MemcmpOrBcmpConfiguration> getMemcmpConfigurations() { - using namespace __llvm_libc; + using namespace LIBC_NAMESPACE; static constexpr MemcmpOrBcmpConfiguration kConfigurations[] = { {Wrap<memcmp_0x348D7BA6DB0EE033>, "memcmp_0x348D7BA6DB0EE033"}, }; @@ -194,7 +194,7 @@ template <MemsetStub Foo> void *Wrap(void *dst, int value, size_t size) { return dst; } llvm::ArrayRef<MemsetConfiguration> getMemsetConfigurations() { - using namespace __llvm_libc; + using namespace LIBC_NAMESPACE; static constexpr MemsetConfiguration kConfigurations[] = { {Wrap<memset_0x71E761699B999863>, "memset_0x71E761699B999863"}, {Wrap<memset_0x3DF0F44E2ED6A50F>, "memset_0x3DF0F44E2ED6A50F"}, @@ -207,7 +207,7 @@ template <BzeroStub Foo> void Wrap(void *dst, size_t size) { Foo(reinterpret_cast<char *>(dst), size); } llvm::ArrayRef<BzeroConfiguration> getBzeroConfigurations() { - using namespace __llvm_libc; + using namespace LIBC_NAMESPACE; static constexpr BzeroConfiguration kConfigurations[] = { {Wrap<bzero_0x475977492C218AD4>, "bzero_0x475977492C218AD4"}, }; diff --git a/libc/config/linux/app.h b/libc/config/linux/app.h index 40a4507..5521991 100644 --- a/libc/config/linux/app.h +++ b/libc/config/linux/app.h @@ -13,7 +13,7 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Data structure to capture properties of the linux/ELF TLS image. struct TLSImage { @@ -106,6 +106,6 @@ void init_tls(TLSDescriptor &tls); // Cleanup the TLS area as described in |tls_descriptor|. void cleanup_tls(uintptr_t tls_addr, uintptr_t tls_size); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_CONFIG_LINUX_APP_H diff --git a/libc/docs/dev/clang_tidy_checks.rst b/libc/docs/dev/clang_tidy_checks.rst index e635f84..18c011e 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 4b03217..a28f7b9 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 0fdbb7c..389981a 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 e690e51..2b84ad3 100644 --- a/libc/fuzzing/math/Compare.h +++ b/libc/fuzzing/math/Compare.h @@ -13,10 +13,11 @@ #include "src/__support/FPUtil/FPBits.h" template <typename T> -__llvm_libc::cpp::enable_if_t<__llvm_libc::cpp::is_floating_point_v<T>, bool> +LIBC_NAMESPACE::cpp::enable_if_t<LIBC_NAMESPACE::cpp::is_floating_point_v<T>, + bool> ValuesEqual(T x1, T x2) { - __llvm_libc::fputil::FPBits<T> bits1(x1); - __llvm_libc::fputil::FPBits<T> bits2(x2); + LIBC_NAMESPACE::fputil::FPBits<T> bits1(x1); + LIBC_NAMESPACE::fputil::FPBits<T> bits2(x2); // If either is NaN, we want both to be NaN. if (bits1.is_nan() || bits2.is_nan()) return bits2.is_nan() && bits2.is_nan(); @@ -26,7 +27,7 @@ ValuesEqual(T x1, T x2) { } template <typename T> -__llvm_libc::cpp::enable_if_t<__llvm_libc::cpp::is_integral_v<T>, bool> +LIBC_NAMESPACE::cpp::enable_if_t<LIBC_NAMESPACE::cpp::is_integral_v<T>, bool> ValuesEqual(T x1, T x2) { return x1 == x2; } diff --git a/libc/fuzzing/math/RemQuoDiff.h b/libc/fuzzing/math/RemQuoDiff.h index b934bc8..2a96224 100644 --- a/libc/fuzzing/math/RemQuoDiff.h +++ b/libc/fuzzing/math/RemQuoDiff.h @@ -44,8 +44,8 @@ void RemQuoDiff(RemQuoFunc<T> func1, RemQuoFunc<T> func2, const uint8_t *data, if ((q1 & 0x7) != (q2 & 0x7)) __builtin_trap(); - __llvm_libc::fputil::FPBits<T> bits1(remainder1); - __llvm_libc::fputil::FPBits<T> bits2(remainder2); + LIBC_NAMESPACE::fputil::FPBits<T> bits1(remainder1); + LIBC_NAMESPACE::fputil::FPBits<T> bits2(remainder2); if (bits1.uintval() != bits2.uintval()) __builtin_trap(); } diff --git a/libc/fuzzing/math/math_differential_fuzz.cpp b/libc/fuzzing/math/math_differential_fuzz.cpp index f315b6a..0e66377 100644 --- a/libc/fuzzing/math/math_differential_fuzz.cpp +++ b/libc/fuzzing/math/math_differential_fuzz.cpp @@ -70,83 +70,89 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { - SingleInputSingleOutputDiff<float>(&__llvm_libc::ceilf, &::ceilf, data, size); - SingleInputSingleOutputDiff<double>(&__llvm_libc::ceil, &::ceil, data, size); - SingleInputSingleOutputDiff<long double>(&__llvm_libc::ceill, &::ceill, data, - size); + SingleInputSingleOutputDiff<float>(&LIBC_NAMESPACE::ceilf, &::ceilf, data, + size); + SingleInputSingleOutputDiff<double>(&LIBC_NAMESPACE::ceil, &::ceil, data, + size); + SingleInputSingleOutputDiff<long double>(&LIBC_NAMESPACE::ceill, &::ceill, + data, size); - SingleInputSingleOutputDiff<float>(&__llvm_libc::floorf, &::floorf, data, + SingleInputSingleOutputDiff<float>(&LIBC_NAMESPACE::floorf, &::floorf, data, size); - SingleInputSingleOutputDiff<double>(&__llvm_libc::floor, &::floor, data, + SingleInputSingleOutputDiff<double>(&LIBC_NAMESPACE::floor, &::floor, data, size); - SingleInputSingleOutputDiff<long double>(&__llvm_libc::floorl, &::floorl, + SingleInputSingleOutputDiff<long double>(&LIBC_NAMESPACE::floorl, &::floorl, data, size); - SingleInputSingleOutputDiff<float>(&__llvm_libc::roundf, &::roundf, data, + SingleInputSingleOutputDiff<float>(&LIBC_NAMESPACE::roundf, &::roundf, data, size); - SingleInputSingleOutputDiff<double>(&__llvm_libc::round, &::round, data, + SingleInputSingleOutputDiff<double>(&LIBC_NAMESPACE::round, &::round, data, size); - SingleInputSingleOutputDiff<long double>(&__llvm_libc::roundl, &::roundl, + SingleInputSingleOutputDiff<long double>(&LIBC_NAMESPACE::roundl, &::roundl, data, size); - SingleInputSingleOutputDiff<float>(&__llvm_libc::truncf, &::truncf, data, + SingleInputSingleOutputDiff<float>(&LIBC_NAMESPACE::truncf, &::truncf, data, size); - SingleInputSingleOutputDiff<double>(&__llvm_libc::trunc, &::trunc, data, + SingleInputSingleOutputDiff<double>(&LIBC_NAMESPACE::trunc, &::trunc, data, size); - SingleInputSingleOutputDiff<long double>(&__llvm_libc::truncl, &::truncl, + SingleInputSingleOutputDiff<long double>(&LIBC_NAMESPACE::truncl, &::truncl, data, size); - SingleInputSingleOutputDiff<float>(&__llvm_libc::logbf, &::logbf, data, size); - SingleInputSingleOutputDiff<double>(&__llvm_libc::logb, &::logb, data, size); - SingleInputSingleOutputDiff<long double>(&__llvm_libc::logbl, &::logbl, data, - size); + SingleInputSingleOutputDiff<float>(&LIBC_NAMESPACE::logbf, &::logbf, data, + size); + SingleInputSingleOutputDiff<double>(&LIBC_NAMESPACE::logb, &::logb, data, + size); + SingleInputSingleOutputDiff<long double>(&LIBC_NAMESPACE::logbl, &::logbl, + data, size); - TwoInputSingleOutputDiff<float, float>(&__llvm_libc::hypotf, &::hypotf, data, - size); + TwoInputSingleOutputDiff<float, float>(&LIBC_NAMESPACE::hypotf, &::hypotf, + data, size); - TwoInputSingleOutputDiff<float, float>(&__llvm_libc::remainderf, + TwoInputSingleOutputDiff<float, float>(&LIBC_NAMESPACE::remainderf, &::remainderf, data, size); - TwoInputSingleOutputDiff<double, double>(&__llvm_libc::remainder, + TwoInputSingleOutputDiff<double, double>(&LIBC_NAMESPACE::remainder, &::remainder, data, size); - TwoInputSingleOutputDiff<long double, long double>(&__llvm_libc::remainderl, - &::remainderl, data, size); + TwoInputSingleOutputDiff<long double, long double>( + &LIBC_NAMESPACE::remainderl, &::remainderl, data, size); - TwoInputSingleOutputDiff<float, float>(&__llvm_libc::fdimf, &::fdimf, data, + TwoInputSingleOutputDiff<float, float>(&LIBC_NAMESPACE::fdimf, &::fdimf, data, size); - TwoInputSingleOutputDiff<double, double>(&__llvm_libc::fdim, &::fdim, data, + TwoInputSingleOutputDiff<double, double>(&LIBC_NAMESPACE::fdim, &::fdim, data, size); - TwoInputSingleOutputDiff<long double, long double>(&__llvm_libc::fdiml, + TwoInputSingleOutputDiff<long double, long double>(&LIBC_NAMESPACE::fdiml, &::fdiml, data, size); - SingleInputSingleOutputDiff<float>(&__llvm_libc::sqrtf, &::sqrtf, data, size); - SingleInputSingleOutputDiff<double>(&__llvm_libc::sqrt, &::sqrt, data, size); - SingleInputSingleOutputDiff<long double>(&__llvm_libc::sqrtl, &::sqrtl, data, - size); + SingleInputSingleOutputDiff<float>(&LIBC_NAMESPACE::sqrtf, &::sqrtf, data, + size); + SingleInputSingleOutputDiff<double>(&LIBC_NAMESPACE::sqrt, &::sqrt, data, + size); + SingleInputSingleOutputDiff<long double>(&LIBC_NAMESPACE::sqrtl, &::sqrtl, + data, size); - SingleInputSingleOutputWithSideEffectDiff<float, int>(&__llvm_libc::frexpf, + SingleInputSingleOutputWithSideEffectDiff<float, int>(&LIBC_NAMESPACE::frexpf, &::frexpf, data, size); - SingleInputSingleOutputWithSideEffectDiff<double, int>(&__llvm_libc::frexp, + SingleInputSingleOutputWithSideEffectDiff<double, int>(&LIBC_NAMESPACE::frexp, &::frexp, data, size); SingleInputSingleOutputWithSideEffectDiff<long double, int>( - &__llvm_libc::frexpl, &::frexpl, data, size); + &LIBC_NAMESPACE::frexpl, &::frexpl, data, size); - SingleInputSingleOutputWithSideEffectDiff<float, float>(&__llvm_libc::modff, - &::modff, data, size); + SingleInputSingleOutputWithSideEffectDiff<float, float>( + &LIBC_NAMESPACE::modff, &::modff, data, size); SingleInputSingleOutputWithSideEffectDiff<double, double>( - &__llvm_libc::modf, &::modf, data, size); + &LIBC_NAMESPACE::modf, &::modf, data, size); SingleInputSingleOutputWithSideEffectDiff<long double, long double>( - &__llvm_libc::modfl, &::modfl, data, size); + &LIBC_NAMESPACE::modfl, &::modfl, data, size); - TwoInputSingleOutputDiff<float, int>(&__llvm_libc::ldexpf, &::ldexpf, data, + TwoInputSingleOutputDiff<float, int>(&LIBC_NAMESPACE::ldexpf, &::ldexpf, data, size); - TwoInputSingleOutputDiff<double, int>(&__llvm_libc::ldexp, &::ldexp, data, + TwoInputSingleOutputDiff<double, int>(&LIBC_NAMESPACE::ldexp, &::ldexp, data, size); - TwoInputSingleOutputDiff<long double, int>(&__llvm_libc::ldexpl, &::ldexpl, + TwoInputSingleOutputDiff<long double, int>(&LIBC_NAMESPACE::ldexpl, &::ldexpl, data, size); - RemQuoDiff<float>(&__llvm_libc::remquof, &::remquof, data, size); - RemQuoDiff<double>(&__llvm_libc::remquo, &::remquo, data, size); - RemQuoDiff<long double>(&__llvm_libc::remquol, &::remquol, data, size); + RemQuoDiff<float>(&LIBC_NAMESPACE::remquof, &::remquof, data, size); + RemQuoDiff<double>(&LIBC_NAMESPACE::remquo, &::remquo, data, size); + RemQuoDiff<long double>(&LIBC_NAMESPACE::remquol, &::remquol, data, size); return 0; } diff --git a/libc/fuzzing/math/nextafter_differential_fuzz.cpp b/libc/fuzzing/math/nextafter_differential_fuzz.cpp index f4a7891..2e6d589 100644 --- a/libc/fuzzing/math/nextafter_differential_fuzz.cpp +++ b/libc/fuzzing/math/nextafter_differential_fuzz.cpp @@ -18,9 +18,9 @@ #include "src/math/nextafterl.h" extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { - TwoInputSingleOutputDiff<float, float>(&__llvm_libc::nextafterf, + TwoInputSingleOutputDiff<float, float>(&LIBC_NAMESPACE::nextafterf, &::nextafterf, data, size); - TwoInputSingleOutputDiff<double, double>(&__llvm_libc::nextafter, + TwoInputSingleOutputDiff<double, double>(&LIBC_NAMESPACE::nextafter, &::nextafter, data, size); return 0; } diff --git a/libc/fuzzing/stdio/printf_float_conv_fuzz.cpp b/libc/fuzzing/stdio/printf_float_conv_fuzz.cpp index 7d8335b..dd3902e 100644 --- a/libc/fuzzing/stdio/printf_float_conv_fuzz.cpp +++ b/libc/fuzzing/stdio/printf_float_conv_fuzz.cpp @@ -38,7 +38,7 @@ enum class TestResult { inline TestResult test_vals(const char *fmt, double num, int prec, int width) { // Call snprintf on a nullptr to get the buffer size. - int buffer_size = __llvm_libc::snprintf(nullptr, 0, fmt, width, prec, num); + int buffer_size = LIBC_NAMESPACE::snprintf(nullptr, 0, fmt, width, prec, num); if (buffer_size < 0) { return TestResult::BufferSizeFailed; @@ -50,8 +50,8 @@ inline TestResult test_vals(const char *fmt, double num, int prec, int width) { int test_result = 0; int reference_result = 0; - test_result = - __llvm_libc::snprintf(test_buff, buffer_size + 1, fmt, width, prec, num); + test_result = LIBC_NAMESPACE::snprintf(test_buff, buffer_size + 1, fmt, width, + prec, num); reference_result = mpfr_snprintf(reference_buff, buffer_size + 1, fmt, width, prec, num); @@ -84,7 +84,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { int prec = 0; int width = 0; - __llvm_libc::fputil::FPBits<double>::UIntType raw_num = 0; + LIBC_NAMESPACE::fputil::FPBits<double>::UIntType raw_num = 0; // Copy as many bytes of data as will fit into num, prec, and with. Any extras // are ignored. @@ -98,7 +98,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { } } - num = __llvm_libc::fputil::FPBits<double>(raw_num).get_val(); + num = LIBC_NAMESPACE::fputil::FPBits<double>(raw_num).get_val(); if (width > MAX_SIZE) { width = MAX_SIZE; diff --git a/libc/fuzzing/stdio/printf_parser_fuzz.cpp b/libc/fuzzing/stdio/printf_parser_fuzz.cpp index 86f8c1e..e745850 100644 --- a/libc/fuzzing/stdio/printf_parser_fuzz.cpp +++ b/libc/fuzzing/stdio/printf_parser_fuzz.cpp @@ -16,7 +16,7 @@ #include <stdarg.h> #include <stdint.h> -using namespace __llvm_libc; +using namespace LIBC_NAMESPACE; // The design for the printf parser fuzzer is fairly simple. The parser uses a // mock arg list that will never fail, and is passed a randomized string. The diff --git a/libc/fuzzing/stdlib/atof_differential_fuzz.cpp b/libc/fuzzing/stdlib/atof_differential_fuzz.cpp index b368129..eeb96ae 100644 --- a/libc/fuzzing/stdlib/atof_differential_fuzz.cpp +++ b/libc/fuzzing/stdlib/atof_differential_fuzz.cpp @@ -26,7 +26,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { container[i] = data[i]; container[size] = '\0'; // Add null terminator to container. - StringParserOutputDiff<double>(&__llvm_libc::atof, &::atof, container, size); + StringParserOutputDiff<double>(&LIBC_NAMESPACE::atof, &::atof, container, + size); delete[] container; return 0; } diff --git a/libc/fuzzing/stdlib/qsort_fuzz.cpp b/libc/fuzzing/stdlib/qsort_fuzz.cpp index dbbc8e9..5d5053c 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 5ef506a..f6cc8ab 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 612be42..097e619 100644 --- a/libc/fuzzing/stdlib/strtointeger_differential_fuzz.cpp +++ b/libc/fuzzing/stdlib/strtointeger_differential_fuzz.cpp @@ -61,19 +61,19 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { // random even when the input is cleaned. container[0] = data[0]; - StringParserOutputDiff<int>(&__llvm_libc::atoi, &::atoi, container, size); - StringParserOutputDiff<long>(&__llvm_libc::atol, &::atol, container, size); - StringParserOutputDiff<long long>(&__llvm_libc::atoll, &::atoll, container, + StringParserOutputDiff<int>(&LIBC_NAMESPACE::atoi, &::atoi, container, size); + StringParserOutputDiff<long>(&LIBC_NAMESPACE::atol, &::atol, container, size); + StringParserOutputDiff<long long>(&LIBC_NAMESPACE::atoll, &::atoll, container, size); - StringToNumberOutputDiff<long>(&__llvm_libc::strtol, &::strtol, container, + StringToNumberOutputDiff<long>(&LIBC_NAMESPACE::strtol, &::strtol, container, size); - StringToNumberOutputDiff<long long>(&__llvm_libc::strtoll, &::strtoll, + StringToNumberOutputDiff<long long>(&LIBC_NAMESPACE::strtoll, &::strtoll, container, size); - StringToNumberOutputDiff<unsigned long>(&__llvm_libc::strtoul, &::strtoul, + StringToNumberOutputDiff<unsigned long>(&LIBC_NAMESPACE::strtoul, &::strtoul, container, size); - StringToNumberOutputDiff<unsigned long long>(&__llvm_libc::strtoull, + StringToNumberOutputDiff<unsigned long long>(&LIBC_NAMESPACE::strtoull, &::strtoull, container, size); delete[] container; diff --git a/libc/fuzzing/stdlib/strtointeger_fuzz.cpp b/libc/fuzzing/stdlib/strtointeger_fuzz.cpp index 197bee0..3ffe5c2 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 c1b497d..50587bf 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 10e0c03..c15649a 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 5ccf85c..34ee891 100644 --- a/libc/fuzzing/string/strstr_fuzz.cpp +++ b/libc/fuzzing/string/strstr_fuzz.cpp @@ -54,11 +54,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { const char *needle = reinterpret_cast<const char *>(container); const char *haystack = reinterpret_cast<const char *>(data + i); - const char *result = __llvm_libc::strstr(haystack, needle); + const char *result = LIBC_NAMESPACE::strstr(haystack, needle); // A null terminator may exist earlier in each, so this needs to be recorded. - const size_t haystack_size = __llvm_libc::strlen(haystack); - const size_t needle_size = __llvm_libc::strlen(needle); + const size_t haystack_size = LIBC_NAMESPACE::strlen(haystack); + const size_t needle_size = LIBC_NAMESPACE::strlen(needle); if (result) { // The needle is in the haystack. diff --git a/libc/src/__support/CPP/README.md b/libc/src/__support/CPP/README.md index 472a630..b470c3f 100644 --- a/libc/src/__support/CPP/README.md +++ b/libc/src/__support/CPP/README.md @@ -8,6 +8,6 @@ be followed for future changes and additions: and free standing C headers. 2. Free standing C headers are to be included as C headers and not as C++ headers. That is, use `#include <stddef.h>` and not `#include <cstddef>`. -3. The utilities should be defined in the namespace `__llvm_libc::cpp`. The +3. The utilities should be defined in the namespace `LIBC_NAMESPACE::cpp`. The higher level namespace should have a `__` prefix to avoid symbol name pollution when the utilities are used in implementation of public functions. diff --git a/libc/src/__support/CPP/algorithm.h b/libc/src/__support/CPP/algorithm.h index 6ce56a9..fef3c18 100644 --- a/libc/src/__support/CPP/algorithm.h +++ b/libc/src/__support/CPP/algorithm.h @@ -14,7 +14,7 @@ #include "src/__support/macros/attributes.h" // LIBC_INLINE -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace cpp { template <class T> LIBC_INLINE constexpr const T &max(const T &a, const T &b) { @@ -26,6 +26,6 @@ template <class T> LIBC_INLINE constexpr const T &min(const T &a, const T &b) { } } // namespace cpp -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_CPP_ALGORITHM_H diff --git a/libc/src/__support/CPP/array.h b/libc/src/__support/CPP/array.h index 1cdc8b7..12e5748 100644 --- a/libc/src/__support/CPP/array.h +++ b/libc/src/__support/CPP/array.h @@ -12,11 +12,12 @@ #include "src/__support/macros/attributes.h" #include <stddef.h> // For size_t. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace cpp { template <class T, size_t N> struct array { - static_assert(N != 0, "Cannot create a __llvm_libc::cpp::array of size 0."); + static_assert(N != 0, + "Cannot create a LIBC_NAMESPACE::cpp::array of size 0."); T Data[N]; using value_type = T; @@ -50,6 +51,6 @@ template <class T, size_t N> struct array { }; } // namespace cpp -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_CPP_ARRAY_H diff --git a/libc/src/__support/CPP/atomic.h b/libc/src/__support/CPP/atomic.h index 609aac3..78dc8d2 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 4e4205d..4562666 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 bae71d8..cfac749 100644 --- a/libc/src/__support/CPP/bitset.h +++ b/libc/src/__support/CPP/bitset.h @@ -12,11 +12,11 @@ #include "src/__support/macros/attributes.h" #include <stddef.h> // For size_t. -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { template <size_t NumberOfBits> struct bitset { static_assert(NumberOfBits != 0, - "Cannot create a __llvm_libc::cpp::bitset of size 0."); + "Cannot create a LIBC_NAMESPACE::cpp::bitset of size 0."); LIBC_INLINE constexpr void set(size_t Index) { Data[Index / BITS_PER_UNIT] |= mask(Index); @@ -85,6 +85,6 @@ private: 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 4c5c4a4..1da51fd 100644 --- a/libc/src/__support/CPP/cstddef.h +++ b/libc/src/__support/CPP/cstddef.h @@ -12,7 +12,7 @@ #include "src/__support/macros/attributes.h" #include "type_traits.h" // For enable_if_t, is_integral_v. -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { enum class byte : unsigned char {}; @@ -66,6 +66,6 @@ to_integer(byte b) noexcept { return static_cast<IntegerType>(b); } -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_CSTDDEF_H diff --git a/libc/src/__support/CPP/expected.h b/libc/src/__support/CPP/expected.h index c20d100..52174a0 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 @@ public: 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 6c33b55..16283a2 100644 --- a/libc/src/__support/CPP/functional.h +++ b/libc/src/__support/CPP/functional.h @@ -20,7 +20,7 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace cpp { /// A function type adapted from LLVM's function_ref. @@ -65,6 +65,6 @@ public: }; } // 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 4e76337..e163f00 100644 --- a/libc/src/__support/CPP/limits.h +++ b/libc/src/__support/CPP/limits.h @@ -11,7 +11,7 @@ #include <limits.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace cpp { // Some older gcc distributions don't define these for 32 bit targets. @@ -96,6 +96,6 @@ public: #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 14ee0ab..16353d5 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 @@ public: } }; -} // 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 b5e2ef7..02e8395 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 @@ public: }; } // 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 ebf637c..a8c1353 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 @@ private: 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 2f60720..cb794e0 100644 --- a/libc/src/__support/CPP/string.h +++ b/libc/src/__support/CPP/string.h @@ -18,7 +18,7 @@ #include <stddef.h> // size_t #include <stdlib.h> // malloc, free -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace cpp { // This class mimics std::string but does not intend to be a full fledged @@ -61,7 +61,7 @@ public: 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 d494325..d23aa26 100644 --- a/libc/src/__support/CPP/string_view.h +++ b/libc/src/__support/CPP/string_view.h @@ -13,7 +13,7 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace cpp { // This is very simple alternate of the std::string_view class. There is no @@ -197,6 +197,6 @@ public: }; } // 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 0a92dda..c8eb59c 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 @@ public: }; } // 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 69d7501..2bca626 100644 --- a/libc/src/__support/CPP/type_traits/add_lvalue_reference.h +++ b/libc/src/__support/CPP/type_traits/add_lvalue_reference.h @@ -10,7 +10,7 @@ #include "src/__support/CPP/type_traits/type_identity.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // add_lvalue_reference namespace detail { @@ -25,6 +25,6 @@ struct add_lvalue_reference : decltype(detail::try_add_lvalue_reference<T>(0)) { template <class T> using add_lvalue_reference_t = typename add_lvalue_reference<T>::type; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ADD_LVALUE_REFERENCE_H diff --git a/libc/src/__support/CPP/type_traits/add_pointer.h b/libc/src/__support/CPP/type_traits/add_pointer.h index 1ea55b7..72a764b 100644 --- a/libc/src/__support/CPP/type_traits/add_pointer.h +++ b/libc/src/__support/CPP/type_traits/add_pointer.h @@ -12,7 +12,7 @@ #include "src/__support/CPP/type_traits/type_identity.h" #include "src/__support/macros/config.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // add_pointer namespace detail { @@ -23,6 +23,6 @@ template <class T> auto try_add_pointer(...) -> cpp::type_identity<T>; template <class T> struct add_pointer : decltype(detail::try_add_pointer<T>(0)) {}; template <class T> using add_pointer_t = typename add_pointer<T>::type; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ADD_POINTER_H diff --git a/libc/src/__support/CPP/type_traits/add_rvalue_reference.h b/libc/src/__support/CPP/type_traits/add_rvalue_reference.h index e2a135b..76db671 100644 --- a/libc/src/__support/CPP/type_traits/add_rvalue_reference.h +++ b/libc/src/__support/CPP/type_traits/add_rvalue_reference.h @@ -10,7 +10,7 @@ #include "src/__support/CPP/type_traits/type_identity.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // add_rvalue_reference namespace detail { @@ -24,6 +24,6 @@ struct add_rvalue_reference : decltype(detail::try_add_rvalue_reference<T>(0)) { template <class T> using add_rvalue_reference_t = typename add_rvalue_reference<T>::type; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ADD_RVALUE_REFERENCE_H diff --git a/libc/src/__support/CPP/type_traits/always_false.h b/libc/src/__support/CPP/type_traits/always_false.h index 0a633d4..a86e926 100644 --- a/libc/src/__support/CPP/type_traits/always_false.h +++ b/libc/src/__support/CPP/type_traits/always_false.h @@ -11,7 +11,7 @@ #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // This is technically not part of the standard but it come often enough that // it's convenient to have around. @@ -24,6 +24,6 @@ namespace __llvm_libc::cpp { // Usage `static_assert(cpp::always_false<T>, "error message");` template <typename...> LIBC_INLINE_VAR constexpr bool always_false = false; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ALWAYS_FALSE_H diff --git a/libc/src/__support/CPP/type_traits/bool_constant.h b/libc/src/__support/CPP/type_traits/bool_constant.h index 84a5c76..72eeaf2 100644 --- a/libc/src/__support/CPP/type_traits/bool_constant.h +++ b/libc/src/__support/CPP/type_traits/bool_constant.h @@ -10,11 +10,11 @@ #include "src/__support/CPP/type_traits/integral_constant.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // bool_constant template <bool V> using bool_constant = cpp::integral_constant<bool, V>; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_BOOL_CONSTANT_H diff --git a/libc/src/__support/CPP/type_traits/conditional.h b/libc/src/__support/CPP/type_traits/conditional.h index 431ccb2..4fa65a0 100644 --- a/libc/src/__support/CPP/type_traits/conditional.h +++ b/libc/src/__support/CPP/type_traits/conditional.h @@ -10,7 +10,7 @@ #include "src/__support/CPP/type_traits/type_identity.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // conditional template <bool B, typename T, typename F> @@ -20,6 +20,6 @@ struct conditional<false, T, F> : type_identity<F> {}; template <bool B, typename T, typename F> using conditional_t = typename conditional<B, T, F>::type; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_CONDITIONAL_H diff --git a/libc/src/__support/CPP/type_traits/decay.h b/libc/src/__support/CPP/type_traits/decay.h index 0961fd1..a018286 100644 --- a/libc/src/__support/CPP/type_traits/decay.h +++ b/libc/src/__support/CPP/type_traits/decay.h @@ -19,7 +19,7 @@ #include "src/__support/CPP/type_traits/remove_extent.h" #include "src/__support/CPP/type_traits/remove_reference.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // decay template <class T> class decay { @@ -33,6 +33,6 @@ public: }; template <class T> using decay_t = typename decay<T>::type; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_DECAY_H diff --git a/libc/src/__support/CPP/type_traits/enable_if.h b/libc/src/__support/CPP/type_traits/enable_if.h index 1a83c2c..cda9189 100644 --- a/libc/src/__support/CPP/type_traits/enable_if.h +++ b/libc/src/__support/CPP/type_traits/enable_if.h @@ -10,7 +10,7 @@ #include "src/__support/CPP/type_traits/type_identity.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // enable_if template <bool B, typename T = void> struct enable_if; @@ -18,6 +18,6 @@ template <typename T> struct enable_if<true, T> : type_identity<T> {}; template <bool B, typename T = void> using enable_if_t = typename enable_if<B, T>::type; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ENABLE_IF_H diff --git a/libc/src/__support/CPP/type_traits/false_type.h b/libc/src/__support/CPP/type_traits/false_type.h index 98c6d1c..97c041cc 100644 --- a/libc/src/__support/CPP/type_traits/false_type.h +++ b/libc/src/__support/CPP/type_traits/false_type.h @@ -10,11 +10,11 @@ #include "src/__support/CPP/type_traits/bool_constant.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // false_type using false_type = cpp::bool_constant<false>; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_FALSE_TYPE_H diff --git a/libc/src/__support/CPP/type_traits/integral_constant.h b/libc/src/__support/CPP/type_traits/integral_constant.h index 958910c..7b5b6c2 100644 --- a/libc/src/__support/CPP/type_traits/integral_constant.h +++ b/libc/src/__support/CPP/type_traits/integral_constant.h @@ -10,7 +10,7 @@ #include "src/__support/macros/attributes.h" // LIBC_INLINE_VAR -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // integral_constant template <typename T, T v> struct integral_constant { @@ -18,6 +18,6 @@ template <typename T, T v> struct integral_constant { LIBC_INLINE_VAR static constexpr T value = v; }; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_INTEGRAL_CONSTANT_H diff --git a/libc/src/__support/CPP/type_traits/invoke.h b/libc/src/__support/CPP/type_traits/invoke.h index 348abe9..edf6a57 100644 --- a/libc/src/__support/CPP/type_traits/invoke.h +++ b/libc/src/__support/CPP/type_traits/invoke.h @@ -17,7 +17,7 @@ #include "src/__support/CPP/type_traits/is_same.h" #include "src/__support/CPP/utility/forward.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { namespace detail { @@ -57,6 +57,6 @@ decltype(auto) invoke(Function &&fun, Args &&...args) { cpp::forward<Function>(fun), cpp::forward<Args>(args)...); } -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_INVOKE_H diff --git a/libc/src/__support/CPP/type_traits/invoke_result.h b/libc/src/__support/CPP/type_traits/invoke_result.h index edcefd2..a6e522f 100644 --- a/libc/src/__support/CPP/type_traits/invoke_result.h +++ b/libc/src/__support/CPP/type_traits/invoke_result.h @@ -12,7 +12,7 @@ #include "src/__support/CPP/type_traits/type_identity.h" #include "src/__support/CPP/utility/declval.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { template <class F, class... Args> struct invoke_result : cpp::type_identity<decltype(cpp::invoke( @@ -21,6 +21,6 @@ struct invoke_result : cpp::type_identity<decltype(cpp::invoke( template <class F, class... Args> using invoke_result_t = typename invoke_result<F, Args...>::type; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_INVOKE_RESULT_H diff --git a/libc/src/__support/CPP/type_traits/is_arithmetic.h b/libc/src/__support/CPP/type_traits/is_arithmetic.h index 9317874..53bb2120 100644 --- a/libc/src/__support/CPP/type_traits/is_arithmetic.h +++ b/libc/src/__support/CPP/type_traits/is_arithmetic.h @@ -13,7 +13,7 @@ #include "src/__support/CPP/type_traits/is_integral.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_arithmetic template <typename T> @@ -22,6 +22,6 @@ struct is_arithmetic : cpp::bool_constant<(cpp::is_integral_v<T> || template <typename T> LIBC_INLINE_VAR constexpr bool is_arithmetic_v = is_arithmetic<T>::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_ARITHMETIC_H diff --git a/libc/src/__support/CPP/type_traits/is_array.h b/libc/src/__support/CPP/type_traits/is_array.h index 2d66ff1..14360b1 100644 --- a/libc/src/__support/CPP/type_traits/is_array.h +++ b/libc/src/__support/CPP/type_traits/is_array.h @@ -14,7 +14,7 @@ #include <stddef.h> // For size_t -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_array template <class T> struct is_array : false_type {}; @@ -23,6 +23,6 @@ template <class T, size_t N> struct is_array<T[N]> : true_type {}; template <class T> LIBC_INLINE_VAR constexpr bool is_array_v = is_array<T>::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_ARRAY_H diff --git a/libc/src/__support/CPP/type_traits/is_base_of.h b/libc/src/__support/CPP/type_traits/is_base_of.h index 46435f2..47fb568 100644 --- a/libc/src/__support/CPP/type_traits/is_base_of.h +++ b/libc/src/__support/CPP/type_traits/is_base_of.h @@ -15,7 +15,7 @@ #include "src/__support/CPP/type_traits/true_type.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_base_of namespace detail { @@ -39,6 +39,6 @@ struct is_base_of template <typename Base, typename Derived> LIBC_INLINE_VAR constexpr bool is_base_of_v = is_base_of<Base, Derived>::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_BASE_OF_H diff --git a/libc/src/__support/CPP/type_traits/is_class.h b/libc/src/__support/CPP/type_traits/is_class.h index bf9c546..83ebaea 100644 --- a/libc/src/__support/CPP/type_traits/is_class.h +++ b/libc/src/__support/CPP/type_traits/is_class.h @@ -13,7 +13,7 @@ #include "src/__support/CPP/type_traits/is_union.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_class namespace detail { @@ -24,6 +24,6 @@ template <class T> struct is_class : decltype(detail::test<T>(nullptr)) {}; template <typename T> LIBC_INLINE_VAR constexpr bool is_class_v = is_class<T>::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_CLASS_H diff --git a/libc/src/__support/CPP/type_traits/is_const.h b/libc/src/__support/CPP/type_traits/is_const.h index 83e7b83..8e56a9a 100644 --- a/libc/src/__support/CPP/type_traits/is_const.h +++ b/libc/src/__support/CPP/type_traits/is_const.h @@ -12,7 +12,7 @@ #include "src/__support/CPP/type_traits/true_type.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_const template <class T> struct is_const : cpp::false_type {}; @@ -20,6 +20,6 @@ template <class T> struct is_const<const T> : cpp::true_type {}; template <class T> LIBC_INLINE_VAR constexpr bool is_const_v = is_const<T>::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_CONST_H diff --git a/libc/src/__support/CPP/type_traits/is_convertible.h b/libc/src/__support/CPP/type_traits/is_convertible.h index cfc82ca..d419443 100644 --- a/libc/src/__support/CPP/type_traits/is_convertible.h +++ b/libc/src/__support/CPP/type_traits/is_convertible.h @@ -12,7 +12,7 @@ #include "src/__support/CPP/utility/declval.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_convertible namespace detail { @@ -40,6 +40,6 @@ template <class From, class To> LIBC_INLINE_VAR constexpr bool is_convertible_v = is_convertible<From, To>::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_CONVERTIBLE_H diff --git a/libc/src/__support/CPP/type_traits/is_destructible.h b/libc/src/__support/CPP/type_traits/is_destructible.h index 2d69fa9..d47de1c 100644 --- a/libc/src/__support/CPP/type_traits/is_destructible.h +++ b/libc/src/__support/CPP/type_traits/is_destructible.h @@ -18,7 +18,7 @@ #include "src/__support/macros/attributes.h" #include "src/__support/macros/config.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_destructible #if LIBC_HAS_BUILTIN(__is_destructible) @@ -61,6 +61,6 @@ template <> struct is_destructible<void> : public false_type {}; template <class T> LIBC_INLINE_VAR constexpr bool is_destructible_v = is_destructible<T>::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_DESTRUCTIBLE_H diff --git a/libc/src/__support/CPP/type_traits/is_enum.h b/libc/src/__support/CPP/type_traits/is_enum.h index 14cea71..8d55a1c 100644 --- a/libc/src/__support/CPP/type_traits/is_enum.h +++ b/libc/src/__support/CPP/type_traits/is_enum.h @@ -11,13 +11,13 @@ #include "src/__support/CPP/type_traits/bool_constant.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_enum template <typename T> struct is_enum : bool_constant<__is_enum(T)> {}; template <typename T> LIBC_INLINE_VAR constexpr bool is_enum_v = is_enum<T>::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_ENUM_H diff --git a/libc/src/__support/CPP/type_traits/is_floating_point.h b/libc/src/__support/CPP/type_traits/is_floating_point.h index ccb004d..2df75a0 100644 --- a/libc/src/__support/CPP/type_traits/is_floating_point.h +++ b/libc/src/__support/CPP/type_traits/is_floating_point.h @@ -12,7 +12,7 @@ #include "src/__support/CPP/type_traits/remove_cv.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_floating_point template <typename T> struct is_floating_point { @@ -30,6 +30,6 @@ template <typename T> LIBC_INLINE_VAR constexpr bool is_floating_point_v = is_floating_point<T>::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_FLOATING_POINT_H diff --git a/libc/src/__support/CPP/type_traits/is_function.h b/libc/src/__support/CPP/type_traits/is_function.h index d8a9166..557b322 100644 --- a/libc/src/__support/CPP/type_traits/is_function.h +++ b/libc/src/__support/CPP/type_traits/is_function.h @@ -14,7 +14,7 @@ #include "src/__support/macros/attributes.h" #include "src/__support/macros/config.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_function #if LIBC_HAS_BUILTIN(__is_function) @@ -28,6 +28,6 @@ struct is_function template <class T> LIBC_INLINE_VAR constexpr bool is_function_v = is_function<T>::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_FUNCTION_H diff --git a/libc/src/__support/CPP/type_traits/is_integral.h b/libc/src/__support/CPP/type_traits/is_integral.h index 511101c..2808be5 100644 --- a/libc/src/__support/CPP/type_traits/is_integral.h +++ b/libc/src/__support/CPP/type_traits/is_integral.h @@ -12,7 +12,7 @@ #include "src/__support/CPP/type_traits/remove_cv.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_integral template <typename T> struct is_integral { @@ -34,6 +34,6 @@ public: template <typename T> LIBC_INLINE_VAR constexpr bool is_integral_v = is_integral<T>::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_INTEGRAL_H diff --git a/libc/src/__support/CPP/type_traits/is_lvalue_reference.h b/libc/src/__support/CPP/type_traits/is_lvalue_reference.h index ca3b7d9..f52e303 100644 --- a/libc/src/__support/CPP/type_traits/is_lvalue_reference.h +++ b/libc/src/__support/CPP/type_traits/is_lvalue_reference.h @@ -14,7 +14,7 @@ #include "src/__support/macros/attributes.h" #include "src/__support/macros/config.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_lvalue_reference #if LIBC_HAS_BUILTIN(__is_lvalue_reference) @@ -28,6 +28,6 @@ template <class T> LIBC_INLINE_VAR constexpr bool is_lvalue_reference_v = is_lvalue_reference<T>::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_LVALUE_REFERENCE_H diff --git a/libc/src/__support/CPP/type_traits/is_member_pointer.h b/libc/src/__support/CPP/type_traits/is_member_pointer.h index c885e77..f1f362f 100644 --- a/libc/src/__support/CPP/type_traits/is_member_pointer.h +++ b/libc/src/__support/CPP/type_traits/is_member_pointer.h @@ -13,7 +13,7 @@ #include "src/__support/CPP/type_traits/true_type.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_member_pointer template <class T> struct is_member_pointer_helper : cpp::false_type {}; @@ -25,6 +25,6 @@ template <class T> LIBC_INLINE_VAR constexpr bool is_member_pointer_v = is_member_pointer<T>::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_MEMBER_POINTER_H diff --git a/libc/src/__support/CPP/type_traits/is_null_pointer.h b/libc/src/__support/CPP/type_traits/is_null_pointer.h index bc661e3..1445243 100644 --- a/libc/src/__support/CPP/type_traits/is_null_pointer.h +++ b/libc/src/__support/CPP/type_traits/is_null_pointer.h @@ -12,7 +12,7 @@ #include "src/__support/CPP/type_traits/remove_cv.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_null_pointer using nullptr_t = decltype(nullptr); @@ -21,6 +21,6 @@ struct is_null_pointer : cpp::is_same<cpp::nullptr_t, cpp::remove_cv_t<T>> {}; template <class T> LIBC_INLINE_VAR constexpr bool is_null_pointer_v = is_null_pointer<T>::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_NULL_POINTER_H diff --git a/libc/src/__support/CPP/type_traits/is_object.h b/libc/src/__support/CPP/type_traits/is_object.h index a9dafee..a23bebc 100644 --- a/libc/src/__support/CPP/type_traits/is_object.h +++ b/libc/src/__support/CPP/type_traits/is_object.h @@ -15,7 +15,7 @@ #include "src/__support/CPP/type_traits/is_union.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_object template <class T> @@ -25,6 +25,6 @@ struct is_object template <class T> LIBC_INLINE_VAR constexpr bool is_object_v = is_object<T>::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_OBJECT_H diff --git a/libc/src/__support/CPP/type_traits/is_pointer.h b/libc/src/__support/CPP/type_traits/is_pointer.h index 0903c58..177f8e5 100644 --- a/libc/src/__support/CPP/type_traits/is_pointer.h +++ b/libc/src/__support/CPP/type_traits/is_pointer.h @@ -12,7 +12,7 @@ #include "src/__support/CPP/type_traits/true_type.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_pointer template <typename T> struct is_pointer : cpp::false_type {}; @@ -23,6 +23,6 @@ template <typename T> struct is_pointer<T *const volatile> : cpp::true_type {}; template <typename T> LIBC_INLINE_VAR constexpr bool is_pointer_v = is_pointer<T>::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_POINTER_H diff --git a/libc/src/__support/CPP/type_traits/is_reference.h b/libc/src/__support/CPP/type_traits/is_reference.h index ff3b26c..c017028 100644 --- a/libc/src/__support/CPP/type_traits/is_reference.h +++ b/libc/src/__support/CPP/type_traits/is_reference.h @@ -14,7 +14,7 @@ #include "src/__support/macros/attributes.h" #include "src/__support/macros/config.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_reference #if LIBC_HAS_BUILTIN(__is_reference) @@ -27,6 +27,6 @@ template <typename T> struct is_reference<T &&> : public true_type {}; template <class T> LIBC_INLINE_VAR constexpr bool is_reference_v = is_reference<T>::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_REFERENCE_H diff --git a/libc/src/__support/CPP/type_traits/is_rvalue_reference.h b/libc/src/__support/CPP/type_traits/is_rvalue_reference.h index eb8412a..f0487e4 100644 --- a/libc/src/__support/CPP/type_traits/is_rvalue_reference.h +++ b/libc/src/__support/CPP/type_traits/is_rvalue_reference.h @@ -14,7 +14,7 @@ #include "src/__support/macros/attributes.h" #include "src/__support/macros/config.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_rvalue_reference #if LIBC_HAS_BUILTIN(__is_rvalue_reference) @@ -28,6 +28,6 @@ template <class T> LIBC_INLINE_VAR constexpr bool is_rvalue_reference_v = is_rvalue_reference<T>::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_RVALUE_REFERENCE_H diff --git a/libc/src/__support/CPP/type_traits/is_same.h b/libc/src/__support/CPP/type_traits/is_same.h index bd1c736..eb73952 100644 --- a/libc/src/__support/CPP/type_traits/is_same.h +++ b/libc/src/__support/CPP/type_traits/is_same.h @@ -12,7 +12,7 @@ #include "src/__support/CPP/type_traits/true_type.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_same template <typename T, typename U> struct is_same : cpp::false_type {}; @@ -20,6 +20,6 @@ template <typename T> struct is_same<T, T> : cpp::true_type {}; template <typename T, typename U> LIBC_INLINE_VAR constexpr bool is_same_v = is_same<T, U>::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_SAME_H diff --git a/libc/src/__support/CPP/type_traits/is_scalar.h b/libc/src/__support/CPP/type_traits/is_scalar.h index ed7e34e..1f71cde 100644 --- a/libc/src/__support/CPP/type_traits/is_scalar.h +++ b/libc/src/__support/CPP/type_traits/is_scalar.h @@ -16,7 +16,7 @@ #include "src/__support/CPP/type_traits/is_pointer.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_scalar template <class T> @@ -27,6 +27,6 @@ struct is_scalar template <class T> LIBC_INLINE_VAR constexpr bool is_scalar_v = is_scalar<T>::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_SCALAR_H diff --git a/libc/src/__support/CPP/type_traits/is_signed.h b/libc/src/__support/CPP/type_traits/is_signed.h index 7115130..971fe69 100644 --- a/libc/src/__support/CPP/type_traits/is_signed.h +++ b/libc/src/__support/CPP/type_traits/is_signed.h @@ -12,7 +12,7 @@ #include "src/__support/CPP/type_traits/is_arithmetic.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_signed template <typename T> @@ -23,6 +23,6 @@ struct is_signed : bool_constant<(is_arithmetic_v<T> && (T(-1) < T(0)))> { template <typename T> LIBC_INLINE_VAR constexpr bool is_signed_v = is_signed<T>::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_SIGNED_H diff --git a/libc/src/__support/CPP/type_traits/is_trivially_constructible.h b/libc/src/__support/CPP/type_traits/is_trivially_constructible.h index daa9c7a..be97b22 100644 --- a/libc/src/__support/CPP/type_traits/is_trivially_constructible.h +++ b/libc/src/__support/CPP/type_traits/is_trivially_constructible.h @@ -10,13 +10,13 @@ #include "src/__support/CPP/type_traits/integral_constant.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_trivially_constructible template <class T, class... Args> struct is_trivially_constructible : integral_constant<bool, __is_trivially_constructible(T, Args...)> {}; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_TRIVIALLY_CONSTRUCTIBLE_H diff --git a/libc/src/__support/CPP/type_traits/is_trivially_copyable.h b/libc/src/__support/CPP/type_traits/is_trivially_copyable.h index 9e7d05e..0c3fdcc 100644 --- a/libc/src/__support/CPP/type_traits/is_trivially_copyable.h +++ b/libc/src/__support/CPP/type_traits/is_trivially_copyable.h @@ -11,13 +11,13 @@ #include "src/__support/CPP/type_traits/integral_constant.h" #include "src/__support/macros/config.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_trivially_copyable template <class T> struct is_trivially_copyable : public integral_constant<bool, __is_trivially_copyable(T)> {}; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_TRIVIALLY_COPYABLE_H diff --git a/libc/src/__support/CPP/type_traits/is_trivially_destructible.h b/libc/src/__support/CPP/type_traits/is_trivially_destructible.h index ce32309..3345149 100644 --- a/libc/src/__support/CPP/type_traits/is_trivially_destructible.h +++ b/libc/src/__support/CPP/type_traits/is_trivially_destructible.h @@ -13,7 +13,7 @@ #include "src/__support/macros/attributes.h" #include "src/__support/macros/config.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_trivially_destructible #if LIBC_HAS_BUILTIN(__is_trivially_destructible) @@ -30,6 +30,6 @@ template <typename T> LIBC_INLINE_VAR constexpr bool is_trivially_destructible_v = is_trivially_destructible<T>::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_TRIVIALLY_DESTRUCTIBLE_H diff --git a/libc/src/__support/CPP/type_traits/is_union.h b/libc/src/__support/CPP/type_traits/is_union.h index 807d8f13c..04e78a8 100644 --- a/libc/src/__support/CPP/type_traits/is_union.h +++ b/libc/src/__support/CPP/type_traits/is_union.h @@ -11,13 +11,13 @@ #include "src/__support/CPP/type_traits/bool_constant.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_union template <class T> struct is_union : bool_constant<__is_union(T)> {}; template <typename T> LIBC_INLINE_VAR constexpr bool is_union_v = is_union<T>::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_UNION_H diff --git a/libc/src/__support/CPP/type_traits/is_unsigned.h b/libc/src/__support/CPP/type_traits/is_unsigned.h index c4dc777..f089c2b 100644 --- a/libc/src/__support/CPP/type_traits/is_unsigned.h +++ b/libc/src/__support/CPP/type_traits/is_unsigned.h @@ -12,7 +12,7 @@ #include "src/__support/CPP/type_traits/is_arithmetic.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_unsigned template <typename T> @@ -23,6 +23,6 @@ struct is_unsigned : bool_constant<(is_arithmetic_v<T> && (T(-1) > T(0)))> { template <typename T> LIBC_INLINE_VAR constexpr bool is_unsigned_v = is_unsigned<T>::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_UNSIGNED_H diff --git a/libc/src/__support/CPP/type_traits/is_void.h b/libc/src/__support/CPP/type_traits/is_void.h index 54cda12..040dc83 100644 --- a/libc/src/__support/CPP/type_traits/is_void.h +++ b/libc/src/__support/CPP/type_traits/is_void.h @@ -12,13 +12,13 @@ #include "src/__support/CPP/type_traits/remove_cv.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_void template <typename T> struct is_void : is_same<void, remove_cv_t<T>> {}; template <typename T> LIBC_INLINE_VAR constexpr bool is_void_v = is_void<T>::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_VOID_H diff --git a/libc/src/__support/CPP/type_traits/make_signed.h b/libc/src/__support/CPP/type_traits/make_signed.h index 0e8bff6..2130285 100644 --- a/libc/src/__support/CPP/type_traits/make_signed.h +++ b/libc/src/__support/CPP/type_traits/make_signed.h @@ -10,7 +10,7 @@ #include "src/__support/CPP/type_traits/type_identity.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // make_signed template <typename T> struct make_signed; @@ -32,6 +32,6 @@ template <> struct make_signed<__uint128_t> : type_identity<__int128_t> {}; #endif template <typename T> using make_signed_t = typename make_signed<T>::type; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_MAKE_SIGNED_H diff --git a/libc/src/__support/CPP/type_traits/make_unsigned.h b/libc/src/__support/CPP/type_traits/make_unsigned.h index 75fc818..2094801 100644 --- a/libc/src/__support/CPP/type_traits/make_unsigned.h +++ b/libc/src/__support/CPP/type_traits/make_unsigned.h @@ -10,7 +10,7 @@ #include "src/__support/CPP/type_traits/type_identity.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // make_unsigned @@ -37,6 +37,6 @@ template <> struct make_unsigned<__uint128_t> : type_identity<__uint128_t> {}; #endif template <typename T> using make_unsigned_t = typename make_unsigned<T>::type; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_MAKE_UNSIGNED_H diff --git a/libc/src/__support/CPP/type_traits/remove_all_extents.h b/libc/src/__support/CPP/type_traits/remove_all_extents.h index da66043..bff6341 100644 --- a/libc/src/__support/CPP/type_traits/remove_all_extents.h +++ b/libc/src/__support/CPP/type_traits/remove_all_extents.h @@ -13,7 +13,7 @@ #include <stddef.h> // size_t -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // remove_all_extents #if LIBC_HAS_BUILTIN(__remove_all_extents) @@ -34,6 +34,6 @@ template <typename T> using remove_all_extents_t = typename remove_all_extents<T>::type; #endif -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_ALL_EXTENTS_H diff --git a/libc/src/__support/CPP/type_traits/remove_cv.h b/libc/src/__support/CPP/type_traits/remove_cv.h index 972e0fc..3cd7e59 100644 --- a/libc/src/__support/CPP/type_traits/remove_cv.h +++ b/libc/src/__support/CPP/type_traits/remove_cv.h @@ -10,7 +10,7 @@ #include "src/__support/CPP/type_traits/type_identity.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // remove_cv template <class T> struct remove_cv : cpp::type_identity<T> {}; @@ -20,6 +20,6 @@ template <class T> struct remove_cv<const volatile T> : cpp::type_identity<T> {}; template <class T> using remove_cv_t = typename remove_cv<T>::type; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_CV_H diff --git a/libc/src/__support/CPP/type_traits/remove_cvref.h b/libc/src/__support/CPP/type_traits/remove_cvref.h index 7383148..6b410bb 100644 --- a/libc/src/__support/CPP/type_traits/remove_cvref.h +++ b/libc/src/__support/CPP/type_traits/remove_cvref.h @@ -11,7 +11,7 @@ #include "src/__support/CPP/type_traits/remove_cv.h" #include "src/__support/CPP/type_traits/remove_reference.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // remove_cvref template <typename T> struct remove_cvref { @@ -19,6 +19,6 @@ template <typename T> struct remove_cvref { }; template <typename T> using remove_cvref_t = typename remove_cvref<T>::type; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_CVREF_H diff --git a/libc/src/__support/CPP/type_traits/remove_extent.h b/libc/src/__support/CPP/type_traits/remove_extent.h index 72d8d98..3c0759d 100644 --- a/libc/src/__support/CPP/type_traits/remove_extent.h +++ b/libc/src/__support/CPP/type_traits/remove_extent.h @@ -11,7 +11,7 @@ #include "src/__support/CPP/type_traits/type_identity.h" #include "stddef.h" // size_t -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // remove_extent template <class T> struct remove_extent : cpp::type_identity<T> {}; @@ -20,6 +20,6 @@ template <class T, size_t N> struct remove_extent<T[N]> : cpp::type_identity<T> {}; template <class T> using remove_extent_t = typename remove_extent<T>::type; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_EXTENT_H diff --git a/libc/src/__support/CPP/type_traits/remove_reference.h b/libc/src/__support/CPP/type_traits/remove_reference.h index 34f0ae9..02a0bd6 100644 --- a/libc/src/__support/CPP/type_traits/remove_reference.h +++ b/libc/src/__support/CPP/type_traits/remove_reference.h @@ -10,7 +10,7 @@ #include "src/__support/CPP/type_traits/type_identity.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // remove_reference template <class T> struct remove_reference : cpp::type_identity<T> {}; @@ -19,6 +19,6 @@ template <class T> struct remove_reference<T &&> : cpp::type_identity<T> {}; template <class T> using remove_reference_t = typename remove_reference<T>::type; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_REFERENCE_H diff --git a/libc/src/__support/CPP/type_traits/true_type.h b/libc/src/__support/CPP/type_traits/true_type.h index 8551cef..60ffc8a 100644 --- a/libc/src/__support/CPP/type_traits/true_type.h +++ b/libc/src/__support/CPP/type_traits/true_type.h @@ -10,11 +10,11 @@ #include "src/__support/CPP/type_traits/bool_constant.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // true_type using true_type = cpp::bool_constant<true>; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_TRUE_TYPE_H diff --git a/libc/src/__support/CPP/type_traits/type_identity.h b/libc/src/__support/CPP/type_traits/type_identity.h index 0804276..f33a43a 100644 --- a/libc/src/__support/CPP/type_traits/type_identity.h +++ b/libc/src/__support/CPP/type_traits/type_identity.h @@ -8,13 +8,13 @@ #ifndef LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_TYPE_IDENTITY_H #define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_TYPE_IDENTITY_H -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // type_identity template <typename T> struct type_identity { using type = T; }; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_TYPE_IDENTITY_H diff --git a/libc/src/__support/CPP/type_traits/void_t.h b/libc/src/__support/CPP/type_traits/void_t.h index 03fe6b9..babdacc 100644 --- a/libc/src/__support/CPP/type_traits/void_t.h +++ b/libc/src/__support/CPP/type_traits/void_t.h @@ -10,7 +10,7 @@ #include "src/__support/CPP/type_traits/type_identity.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // void_t @@ -21,6 +21,6 @@ template <typename... Ts> struct make_void : cpp::type_identity<void> {}; template <typename... Ts> using void_t = typename detail::make_void<Ts...>::type; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_VOID_T_H diff --git a/libc/src/__support/CPP/utility/declval.h b/libc/src/__support/CPP/utility/declval.h index 2522baf..0d00aa6 100644 --- a/libc/src/__support/CPP/utility/declval.h +++ b/libc/src/__support/CPP/utility/declval.h @@ -11,7 +11,7 @@ #include "src/__support/CPP/type_traits/add_rvalue_reference.h" #include "src/__support/CPP/type_traits/always_false.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // declval template <typename T> cpp::add_rvalue_reference_t<T> declval() { @@ -19,6 +19,6 @@ template <typename T> cpp::add_rvalue_reference_t<T> declval() { "declval not allowed in an evaluated context"); } -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_UTILITY_DECLVAL_H diff --git a/libc/src/__support/CPP/utility/forward.h b/libc/src/__support/CPP/utility/forward.h index 78ffb736..891097ec 100644 --- a/libc/src/__support/CPP/utility/forward.h +++ b/libc/src/__support/CPP/utility/forward.h @@ -12,7 +12,7 @@ #include "src/__support/CPP/type_traits/remove_reference.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // forward template <typename T> @@ -27,6 +27,6 @@ LIBC_INLINE constexpr T &&forward(remove_reference_t<T> &&value) { return static_cast<T &&>(value); } -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_UTILITY_FORWARD_H diff --git a/libc/src/__support/CPP/utility/in_place.h b/libc/src/__support/CPP/utility/in_place.h index dfb7486..f15703f 100644 --- a/libc/src/__support/CPP/utility/in_place.h +++ b/libc/src/__support/CPP/utility/in_place.h @@ -12,7 +12,7 @@ #include <stddef.h> // size_t -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // in_place struct in_place_t { @@ -31,6 +31,6 @@ template <size_t I> struct in_place_index_t { template <size_t I> LIBC_INLINE_VAR constexpr in_place_index_t<I> in_place_index{}; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_UTILITY_IN_PLACE_H diff --git a/libc/src/__support/CPP/utility/integer_sequence.h b/libc/src/__support/CPP/utility/integer_sequence.h index 3d2e001..2ed26df 100644 --- a/libc/src/__support/CPP/utility/integer_sequence.h +++ b/libc/src/__support/CPP/utility/integer_sequence.h @@ -10,7 +10,7 @@ #include "src/__support/CPP/type_traits/is_integral.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // integer_sequence template <typename T, T... Ints> struct integer_sequence { @@ -32,6 +32,6 @@ template <typename T, int N> using make_integer_sequence = typename detail::make_integer_sequence<T, N - 1>::type; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_UTILITY_INTEGER_SEQUENCE_H diff --git a/libc/src/__support/CPP/utility/move.h b/libc/src/__support/CPP/utility/move.h index bc0b63e..2b4cdf0 100644 --- a/libc/src/__support/CPP/utility/move.h +++ b/libc/src/__support/CPP/utility/move.h @@ -10,13 +10,13 @@ #include "src/__support/CPP/type_traits/remove_reference.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // move template <class T> constexpr cpp::remove_reference_t<T> &&move(T &&t) { return static_cast<typename cpp::remove_reference_t<T> &&>(t); } -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_UTILITY_MOVE_H diff --git a/libc/src/__support/FPUtil/BasicOperations.h b/libc/src/__support/FPUtil/BasicOperations.h index 67b8e66..2ec6151 100644 --- a/libc/src/__support/FPUtil/BasicOperations.h +++ b/libc/src/__support/FPUtil/BasicOperations.h @@ -14,7 +14,7 @@ #include "src/__support/CPP/type_traits.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0> @@ -76,6 +76,6 @@ LIBC_INLINE T fdim(T x, T y) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_BASICOPERATIONS_H diff --git a/libc/src/__support/FPUtil/DivisionAndRemainderOperations.h b/libc/src/__support/FPUtil/DivisionAndRemainderOperations.h index f0b5ba9..60252fe 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 29ae4a3..8801760 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 eb95bf0..32e562ab 100644 --- a/libc/src/__support/FPUtil/FMA.h +++ b/libc/src/__support/FPUtil/FMA.h @@ -29,7 +29,7 @@ #include "generic/FMA.h" #include "src/__support/CPP/type_traits.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template <typename T> LIBC_INLINE T fma(T x, T y, T z) { @@ -37,7 +37,7 @@ template <typename T> LIBC_INLINE T fma(T x, T y, T z) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif diff --git a/libc/src/__support/FPUtil/FPBits.h b/libc/src/__support/FPUtil/FPBits.h index d7ab076..226dd9b 100644 --- a/libc/src/__support/FPUtil/FPBits.h +++ b/libc/src/__support/FPUtil/FPBits.h @@ -19,7 +19,7 @@ #include "FloatProperties.h" #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template <typename T> struct MantissaWidth { @@ -233,7 +233,7 @@ template <typename T> struct FPBits { }; } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #ifdef SPECIAL_X86_LONG_DOUBLE #include "x86_64/LongDoubleBits.h" diff --git a/libc/src/__support/FPUtil/FloatProperties.h b/libc/src/__support/FPUtil/FloatProperties.h index 3df961a..c1d58a8 100644 --- a/libc/src/__support/FPUtil/FloatProperties.h +++ b/libc/src/__support/FPUtil/FloatProperties.h @@ -15,7 +15,7 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template <typename T> struct FloatProperties {}; @@ -194,6 +194,6 @@ template <typename BitsType> using FloatTypeT = typename FloatType<BitsType>::Type; } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_FLOATPROPERTIES_H diff --git a/libc/src/__support/FPUtil/Hypot.h b/libc/src/__support/FPUtil/Hypot.h index 5bf6db7..357d9a6 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 676dafa..6d62a2d 100644 --- a/libc/src/__support/FPUtil/ManipulationFunctions.h +++ b/libc/src/__support/FPUtil/ManipulationFunctions.h @@ -22,7 +22,7 @@ #include <limits.h> #include <math.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0> @@ -174,7 +174,7 @@ LIBC_INLINE T nextafter(T from, T to) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #ifdef SPECIAL_X86_LONG_DOUBLE #include "x86_64/NextAfterLongDouble.h" diff --git a/libc/src/__support/FPUtil/NearestIntegerOperations.h b/libc/src/__support/FPUtil/NearestIntegerOperations.h index 9f151f2..8c4b248 100644 --- a/libc/src/__support/FPUtil/NearestIntegerOperations.h +++ b/libc/src/__support/FPUtil/NearestIntegerOperations.h @@ -18,7 +18,7 @@ #include <math.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template <typename T, cpp::enable_if_t<cpp::is_floating_point_v<T>, int> = 0> @@ -286,6 +286,6 @@ LIBC_INLINE I round_to_signed_integer_using_current_rounding_mode(F x) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_NEARESTINTEGEROPERATIONS_H diff --git a/libc/src/__support/FPUtil/NormalFloat.h b/libc/src/__support/FPUtil/NormalFloat.h index 0b2eb62..afbf97cc 100644 --- a/libc/src/__support/FPUtil/NormalFloat.h +++ b/libc/src/__support/FPUtil/NormalFloat.h @@ -16,7 +16,7 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { // A class which stores the normalized form of a floating point value. @@ -262,6 +262,6 @@ template <> LIBC_INLINE NormalFloat<long double>::operator long double() const { #endif // SPECIAL_X86_LONG_DOUBLE } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_NORMALFLOAT_H diff --git a/libc/src/__support/FPUtil/PolyEval.h b/libc/src/__support/FPUtil/PolyEval.h index 1202728..7a63845 100644 --- a/libc/src/__support/FPUtil/PolyEval.h +++ b/libc/src/__support/FPUtil/PolyEval.h @@ -20,7 +20,7 @@ // Example: to evaluate x^3 + 2*x^2 + 3*x + 4, call // polyeval( x, 4.0, 3.0, 2.0, 1.0 ) -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template <typename T> @@ -48,6 +48,6 @@ polyeval(T x, T a0, Ts... a) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_POLYEVAL_H diff --git a/libc/src/__support/FPUtil/XFloat.h b/libc/src/__support/FPUtil/XFloat.h index b3f8f44..fe334f8 100644 --- a/libc/src/__support/FPUtil/XFloat.h +++ b/libc/src/__support/FPUtil/XFloat.h @@ -12,7 +12,7 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { // Store and manipulate positive double precision numbers at |Precision| bits. @@ -177,4 +177,4 @@ public: }; } // 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 4cc4920..47c65af 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 eaa3b2c..6254a06 100644 --- a/libc/src/__support/FPUtil/aarch64/FMA.h +++ b/libc/src/__support/FPUtil/aarch64/FMA.h @@ -23,7 +23,7 @@ #include "src/__support/CPP/type_traits.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template <typename T> @@ -45,6 +45,6 @@ LIBC_INLINE cpp::enable_if_t<cpp::is_same_v<T, double>, T> fma(T x, T y, T z) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_AARCH64_FMA_H diff --git a/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h b/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h index 9243df1..6a0ac5f 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 2ee4e33..ca076307 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 6edf2a4..bad7e31 100644 --- a/libc/src/__support/FPUtil/aarch64/sqrt.h +++ b/libc/src/__support/FPUtil/aarch64/sqrt.h @@ -18,7 +18,7 @@ #include "src/__support/FPUtil/generic/sqrt.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template <> LIBC_INLINE float sqrt<float>(float x) { @@ -34,6 +34,6 @@ template <> LIBC_INLINE double sqrt<double>(double x) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_AARCH64_SQRT_H diff --git a/libc/src/__support/FPUtil/arm/FEnvImpl.h b/libc/src/__support/FPUtil/arm/FEnvImpl.h index 5e85607..e2669d1 100644 --- a/libc/src/__support/FPUtil/arm/FEnvImpl.h +++ b/libc/src/__support/FPUtil/arm/FEnvImpl.h @@ -15,7 +15,7 @@ #include <fenv.h> #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { struct FEnv { @@ -260,6 +260,6 @@ LIBC_INLINE int set_env(const fenv_t *envp) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_ARM_FENVIMPL_H diff --git a/libc/src/__support/FPUtil/double_double.h b/libc/src/__support/FPUtil/double_double.h index fd44d5e..b9490b5 100644 --- a/libc/src/__support/FPUtil/double_double.h +++ b/libc/src/__support/FPUtil/double_double.h @@ -14,9 +14,9 @@ #include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA #include "src/__support/number_pair.h" -namespace __llvm_libc::fputil { +namespace LIBC_NAMESPACE::fputil { -using DoubleDouble = __llvm_libc::NumberPair<double>; +using DoubleDouble = LIBC_NAMESPACE::NumberPair<double>; // The output of Dekker's FastTwoSum algorithm is correct, i.e.: // r.hi + r.lo = a + b exactly @@ -99,6 +99,6 @@ LIBC_INLINE DoubleDouble multiply_add<DoubleDouble>(const DoubleDouble &a, return add(c, quick_mult(a, b)); } -} // namespace __llvm_libc::fputil +} // namespace LIBC_NAMESPACE::fputil #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_DOUBLE_DOUBLE_H diff --git a/libc/src/__support/FPUtil/dyadic_float.h b/libc/src/__support/FPUtil/dyadic_float.h index ec000d5..2ee97b4 100644 --- a/libc/src/__support/FPUtil/dyadic_float.h +++ b/libc/src/__support/FPUtil/dyadic_float.h @@ -18,7 +18,7 @@ #include <stddef.h> -namespace __llvm_libc::fputil { +namespace LIBC_NAMESPACE::fputil { // A generic class to perform comuptations of high precision floating points. // We store the value in dyadic format, including 3 fields: @@ -32,7 +32,7 @@ namespace __llvm_libc::fputil { // To simplify and improve the efficiency, many functions will assume that the // inputs are normal. template <size_t Bits> struct DyadicFloat { - using MantissaType = __llvm_libc::cpp::UInt<Bits>; + using MantissaType = LIBC_NAMESPACE::cpp::UInt<Bits>; bool sign = false; int exponent = 0; @@ -306,6 +306,6 @@ constexpr DyadicFloat<Bits> mul_pow_2(DyadicFloat<Bits> a, int32_t pow_2) { return result; } -} // namespace __llvm_libc::fputil +} // namespace LIBC_NAMESPACE::fputil #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_DYADIC_FLOAT_H diff --git a/libc/src/__support/FPUtil/except_value_utils.h b/libc/src/__support/FPUtil/except_value_utils.h index 0229c96..b510250 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 46cd102..4dec85a 100644 --- a/libc/src/__support/FPUtil/fpbits_str.h +++ b/libc/src/__support/FPUtil/fpbits_str.h @@ -16,7 +16,7 @@ #include "src/__support/integer_to_string.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace details { @@ -70,6 +70,6 @@ template <typename T> LIBC_INLINE cpp::string str(fputil::FPBits<T> x) { return s; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_FP_BITS_STR_H diff --git a/libc/src/__support/FPUtil/generic/FMA.h b/libc/src/__support/FPUtil/generic/FMA.h index ee66593..b90b134 100644 --- a/libc/src/__support/FPUtil/generic/FMA.h +++ b/libc/src/__support/FPUtil/generic/FMA.h @@ -19,7 +19,7 @@ #include "src/__support/macros/attributes.h" // LIBC_INLINE #include "src/__support/macros/optimization.h" // LIBC_UNLIKELY -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { namespace generic { @@ -290,6 +290,6 @@ template <> LIBC_INLINE double fma<double>(double x, double y, double z) { } // namespace generic } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_GENERIC_FMA_H diff --git a/libc/src/__support/FPUtil/generic/FMod.h b/libc/src/__support/FPUtil/generic/FMod.h index 1099844..48906e5 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 @@ public: } // 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 9b29e84..61278ac 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 35ace13..7d446d3 100644 --- a/libc/src/__support/FPUtil/generic/sqrt.h +++ b/libc/src/__support/FPUtil/generic/sqrt.h @@ -20,7 +20,7 @@ #include "src/__support/builtin_wrappers.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { namespace internal { @@ -169,6 +169,6 @@ LIBC_INLINE cpp::enable_if_t<cpp::is_floating_point_v<T>, T> sqrt(T x) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_GENERIC_SQRT_H diff --git a/libc/src/__support/FPUtil/generic/sqrt_80_bit_long_double.h b/libc/src/__support/FPUtil/generic/sqrt_80_bit_long_double.h index 2b03273..685a90d 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 7990ec0..86bc860 100644 --- a/libc/src/__support/FPUtil/gpu/FMA.h +++ b/libc/src/__support/FPUtil/gpu/FMA.h @@ -17,7 +17,7 @@ static_assert(LIBC_HAS_BUILTIN(__builtin_fma), "FMA builtins must be defined"); static_assert(LIBC_HAS_BUILTIN(__builtin_fmaf), "FMA builtins must be defined"); -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template <typename T> @@ -31,6 +31,6 @@ LIBC_INLINE cpp::enable_if_t<cpp::is_same_v<T, double>, T> fma(T x, T y, T z) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_GPU_FMA_H diff --git a/libc/src/__support/FPUtil/multiply_add.h b/libc/src/__support/FPUtil/multiply_add.h index 6670a15..82932da 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 9ccaf55..bc98667 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 05b62dd..4b2d0ea 100644 --- a/libc/src/__support/FPUtil/riscv32/FEnvImpl.h +++ b/libc/src/__support/FPUtil/riscv32/FEnvImpl.h @@ -16,7 +16,7 @@ #include <fenv.h> #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { struct FEnv { @@ -175,6 +175,6 @@ LIBC_INLINE int set_env(const fenv_t *envp) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_RISCV32_FENVIMPL_H diff --git a/libc/src/__support/FPUtil/riscv64/FEnvImpl.h b/libc/src/__support/FPUtil/riscv64/FEnvImpl.h index 2e3c3c7..db244fc 100644 --- a/libc/src/__support/FPUtil/riscv64/FEnvImpl.h +++ b/libc/src/__support/FPUtil/riscv64/FEnvImpl.h @@ -16,7 +16,7 @@ #include <fenv.h> #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { struct FEnv { @@ -175,6 +175,6 @@ LIBC_INLINE int set_env(const fenv_t *envp) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_RISCV64_FENVIMPL_H diff --git a/libc/src/__support/FPUtil/riscv64/FMA.h b/libc/src/__support/FPUtil/riscv64/FMA.h index 88623a6..770a234 100644 --- a/libc/src/__support/FPUtil/riscv64/FMA.h +++ b/libc/src/__support/FPUtil/riscv64/FMA.h @@ -23,7 +23,7 @@ #include "src/__support/CPP/type_traits.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template <typename T> @@ -45,6 +45,6 @@ LIBC_INLINE cpp::enable_if_t<cpp::is_same_v<T, double>, T> fma(T x, T y, T z) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_RISCV64_FMA_H diff --git a/libc/src/__support/FPUtil/riscv64/sqrt.h b/libc/src/__support/FPUtil/riscv64/sqrt.h index 12c9acd..b34a099 100644 --- a/libc/src/__support/FPUtil/riscv64/sqrt.h +++ b/libc/src/__support/FPUtil/riscv64/sqrt.h @@ -18,7 +18,7 @@ #include "src/__support/FPUtil/generic/sqrt.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template <> LIBC_INLINE float sqrt<float>(float x) { @@ -34,6 +34,6 @@ template <> LIBC_INLINE double sqrt<double>(double x) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_RISCV64_SQRT_H diff --git a/libc/src/__support/FPUtil/rounding_mode.h b/libc/src/__support/FPUtil/rounding_mode.h index a11b6b4..91a5b9c 100644 --- a/libc/src/__support/FPUtil/rounding_mode.h +++ b/libc/src/__support/FPUtil/rounding_mode.h @@ -13,7 +13,7 @@ #include <fenv.h> -namespace __llvm_libc::fputil { +namespace LIBC_NAMESPACE::fputil { // Quick free-standing test whether fegetround() == FE_UPWARD. // Using the following observation: @@ -74,6 +74,6 @@ LIBC_INLINE int quick_get_round() { return (2.0f + y == 2.0f) ? FE_TONEAREST : FE_UPWARD; } -} // namespace __llvm_libc::fputil +} // namespace LIBC_NAMESPACE::fputil #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_ROUNDING_MODE_H diff --git a/libc/src/__support/FPUtil/triple_double.h b/libc/src/__support/FPUtil/triple_double.h index 1f85382..eafa777 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 4380efa..b73b70e9 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 b54613a..91ef7f9 100644 --- a/libc/src/__support/FPUtil/x86_64/FMA.h +++ b/libc/src/__support/FPUtil/x86_64/FMA.h @@ -24,7 +24,7 @@ #include "src/__support/CPP/type_traits.h" #include <immintrin.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template <typename T> @@ -50,6 +50,6 @@ LIBC_INLINE cpp::enable_if_t<cpp::is_same_v<T, double>, T> fma(T x, T y, T z) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_X86_64_FMA_H diff --git a/libc/src/__support/FPUtil/x86_64/LongDoubleBits.h b/libc/src/__support/FPUtil/x86_64/LongDoubleBits.h index 43273ee..085c196 100644 --- a/libc/src/__support/FPUtil/x86_64/LongDoubleBits.h +++ b/libc/src/__support/FPUtil/x86_64/LongDoubleBits.h @@ -22,7 +22,7 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template <unsigned Width> struct Padding; @@ -233,6 +233,6 @@ static_assert( "Internal long double representation does not match the machine format."); } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_X86_64_LONGDOUBLEBITS_H diff --git a/libc/src/__support/FPUtil/x86_64/NextAfterLongDouble.h b/libc/src/__support/FPUtil/x86_64/NextAfterLongDouble.h index 98e90e0..52ef256 100644 --- a/libc/src/__support/FPUtil/x86_64/NextAfterLongDouble.h +++ b/libc/src/__support/FPUtil/x86_64/NextAfterLongDouble.h @@ -20,7 +20,7 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { LIBC_INLINE long double nextafter(long double from, long double to) { @@ -117,6 +117,6 @@ LIBC_INLINE long double nextafter(long double from, long double to) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_X86_64_NEXTAFTERLONGDOUBLE_H diff --git a/libc/src/__support/FPUtil/x86_64/PolyEval.h b/libc/src/__support/FPUtil/x86_64/PolyEval.h index 81cf965..69fd776 100644 --- a/libc/src/__support/FPUtil/x86_64/PolyEval.h +++ b/libc/src/__support/FPUtil/x86_64/PolyEval.h @@ -18,7 +18,7 @@ #include <immintrin.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { // Cubic polynomials: @@ -80,6 +80,6 @@ LIBC_INLINE double polyeval(double x, double a0, double a1, double a2, } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_X86_64_POLYEVAL_H diff --git a/libc/src/__support/FPUtil/x86_64/nearest_integer.h b/libc/src/__support/FPUtil/x86_64/nearest_integer.h index a620354..ee31aee 100644 --- a/libc/src/__support/FPUtil/x86_64/nearest_integer.h +++ b/libc/src/__support/FPUtil/x86_64/nearest_integer.h @@ -22,7 +22,7 @@ #include <immintrin.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { LIBC_INLINE float nearest_integer(float x) { @@ -40,6 +40,6 @@ LIBC_INLINE double nearest_integer(double x) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_X86_64_NEAREST_INTEGER_H diff --git a/libc/src/__support/FPUtil/x86_64/sqrt.h b/libc/src/__support/FPUtil/x86_64/sqrt.h index 324f590..7edba55 100644 --- a/libc/src/__support/FPUtil/x86_64/sqrt.h +++ b/libc/src/__support/FPUtil/x86_64/sqrt.h @@ -18,7 +18,7 @@ #include "src/__support/FPUtil/generic/sqrt.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template <> LIBC_INLINE float sqrt<float>(float x) { @@ -47,6 +47,6 @@ template <> LIBC_INLINE long double sqrt<long double>(long double x) { #endif } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_X86_64_SQRT_H diff --git a/libc/src/__support/File/dir.cpp b/libc/src/__support/File/dir.cpp index 93b609d..9ff639a 100644 --- a/libc/src/__support/File/dir.cpp +++ b/libc/src/__support/File/dir.cpp @@ -12,17 +12,17 @@ #include "src/__support/error_or.h" #include "src/errno/libc_errno.h" // For error macros -namespace __llvm_libc { +namespace LIBC_NAMESPACE { ErrorOr<Dir *> Dir::open(const char *path) { auto fd = platform_opendir(path); if (!fd) - return __llvm_libc::Error(fd.error()); + return LIBC_NAMESPACE::Error(fd.error()); - __llvm_libc::AllocChecker ac; + LIBC_NAMESPACE::AllocChecker ac; Dir *dir = new (ac) Dir(fd.value()); if (!ac) - return __llvm_libc::Error(ENOMEM); + return LIBC_NAMESPACE::Error(ENOMEM); return dir; } @@ -31,7 +31,7 @@ ErrorOr<struct ::dirent *> Dir::read() { if (readptr >= fillsize) { auto readsize = platform_fetch_dirents(fd, buffer); if (!readsize) - return __llvm_libc::Error(readsize.error()); + return LIBC_NAMESPACE::Error(readsize.error()); fillsize = readsize.value(); readptr = 0; } @@ -60,4 +60,4 @@ int Dir::close() { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/__support/File/dir.h b/libc/src/__support/File/dir.h index baf57cb..a2f50f8 100644 --- a/libc/src/__support/File/dir.h +++ b/libc/src/__support/File/dir.h @@ -16,7 +16,7 @@ #include <dirent.h> #include <stdlib.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Platform specific function which will open the directory |name| // and return its file descriptor. Upon failure, the error value is returned. @@ -72,6 +72,6 @@ public: 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 f106d51..58097d0 100644 --- a/libc/src/__support/File/file.cpp +++ b/libc/src/__support/File/file.cpp @@ -15,7 +15,7 @@ #include <stdio.h> #include <stdlib.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { FileIOResult File::write_unlocked(const void *data, size_t len) { if (!write_allowed()) { @@ -433,4 +433,4 @@ File::ModeFlags File::mode_flags(const char *mode) { return flags; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/__support/File/file.h b/libc/src/__support/File/file.h index 9e65e2a..2ea3843 100644 --- a/libc/src/__support/File/file.h +++ b/libc/src/__support/File/file.h @@ -17,7 +17,7 @@ #include <stddef.h> #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { struct FileIOResult { size_t value; @@ -311,6 +311,6 @@ extern File *stdin; extern File *stdout; extern File *stderr; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FILE_FILE_H diff --git a/libc/src/__support/File/linux/dir.cpp b/libc/src/__support/File/linux/dir.cpp index b487103..cae545a 100644 --- a/libc/src/__support/File/linux/dir.cpp +++ b/libc/src/__support/File/linux/dir.cpp @@ -14,46 +14,46 @@ #include <fcntl.h> // For open flags #include <sys/syscall.h> // For syscall numbers -namespace __llvm_libc { +namespace LIBC_NAMESPACE { ErrorOr<int> platform_opendir(const char *name) { int open_flags = O_RDONLY | O_DIRECTORY | O_CLOEXEC; #ifdef SYS_open - int fd = __llvm_libc::syscall_impl<int>(SYS_open, name, open_flags); + int fd = LIBC_NAMESPACE::syscall_impl<int>(SYS_open, name, open_flags); #elif defined(SYS_openat) int fd = - __llvm_libc::syscall_impl<int>(SYS_openat, AT_FDCWD, name, open_flags); + LIBC_NAMESPACE::syscall_impl<int>(SYS_openat, AT_FDCWD, name, open_flags); #else #error \ "SYS_open and SYS_openat syscalls not available to perform an open operation." #endif if (fd < 0) { - return __llvm_libc::Error(-fd); + return LIBC_NAMESPACE::Error(-fd); } return fd; } ErrorOr<size_t> platform_fetch_dirents(int fd, cpp::span<uint8_t> buffer) { #ifdef SYS_getdents64 - long size = __llvm_libc::syscall_impl<long>(SYS_getdents64, fd, buffer.data(), - buffer.size()); + long size = LIBC_NAMESPACE::syscall_impl<long>(SYS_getdents64, fd, + buffer.data(), buffer.size()); #else #error "getdents64 syscalls not available to perform a fetch dirents operation." #endif if (size < 0) { - return __llvm_libc::Error(static_cast<int>(-size)); + return LIBC_NAMESPACE::Error(static_cast<int>(-size)); } return size; } int platform_closedir(int fd) { - int ret = __llvm_libc::syscall_impl<int>(SYS_close, fd); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_close, fd); if (ret < 0) { return static_cast<int>(-ret); } return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/__support/File/linux/file.cpp b/libc/src/__support/File/linux/file.cpp index 2d4481b..2d4cea5 100644 --- a/libc/src/__support/File/linux/file.cpp +++ b/libc/src/__support/File/linux/file.cpp @@ -19,11 +19,12 @@ #include <stdio.h> #include <sys/syscall.h> // For syscall numbers -namespace __llvm_libc { +namespace LIBC_NAMESPACE { FileIOResult linux_file_write(File *f, const void *data, size_t size) { auto *lf = reinterpret_cast<LinuxFile *>(f); - int ret = __llvm_libc::syscall_impl<int>(SYS_write, lf->get_fd(), data, size); + int ret = + LIBC_NAMESPACE::syscall_impl<int>(SYS_write, lf->get_fd(), data, size); if (ret < 0) { return {0, -ret}; } @@ -32,7 +33,8 @@ FileIOResult linux_file_write(File *f, const void *data, size_t size) { FileIOResult linux_file_read(File *f, void *buf, size_t size) { auto *lf = reinterpret_cast<LinuxFile *>(f); - int ret = __llvm_libc::syscall_impl<int>(SYS_read, lf->get_fd(), buf, size); + int ret = + LIBC_NAMESPACE::syscall_impl<int>(SYS_read, lf->get_fd(), buf, size); if (ret < 0) { return {0, -ret}; } @@ -49,7 +51,7 @@ ErrorOr<long> linux_file_seek(File *f, long offset, int whence) { int linux_file_close(File *f) { auto *lf = reinterpret_cast<LinuxFile *>(f); - int ret = __llvm_libc::syscall_impl<int>(SYS_close, lf->get_fd()); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_close, lf->get_fd()); if (ret < 0) { return -ret; } @@ -90,10 +92,10 @@ ErrorOr<File *> openfile(const char *path, const char *mode) { #ifdef SYS_open int fd = - __llvm_libc::syscall_impl<int>(SYS_open, path, open_flags, OPEN_MODE); + LIBC_NAMESPACE::syscall_impl<int>(SYS_open, path, open_flags, OPEN_MODE); #elif defined(SYS_openat) - int fd = __llvm_libc::syscall_impl<int>(SYS_openat, AT_FDCWD, path, - open_flags, OPEN_MODE); + int fd = LIBC_NAMESPACE::syscall_impl<int>(SYS_openat, AT_FDCWD, path, + open_flags, OPEN_MODE); #else #error "open and openat syscalls not available." #endif @@ -121,4 +123,4 @@ int get_fileno(File *f) { return lf->get_fd(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/__support/File/linux/file.h b/libc/src/__support/File/linux/file.h index 85a941b..24e71b1 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 @@ public: 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 859faf4..d1632b7 100644 --- a/libc/src/__support/File/linux/lseekImpl.h +++ b/libc/src/__support/File/linux/lseekImpl.h @@ -18,13 +18,13 @@ #include <sys/syscall.h> // For syscall numbers. #include <unistd.h> // For off_t. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { LIBC_INLINE ErrorOr<off_t> lseekimpl(int fd, off_t offset, int whence) { off_t result; #ifdef SYS_lseek - int ret = __llvm_libc::syscall_impl<int>(SYS_lseek, fd, offset, whence); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_lseek, fd, offset, whence); result = ret; #elif defined(SYS_llseek) || defined(SYS__llseek) static_assert(sizeof(size_t) == 4, "size_t must be 32 bits."); @@ -34,7 +34,7 @@ LIBC_INLINE ErrorOr<off_t> lseekimpl(int fd, off_t offset, int whence) { constexpr long LLSEEK_SYSCALL_NO = SYS__llseek; #endif off_t offset_64 = offset; - int ret = __llvm_libc::syscall_impl<int>( + int ret = LIBC_NAMESPACE::syscall_impl<int>( LLSEEK_SYSCALL_NO, fd, offset_64 >> 32, offset_64, &result, whence); #else #error "lseek, llseek and _llseek syscalls not available." @@ -45,6 +45,6 @@ LIBC_INLINE ErrorOr<off_t> lseekimpl(int fd, off_t offset, int whence) { } } // namespace internal -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FILE_LINUX_LSEEKIMPL_H diff --git a/libc/src/__support/File/linux/stderr.cpp b/libc/src/__support/File/linux/stderr.cpp index a2ab37a..65d7865 100644 --- a/libc/src/__support/File/linux/stderr.cpp +++ b/libc/src/__support/File/linux/stderr.cpp @@ -9,15 +9,15 @@ #include "file.h" #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { constexpr size_t STDERR_BUFFER_SIZE = 0; static LinuxFile StdErr(2, nullptr, STDERR_BUFFER_SIZE, _IONBF, false, File::ModeFlags(File::OpenMode::APPEND)); File *stderr = &StdErr; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE extern "C" { -FILE *stderr = reinterpret_cast<FILE *>(&__llvm_libc::StdErr); +FILE *stderr = reinterpret_cast<FILE *>(&LIBC_NAMESPACE::StdErr); } diff --git a/libc/src/__support/File/linux/stdin.cpp b/libc/src/__support/File/linux/stdin.cpp index e40081c..c9a363b 100644 --- a/libc/src/__support/File/linux/stdin.cpp +++ b/libc/src/__support/File/linux/stdin.cpp @@ -9,7 +9,7 @@ #include "file.h" #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { constexpr size_t STDIN_BUFFER_SIZE = 512; uint8_t stdin_buffer[STDIN_BUFFER_SIZE]; @@ -17,8 +17,8 @@ static LinuxFile StdIn(0, stdin_buffer, STDIN_BUFFER_SIZE, _IOFBF, false, File::ModeFlags(File::OpenMode::READ)); File *stdin = &StdIn; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE extern "C" { -FILE *stdin = reinterpret_cast<FILE *>(&__llvm_libc::StdIn); +FILE *stdin = reinterpret_cast<FILE *>(&LIBC_NAMESPACE::StdIn); } // extern "C" diff --git a/libc/src/__support/File/linux/stdout.cpp b/libc/src/__support/File/linux/stdout.cpp index cfb6aa4..314692e 100644 --- a/libc/src/__support/File/linux/stdout.cpp +++ b/libc/src/__support/File/linux/stdout.cpp @@ -9,7 +9,7 @@ #include "file.h" #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { constexpr size_t STDOUT_BUFFER_SIZE = 1024; uint8_t stdout_buffer[STDOUT_BUFFER_SIZE]; @@ -17,8 +17,8 @@ static LinuxFile StdOut(1, stdout_buffer, STDOUT_BUFFER_SIZE, _IOLBF, false, File::ModeFlags(File::OpenMode::APPEND)); File *stdout = &StdOut; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE extern "C" { -FILE *stdout = reinterpret_cast<FILE *>(&__llvm_libc::StdOut); +FILE *stdout = reinterpret_cast<FILE *>(&LIBC_NAMESPACE::StdOut); } // extern "C" diff --git a/libc/src/__support/GPU/amdgpu/utils.h b/libc/src/__support/GPU/amdgpu/utils.h index f64ed79..9f0ff0c 100644 --- a/libc/src/__support/GPU/amdgpu/utils.h +++ b/libc/src/__support/GPU/amdgpu/utils.h @@ -14,7 +14,7 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace gpu { /// The number of threads that execute in lock-step in a lane. @@ -180,6 +180,6 @@ LIBC_INLINE uint64_t fixed_frequency_clock() { [[noreturn]] LIBC_INLINE void end_program() { __builtin_amdgcn_endpgm(); } } // namespace gpu -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif diff --git a/libc/src/__support/GPU/generic/utils.h b/libc/src/__support/GPU/generic/utils.h index af34758..b701db4 100644 --- a/libc/src/__support/GPU/generic/utils.h +++ b/libc/src/__support/GPU/generic/utils.h @@ -13,7 +13,7 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace gpu { constexpr const uint64_t LANE_SIZE = 1; @@ -76,6 +76,6 @@ LIBC_INLINE uint64_t fixed_frequency_clock() { return 0; } [[noreturn]] LIBC_INLINE void end_program() { __builtin_unreachable(); } } // namespace gpu -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif diff --git a/libc/src/__support/GPU/nvptx/utils.h b/libc/src/__support/GPU/nvptx/utils.h index 375af6e..1519f36 100644 --- a/libc/src/__support/GPU/nvptx/utils.h +++ b/libc/src/__support/GPU/nvptx/utils.h @@ -13,7 +13,7 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace gpu { /// The number of threads that execute in lock-step in a warp. @@ -160,6 +160,6 @@ LIBC_INLINE uint64_t fixed_frequency_clock() { } } // namespace gpu -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif diff --git a/libc/src/__support/GPU/utils.h b/libc/src/__support/GPU/utils.h index d598996..6505b18 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 807ede0..ce10c2a 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 d29c539..9bbc8e1 100644 --- a/libc/src/__support/OSUtil/darwin/io.h +++ b/libc/src/__support/OSUtil/darwin/io.h @@ -12,13 +12,13 @@ #include "src/__support/CPP/string_view.h" #include "syscall.h" // For internal syscall function. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE void write_to_stderr(cpp::string_view msg) { - __llvm_libc::syscall_impl(4 /*SYS_write*/, 2 /* stderr */, - reinterpret_cast<long>(msg.data()), msg.size()); + LIBC_NAMESPACE::syscall_impl(4 /*SYS_write*/, 2 /* stderr */, + reinterpret_cast<long>(msg.data()), msg.size()); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_DARWIN_IO_H diff --git a/libc/src/__support/OSUtil/darwin/quick_exit.h b/libc/src/__support/OSUtil/darwin/quick_exit.h index 51b82d9..71647f5 100644 --- a/libc/src/__support/OSUtil/darwin/quick_exit.h +++ b/libc/src/__support/OSUtil/darwin/quick_exit.h @@ -13,14 +13,14 @@ #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE void quick_exit(int status) { for (;;) { - __llvm_libc::syscall_impl<long>(1 /* SYS_exit */, status); + LIBC_NAMESPACE::syscall_impl<long>(1 /* SYS_exit */, status); } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_DARWIN_QUICK_EXIT_H diff --git a/libc/src/__support/OSUtil/darwin/syscall.h b/libc/src/__support/OSUtil/darwin/syscall.h index b051745..93b492e 100644 --- a/libc/src/__support/OSUtil/darwin/syscall.h +++ b/libc/src/__support/OSUtil/darwin/syscall.h @@ -19,7 +19,7 @@ #error "Unsupported architecture" #endif -namespace __llvm_libc { +namespace LIBC_NAMESPACE { template <typename R, typename... Ts> LIBC_INLINE R syscall_impl(long __number, Ts... ts) { @@ -27,6 +27,6 @@ LIBC_INLINE R syscall_impl(long __number, Ts... ts) { return cpp::bit_or_static_cast<R>(syscall_impl(__number, (long)ts...)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_DARWIN_SYSCALL_H diff --git a/libc/src/__support/OSUtil/fuchsia/io.h b/libc/src/__support/OSUtil/fuchsia/io.h index fc794b8..9a5e00b 100644 --- a/libc/src/__support/OSUtil/fuchsia/io.h +++ b/libc/src/__support/OSUtil/fuchsia/io.h @@ -17,12 +17,12 @@ #include <zircon/sanitizer.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE void write_to_stderr(cpp::string_view msg) { __sanitizer_log_write(msg.data(), msg.size()); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_FUCHSIA_IO_H diff --git a/libc/src/__support/OSUtil/gpu/io.cpp b/libc/src/__support/OSUtil/gpu/io.cpp index 09b5452..fec4d9f 100644 --- a/libc/src/__support/OSUtil/gpu/io.cpp +++ b/libc/src/__support/OSUtil/gpu/io.cpp @@ -11,7 +11,7 @@ #include "src/__support/CPP/string_view.h" #include "src/__support/RPC/rpc_client.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void write_to_stderr(cpp::string_view msg) { rpc::Client::Port port = rpc::client.open<RPC_WRITE_TO_STDERR>(); @@ -20,4 +20,4 @@ void write_to_stderr(cpp::string_view msg) { port.close(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/__support/OSUtil/gpu/io.h b/libc/src/__support/OSUtil/gpu/io.h index be5daae..d6c89cf 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 a316e27..1a03be0 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 c4d67e5..b51385d 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 1d0ed9a..f6c9a74 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 351a1c0..af10074 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 b20be45..fd5d2e1 100644 --- a/libc/src/__support/OSUtil/linux/io.h +++ b/libc/src/__support/OSUtil/linux/io.h @@ -14,13 +14,13 @@ #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE void write_to_stderr(cpp::string_view msg) { - __llvm_libc::syscall_impl<long>(SYS_write, 2 /* stderr */, msg.data(), - msg.size()); + LIBC_NAMESPACE::syscall_impl<long>(SYS_write, 2 /* stderr */, msg.data(), + msg.size()); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_IO_H diff --git a/libc/src/__support/OSUtil/linux/quick_exit.h b/libc/src/__support/OSUtil/linux/quick_exit.h index 2e2d86d..c461d5f 100644 --- a/libc/src/__support/OSUtil/linux/quick_exit.h +++ b/libc/src/__support/OSUtil/linux/quick_exit.h @@ -15,15 +15,15 @@ #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE void quick_exit(int status) { for (;;) { - __llvm_libc::syscall_impl<long>(SYS_exit_group, status); - __llvm_libc::syscall_impl<long>(SYS_exit, status); + LIBC_NAMESPACE::syscall_impl<long>(SYS_exit_group, status); + LIBC_NAMESPACE::syscall_impl<long>(SYS_exit, status); } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_QUICK_EXIT_H diff --git a/libc/src/__support/OSUtil/linux/riscv64/syscall.h b/libc/src/__support/OSUtil/linux/riscv64/syscall.h index e307bcb..53ee21d 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 8a1fbb3..6c9559bb 100644 --- a/libc/src/__support/OSUtil/linux/syscall.h +++ b/libc/src/__support/OSUtil/linux/syscall.h @@ -23,7 +23,7 @@ #include "riscv64/syscall.h" #endif -namespace __llvm_libc { +namespace LIBC_NAMESPACE { template <typename R, typename... Ts> LIBC_INLINE R syscall_impl(long __number, Ts... ts) { @@ -31,6 +31,6 @@ LIBC_INLINE R syscall_impl(long __number, Ts... ts) { return cpp::bit_or_static_cast<R>(syscall_impl(__number, (long)ts...)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_SYSCALL_H diff --git a/libc/src/__support/OSUtil/linux/x86_64/syscall.h b/libc/src/__support/OSUtil/linux/x86_64/syscall.h index bf2d2cd..986db93 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 6ebc0c3..189da86 100644 --- a/libc/src/__support/RPC/rpc.h +++ b/libc/src/__support/RPC/rpc.h @@ -28,7 +28,7 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace rpc { /// A fixed size channel used to communicate between the RPC client and server. @@ -586,6 +586,6 @@ LIBC_INLINE typename Server<lane_size>::Port Server<lane_size>::open() { } } // namespace rpc -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif diff --git a/libc/src/__support/RPC/rpc_client.cpp b/libc/src/__support/RPC/rpc_client.cpp index b25ff56..e223caf 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 3b36c4f..571d7cc 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 999fd90..46ca841 100644 --- a/libc/src/__support/RPC/rpc_util.h +++ b/libc/src/__support/RPC/rpc_util.h @@ -14,7 +14,7 @@ #include "src/__support/macros/attributes.h" // LIBC_INLINE #include "src/__support/macros/properties/architectures.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace rpc { /// Suspend the thread briefly to assist the thread scheduler during busy loops. @@ -65,6 +65,6 @@ template <typename T, typename U> LIBC_INLINE T *advance(T *ptr, U bytes) { } } // namespace rpc -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif diff --git a/libc/src/__support/StringUtil/error_to_string.cpp b/libc/src/__support/StringUtil/error_to_string.cpp index 692f884..3ea60a6 100644 --- a/libc/src/__support/StringUtil/error_to_string.cpp +++ b/libc/src/__support/StringUtil/error_to_string.cpp @@ -18,7 +18,7 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { constexpr size_t max_buff_size() { @@ -74,4 +74,4 @@ cpp::string_view get_error_string(int err_num, cpp::span<char> buffer) { return internal::build_error_string(err_num, buffer); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/__support/StringUtil/error_to_string.h b/libc/src/__support/StringUtil/error_to_string.h index 7981aa9..43cf785 100644 --- a/libc/src/__support/StringUtil/error_to_string.h +++ b/libc/src/__support/StringUtil/error_to_string.h @@ -12,12 +12,12 @@ #include "src/__support/CPP/span.h" #include "src/__support/CPP/string_view.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { cpp::string_view get_error_string(int err_num); cpp::string_view get_error_string(int err_num, cpp::span<char> buffer); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_STRINGUTIL_ERROR_TO_STRING_H diff --git a/libc/src/__support/StringUtil/message_mapper.h b/libc/src/__support/StringUtil/message_mapper.h index a190037..c93a57c 100644 --- a/libc/src/__support/StringUtil/message_mapper.h +++ b/libc/src/__support/StringUtil/message_mapper.h @@ -14,7 +14,7 @@ #include "src/__support/CPP/string_view.h" #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { struct MsgMapping { int num; @@ -98,6 +98,6 @@ constexpr MsgTable<N1 + N2> operator+(const MsgTable<N1> &t1, return res; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_STRING_UTIL_MESSAGE_MAPPER_H diff --git a/libc/src/__support/StringUtil/signal_to_string.cpp b/libc/src/__support/StringUtil/signal_to_string.cpp index 78b4d4d..1fea53a 100644 --- a/libc/src/__support/StringUtil/signal_to_string.cpp +++ b/libc/src/__support/StringUtil/signal_to_string.cpp @@ -19,7 +19,7 @@ #include <signal.h> #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { constexpr size_t max_buff_size() { @@ -77,4 +77,4 @@ cpp::string_view get_signal_string(int sig_num, cpp::span<char> buffer) { return internal::build_signal_string(sig_num, buffer); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/__support/StringUtil/signal_to_string.h b/libc/src/__support/StringUtil/signal_to_string.h index 11ec33a..e27324e 100644 --- a/libc/src/__support/StringUtil/signal_to_string.h +++ b/libc/src/__support/StringUtil/signal_to_string.h @@ -13,12 +13,12 @@ #include "src/__support/CPP/span.h" #include "src/__support/CPP/string_view.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { cpp::string_view get_signal_string(int err_num); cpp::string_view get_signal_string(int err_num, cpp::span<char> buffer); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_STRINGUTIL_SIGNAL_TO_STRING_H diff --git a/libc/src/__support/StringUtil/tables/linux_extension_errors.h b/libc/src/__support/StringUtil/tables/linux_extension_errors.h index 5440c8e..4964fa4 100644 --- a/libc/src/__support/StringUtil/tables/linux_extension_errors.h +++ b/libc/src/__support/StringUtil/tables/linux_extension_errors.h @@ -13,7 +13,7 @@ #include <errno.h> // For error macros -namespace __llvm_libc { +namespace LIBC_NAMESPACE { constexpr MsgTable<52> LINUX_ERRORS = { MsgMapping(ENOTBLK, "Block device required"), @@ -70,6 +70,6 @@ constexpr MsgTable<52> LINUX_ERRORS = { MsgMapping(EHWPOISON, "Memory page has hardware error"), }; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_STRING_UTIL_TABLES_LINUX_EXTENSION_ERRORS_H diff --git a/libc/src/__support/StringUtil/tables/linux_extension_signals.h b/libc/src/__support/StringUtil/tables/linux_extension_signals.h index fd17881..633d0e2 100644 --- a/libc/src/__support/StringUtil/tables/linux_extension_signals.h +++ b/libc/src/__support/StringUtil/tables/linux_extension_signals.h @@ -13,7 +13,7 @@ #include <signal.h> // For signal numbers -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // The array being larger than necessary isn't a problem. The MsgMappings will // be set to their default state which maps 0 to an empty string. This will get @@ -28,6 +28,6 @@ LIBC_INLINE_VAR constexpr const MsgTable<3> LINUX_SIGNALS = { #endif }; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_STRING_UTIL_TABLES_LINUX_EXTENSION_SIGNALS_H diff --git a/libc/src/__support/StringUtil/tables/linux_platform_errors.h b/libc/src/__support/StringUtil/tables/linux_platform_errors.h index 3139a1f..a9ae2e8 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 b085174..1daaa9c 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 fa164db..1cfd9e2 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 a6d59e5..7fcf91b 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 59ed279..3ade7aa 100644 --- a/libc/src/__support/StringUtil/tables/posix_errors.h +++ b/libc/src/__support/StringUtil/tables/posix_errors.h @@ -13,7 +13,7 @@ #include <errno.h> // For error macros -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE_VAR constexpr MsgTable<76> POSIX_ERRORS = { MsgMapping(EPERM, "Operation not permitted"), @@ -94,6 +94,6 @@ LIBC_INLINE_VAR constexpr MsgTable<76> POSIX_ERRORS = { MsgMapping(ENOTRECOVERABLE, "State not recoverable"), }; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_STRING_UTIL_TABLES_POSIX_ERRORS_H diff --git a/libc/src/__support/StringUtil/tables/posix_signals.h b/libc/src/__support/StringUtil/tables/posix_signals.h index beaa18b..2fba2d9 100644 --- a/libc/src/__support/StringUtil/tables/posix_signals.h +++ b/libc/src/__support/StringUtil/tables/posix_signals.h @@ -14,7 +14,7 @@ #include <signal.h> // For signal numbers -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE_VAR constexpr MsgTable<22> POSIX_SIGNALS = { MsgMapping(SIGHUP, "Hangup"), @@ -41,6 +41,6 @@ LIBC_INLINE_VAR constexpr MsgTable<22> POSIX_SIGNALS = { MsgMapping(SIGSYS, "Bad system call"), }; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_STRING_UTIL_TABLES_POSIX_SIGNALS_H diff --git a/libc/src/__support/StringUtil/tables/signal_table.h b/libc/src/__support/StringUtil/tables/signal_table.h index 87b5abf..5035c54 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 054c4ff..f0fc787 100644 --- a/libc/src/__support/StringUtil/tables/stdc_errors.h +++ b/libc/src/__support/StringUtil/tables/stdc_errors.h @@ -13,7 +13,7 @@ #include <errno.h> // For error macros -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE_VAR constexpr const MsgTable<4> STDC_ERRORS = { MsgMapping(0, "Success"), @@ -22,6 +22,6 @@ LIBC_INLINE_VAR constexpr const MsgTable<4> STDC_ERRORS = { MsgMapping(EILSEQ, "Invalid or incomplete multibyte or wide character"), }; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_STRING_UTIL_TABLES_LINUX_ERRORS_H diff --git a/libc/src/__support/StringUtil/tables/stdc_signals.h b/libc/src/__support/StringUtil/tables/stdc_signals.h index 0bc288d..773f182 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 6310c89..9aeb239 100644 --- a/libc/src/__support/UInt.h +++ b/libc/src/__support/UInt.h @@ -21,7 +21,7 @@ #include <stddef.h> // For size_t #include <stdint.h> -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { template <size_t Bits, bool Signed> struct BigInt { @@ -927,6 +927,6 @@ struct make_signed<UInt<Bits>> : type_identity<Int<Bits>> { "Number of bits in Int should be a multiple of 64."); }; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_UINT_H diff --git a/libc/src/__support/UInt128.h b/libc/src/__support/UInt128.h index 2df4e52..2f688f1 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 e415415..9de1765 100644 --- a/libc/src/__support/arg_list.h +++ b/libc/src/__support/arg_list.h @@ -14,7 +14,7 @@ #include <stdarg.h> #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { class ArgList { @@ -61,6 +61,6 @@ public: }; } // 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 cdef80b..d78e4be 100644 --- a/libc/src/__support/blockstore.h +++ b/libc/src/__support/blockstore.h @@ -15,7 +15,7 @@ #include <stddef.h> #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace cpp { // The difference between BlockStore a traditional vector types is that, @@ -204,6 +204,6 @@ template <typename T, size_t BLOCK_SIZE> using ReverseOrderBlockStore = BlockStore<T, BLOCK_SIZE, true>; } // namespace cpp -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_BLOCKSTORE_H diff --git a/libc/src/__support/builtin_wrappers.h b/libc/src/__support/builtin_wrappers.h index 1da9cee..bd307a3 100644 --- a/libc/src/__support/builtin_wrappers.h +++ b/libc/src/__support/builtin_wrappers.h @@ -15,7 +15,7 @@ #include "src/__support/macros/attributes.h" // LIBC_INLINE #include "src/__support/macros/config.h" // LIBC_HAS_BUILTIN -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // The following overloads are matched based on what is accepted by // __builtin_clz/ctz* rather than using the exactly-sized aliases from stdint.h. @@ -221,6 +221,6 @@ sub_with_borrow<unsigned long long>(unsigned long long a, unsigned long long b, #endif // LIBC_HAS_BUILTIN(__builtin_subc) -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_BUILTIN_WRAPPERS_H diff --git a/libc/src/__support/c_string.h b/libc/src/__support/c_string.h index 580a685..9049311 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 @@ public: 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 49609fd..ed55c48 100644 --- a/libc/src/__support/char_vector.h +++ b/libc/src/__support/char_vector.h @@ -14,7 +14,7 @@ #include <stddef.h> #include <stdlib.h> // For allocation. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // This is very simple alternate of the std::string class. There is no // bounds check performed in any of the methods. The callers are expected to @@ -73,6 +73,6 @@ public: 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 2b253fd..fe7b7c8 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 61a5fe6..5fa4777 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 5335f0d..f962848 100644 --- a/libc/src/__support/detailed_powers_of_ten.h +++ b/libc/src/__support/detailed_powers_of_ten.h @@ -13,7 +13,7 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { // TODO(michaelrj): write a script that will generate this table. @@ -733,6 +733,6 @@ static constexpr uint64_t DETAILED_POWERS_OF_TEN[696][2] = { }; } // namespace internal -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_DETAILED_POWERS_OF_TEN_H diff --git a/libc/src/__support/endian.h b/libc/src/__support/endian.h index 43ddbb6..cd083aa 100644 --- a/libc/src/__support/endian.h +++ b/libc/src/__support/endian.h @@ -13,7 +13,7 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // We rely on compiler preprocessor defines to allow for cross compilation. #if !defined(__BYTE_ORDER__) || !defined(__ORDER_LITTLE_ENDIAN__) || \ @@ -140,6 +140,6 @@ Endian<__ORDER_BIG_ENDIAN__>::to_little_endian<uint64_t>(uint64_t v) { using Endian = internal::Endian<__BYTE_ORDER__>; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_ENDIAN_H diff --git a/libc/src/__support/error_or.h b/libc/src/__support/error_or.h index 33bb942..34c652dd 100644 --- a/libc/src/__support/error_or.h +++ b/libc/src/__support/error_or.h @@ -11,7 +11,7 @@ #include "src/__support/CPP/expected.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { template <class T> using ErrorOr = cpp::expected<T, int>; @@ -34,6 +34,6 @@ using Error = cpp::unexpected<int>; // constexpr operator T() { return value; } // }; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_ERROR_OR_H diff --git a/libc/src/__support/fixedvector.h b/libc/src/__support/fixedvector.h index 5dfda1e..fff905d 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 @@ public: static void destroy(FixedVector<T, CAPACITY> *store) { store->reset(); } }; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FIXEDVECTOR_H diff --git a/libc/src/__support/float_to_string.h b/libc/src/__support/float_to_string.h index d430594..05189e9 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<long double>::get_negative_block(int block_index) { #endif // LONG_DOUBLE_IS_DOUBLE -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FLOAT_TO_STRING_H diff --git a/libc/src/__support/high_precision_decimal.h b/libc/src/__support/high_precision_decimal.h index 9ee7c1f..bf33658 100644 --- a/libc/src/__support/high_precision_decimal.h +++ b/libc/src/__support/high_precision_decimal.h @@ -13,7 +13,7 @@ #include "src/__support/str_to_integer.h" #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { struct LShiftTableEntry { @@ -411,6 +411,6 @@ public: }; } // 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 396ebc7..6253afe 100644 --- a/libc/src/__support/integer_operations.h +++ b/libc/src/__support/integer_operations.h @@ -11,7 +11,7 @@ #include "src/__support/CPP/type_traits.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { template <typename T> static constexpr cpp::enable_if_t<cpp::is_integral_v<T>, T> integer_abs(T n) { @@ -25,6 +25,6 @@ integer_rem_quo(T x, T y, T ", T &rem) { rem = x % y; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_INTEGER_OPERATIONS_H diff --git a/libc/src/__support/integer_to_string.h b/libc/src/__support/integer_to_string.h index 2c11d83..29f7124 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 @@ public: } }; -} // 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 9a734da..7b62cb0 100644 --- a/libc/src/__support/integer_utils.h +++ b/libc/src/__support/integer_utils.h @@ -17,7 +17,7 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { template <typename T> NumberPair<T> full_mul(T a, T b); @@ -60,6 +60,6 @@ LIBC_INLINE NumberPair<uint64_t> full_mul<uint64_t>(uint64_t a, uint64_t b) { #endif // __SIZEOF_INT128__ } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_INTEGER_UTILS_H diff --git a/libc/src/__support/libc_assert.h b/libc/src/__support/libc_assert.h index 4190cfe..61f0754 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 1d221ff..ae97efc 100644 --- a/libc/src/__support/macros/optimization.h +++ b/libc/src/__support/macros/optimization.h @@ -16,14 +16,15 @@ // We use a template to implement likely/unlikely to make sure that we don't // accidentally pass an integer. -namespace __llvm_libc::details { +namespace LIBC_NAMESPACE::details { template <typename T> LIBC_INLINE constexpr bool expects_bool_condition(T value, T expected) { return __builtin_expect(value, expected); } -} // namespace __llvm_libc::details -#define LIBC_LIKELY(x) __llvm_libc::details::expects_bool_condition(x, true) -#define LIBC_UNLIKELY(x) __llvm_libc::details::expects_bool_condition(x, false) +} // namespace LIBC_NAMESPACE::details +#define LIBC_LIKELY(x) LIBC_NAMESPACE::details::expects_bool_condition(x, true) +#define LIBC_UNLIKELY(x) \ + LIBC_NAMESPACE::details::expects_bool_condition(x, false) #if defined(LIBC_COMPILER_IS_CLANG) #define LIBC_LOOP_NOUNROLL _Pragma("nounroll") diff --git a/libc/src/__support/number_pair.h b/libc/src/__support/number_pair.h index 3f23394..5e553d8 100644 --- a/libc/src/__support/number_pair.h +++ b/libc/src/__support/number_pair.h @@ -14,7 +14,7 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { DEFINE_NAMED_PAIR_TEMPLATE(NumberPair, lo, hi); @@ -29,6 +29,6 @@ split(T a) { return result; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_NUMBER_PAIR_H diff --git a/libc/src/__support/str_to_float.h b/libc/src/__support/str_to_float.h index 58bdee2..db50090 100644 --- a/libc/src/__support/str_to_float.h +++ b/libc/src/__support/str_to_float.h @@ -25,7 +25,7 @@ #include "src/__support/str_to_num_result.h" #include "src/errno/libc_errno.h" // For ERANGE -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { template <class T> struct ExpandedFloat { @@ -1247,6 +1247,6 @@ LIBC_INLINE StrToNumResult<T> strtofloatingpoint(const char *__restrict src) { } } // namespace internal -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_STR_TO_FLOAT_H diff --git a/libc/src/__support/str_to_integer.h b/libc/src/__support/str_to_integer.h index f960892..4ee336e 100644 --- a/libc/src/__support/str_to_integer.h +++ b/libc/src/__support/str_to_integer.h @@ -17,7 +17,7 @@ #include "src/errno/libc_errno.h" // For ERANGE #include <limits.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { // Returns a pointer to the first character in src that is not a whitespace @@ -150,6 +150,6 @@ LIBC_INLINE StrToNumResult<T> strtointeger(const char *__restrict src, } } // namespace internal -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_STR_TO_INTEGER_H diff --git a/libc/src/__support/str_to_num_result.h b/libc/src/__support/str_to_num_result.h index ea96f95..9ba704c 100644 --- a/libc/src/__support/str_to_num_result.h +++ b/libc/src/__support/str_to_num_result.h @@ -11,7 +11,7 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { template <typename T> struct StrToNumResult { T value; @@ -28,6 +28,6 @@ template <typename T> struct StrToNumResult { constexpr operator T() { return value; } }; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_STR_TO_NUM_RESULT_H diff --git a/libc/src/__support/threads/callonce.h b/libc/src/__support/threads/callonce.h index 12e5c82..b3d6813 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 7ac4c48..54fda67 100644 --- a/libc/src/__support/threads/fork_callbacks.cpp +++ b/libc/src/__support/threads/fork_callbacks.cpp @@ -12,7 +12,7 @@ #include <stddef.h> // For size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace { @@ -87,4 +87,4 @@ void invoke_prepare_callbacks() { cb_manager.invoke_prepare(); } void invoke_parent_callbacks() { cb_manager.invoke_parent(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/__support/threads/fork_callbacks.h b/libc/src/__support/threads/fork_callbacks.h index 5e77c35..57a4f82 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 5a5dc73..7a23604 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 1e43037..de1e100 100644 --- a/libc/src/__support/threads/linux/callonce.cpp +++ b/libc/src/__support/threads/linux/callonce.cpp @@ -16,7 +16,7 @@ #include <linux/futex.h> #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { static constexpr FutexWordType NOT_CALLED = 0x0; static constexpr FutexWordType START = 0x11; @@ -34,10 +34,10 @@ int callonce(CallOnceFlag *flag, CallOnceCallback *func) { func(); auto status = futex_word->exchange(FINISH); if (status == WAITING) { - __llvm_libc::syscall_impl<long>(FUTEX_SYSCALL_ID, &futex_word->val, - FUTEX_WAKE_PRIVATE, - INT_MAX, // Wake all waiters. - 0, 0, 0); + LIBC_NAMESPACE::syscall_impl<long>(FUTEX_SYSCALL_ID, &futex_word->val, + FUTEX_WAKE_PRIVATE, + INT_MAX, // Wake all waiters. + 0, 0, 0); } return 0; } @@ -45,7 +45,7 @@ int callonce(CallOnceFlag *flag, CallOnceCallback *func) { FutexWordType status = START; if (futex_word->compare_exchange_strong(status, WAITING) || status == WAITING) { - __llvm_libc::syscall_impl<long>( + LIBC_NAMESPACE::syscall_impl<long>( FUTEX_SYSCALL_ID, &futex_word->val, FUTEX_WAIT_PRIVATE, WAITING, // Block only if status is still |WAITING|. 0, 0, 0); @@ -54,4 +54,4 @@ int callonce(CallOnceFlag *flag, CallOnceCallback *func) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/__support/threads/linux/futex_word.h b/libc/src/__support/threads/linux/futex_word.h index 4585aac..67159b8 100644 --- a/libc/src/__support/threads/linux/futex_word.h +++ b/libc/src/__support/threads/linux/futex_word.h @@ -12,7 +12,7 @@ #include <stdint.h> #include <sys/syscall.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Futexes are 32 bits in size on all platforms, including 64-bit platforms. using FutexWordType = uint32_t; @@ -25,6 +25,6 @@ constexpr auto FUTEX_SYSCALL_ID = SYS_futex_time64; #error "futex and futex_time64 syscalls not available." #endif -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_THREADS_LINUX_FUTEX_WORD_H diff --git a/libc/src/__support/threads/linux/mutex.h b/libc/src/__support/threads/linux/mutex.h index 9b22fba..618698d 100644 --- a/libc/src/__support/threads/linux/mutex.h +++ b/libc/src/__support/threads/linux/mutex.h @@ -18,7 +18,7 @@ #include <stdint.h> #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { struct Mutex { unsigned char timed; @@ -76,7 +76,7 @@ public: // futex syscall will block if the futex data is still // `LockState::Waiting` (the 4th argument to the syscall function // below.) - __llvm_libc::syscall_impl<long>( + LIBC_NAMESPACE::syscall_impl<long>( FUTEX_SYSCALL_ID, &futex_word.val, FUTEX_WAIT_PRIVATE, FutexWordType(LockState::Waiting), 0, 0, 0); was_waiting = true; @@ -91,7 +91,7 @@ public: // we will wait for the futex to be woken up. Note again that the // following syscall will block only if the futex data is still // `LockState::Waiting`. - __llvm_libc::syscall_impl<long>( + LIBC_NAMESPACE::syscall_impl<long>( FUTEX_SYSCALL_ID, &futex_word, FUTEX_WAIT_PRIVATE, FutexWordType(LockState::Waiting), 0, 0, 0); was_waiting = true; @@ -110,8 +110,8 @@ public: if (futex_word.compare_exchange_strong(mutex_status, FutexWordType(LockState::Free))) { // If any thread is waiting to be woken up, then do it. - __llvm_libc::syscall_impl<long>(FUTEX_SYSCALL_ID, &futex_word, - FUTEX_WAKE_PRIVATE, 1, 0, 0, 0); + LIBC_NAMESPACE::syscall_impl<long>(FUTEX_SYSCALL_ID, &futex_word, + FUTEX_WAKE_PRIVATE, 1, 0, 0, 0); return MutexError::NONE; } @@ -131,6 +131,6 @@ public: 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 88efaec..05fa043 100644 --- a/libc/src/__support/threads/linux/thread.cpp +++ b/libc/src/__support/threads/linux/thread.cpp @@ -30,7 +30,7 @@ #include <sys/mman.h> // For PROT_* and MAP_* definitions. #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { #ifdef SYS_mmap2 static constexpr long MMAP_SYSCALL_NUMBER = SYS_mmap2; @@ -92,7 +92,7 @@ LIBC_INLINE ErrorOr<void *> alloc_stack(size_t stacksize, size_t guardsize) { // TODO: Maybe add MAP_STACK? Currently unimplemented on linux but helps // future-proof. - long mmap_result = __llvm_libc::syscall_impl<long>( + long mmap_result = LIBC_NAMESPACE::syscall_impl<long>( MMAP_SYSCALL_NUMBER, 0, // No special address size, prot, @@ -106,9 +106,9 @@ LIBC_INLINE ErrorOr<void *> alloc_stack(size_t stacksize, size_t guardsize) { if (guardsize) { // Give read/write permissions to actual stack. // TODO: We are assuming stack growsdown here. - long result = - __llvm_libc::syscall_impl<long>(SYS_mprotect, mmap_result + guardsize, - stacksize, PROT_READ | PROT_WRITE); + long result = LIBC_NAMESPACE::syscall_impl<long>( + SYS_mprotect, mmap_result + guardsize, stacksize, + PROT_READ | PROT_WRITE); if (result != 0) return Error{int(-result)}; @@ -125,7 +125,7 @@ free_stack(void *stack, size_t stacksize, size_t guardsize) { uintptr_t stackaddr = reinterpret_cast<uintptr_t>(stack); stackaddr -= guardsize; stack = reinterpret_cast<void *>(stackaddr); - __llvm_libc::syscall_impl<long>(SYS_munmap, stack, stacksize + guardsize); + LIBC_NAMESPACE::syscall_impl<long>(SYS_munmap, stack, stacksize + guardsize); } struct Thread; @@ -299,7 +299,7 @@ int Thread::run(ThreadStyle style, ThreadRunner runner, void *arg, void *stack, // variables from this function will not be availalbe to the child thread. #if defined(LIBC_TARGET_ARCH_IS_X86_64) long register clone_result asm(CLONE_RESULT_REGISTER); - clone_result = __llvm_libc::syscall_impl<long>( + clone_result = LIBC_NAMESPACE::syscall_impl<long>( SYS_clone, CLONE_SYSCALL_FLAGS, adjusted_stack, &attrib->tid, // The address where the child tid is written &clear_tid->val, // The futex where the child thread status is signalled @@ -308,7 +308,7 @@ int Thread::run(ThreadStyle style, ThreadRunner runner, void *arg, void *stack, #elif defined(LIBC_TARGET_ARCH_IS_AARCH64) || \ defined(LIBC_TARGET_ARCH_IS_RISCV64) long register clone_result asm(CLONE_RESULT_REGISTER); - clone_result = __llvm_libc::syscall_impl<long>( + clone_result = LIBC_NAMESPACE::syscall_impl<long>( SYS_clone, CLONE_SYSCALL_FLAGS, adjusted_stack, &attrib->tid, // The address where the child tid is written tls.tp, // The thread pointer value for the new thread. @@ -379,8 +379,8 @@ void Thread::wait() { while (clear_tid->load() != 0) { // We cannot do a FUTEX_WAIT_PRIVATE here as the kernel does a // FUTEX_WAKE and not a FUTEX_WAKE_PRIVATE. - __llvm_libc::syscall_impl<long>(FUTEX_SYSCALL_ID, &clear_tid->val, - FUTEX_WAIT, CLEAR_TID_VALUE, nullptr); + LIBC_NAMESPACE::syscall_impl<long>(FUTEX_SYSCALL_ID, &clear_tid->val, + FUTEX_WAIT, CLEAR_TID_VALUE, nullptr); } } @@ -409,7 +409,7 @@ int Thread::set_name(const cpp::string_view &name) { // If we are setting the name of the current thread, then we can // use the syscall to set the name. int retval = - __llvm_libc::syscall_impl<int>(SYS_prctl, PR_SET_NAME, name.data()); + LIBC_NAMESPACE::syscall_impl<int>(SYS_prctl, PR_SET_NAME, name.data()); if (retval < 0) return -retval; else @@ -420,17 +420,18 @@ int Thread::set_name(const cpp::string_view &name) { cpp::StringStream path_stream(path_name_buffer); construct_thread_name_file_path(path_stream, attrib->tid); #ifdef SYS_open - int fd = __llvm_libc::syscall_impl<int>(SYS_open, path_name_buffer, O_RDWR); + int fd = + LIBC_NAMESPACE::syscall_impl<int>(SYS_open, path_name_buffer, O_RDWR); #else - int fd = __llvm_libc::syscall_impl<int>(SYS_openat, AT_FDCWD, - path_name_buffer, O_RDWR); + int fd = LIBC_NAMESPACE::syscall_impl<int>(SYS_openat, AT_FDCWD, + path_name_buffer, O_RDWR); #endif if (fd < 0) return -fd; - int retval = - __llvm_libc::syscall_impl<int>(SYS_write, fd, name.data(), name.size()); - __llvm_libc::syscall_impl<long>(SYS_close, fd); + int retval = LIBC_NAMESPACE::syscall_impl<int>(SYS_write, fd, name.data(), + name.size()); + LIBC_NAMESPACE::syscall_impl<long>(SYS_close, fd); if (retval < 0) return -retval; @@ -450,7 +451,7 @@ int Thread::get_name(cpp::StringStream &name) const { // If we are getting the name of the current thread, then we can // use the syscall to get the name. int retval = - __llvm_libc::syscall_impl<int>(SYS_prctl, PR_GET_NAME, name_buffer); + LIBC_NAMESPACE::syscall_impl<int>(SYS_prctl, PR_GET_NAME, name_buffer); if (retval < 0) return -retval; name << name_buffer << cpp::StringStream::ENDS; @@ -461,17 +462,18 @@ int Thread::get_name(cpp::StringStream &name) const { cpp::StringStream path_stream(path_name_buffer); construct_thread_name_file_path(path_stream, attrib->tid); #ifdef SYS_open - int fd = __llvm_libc::syscall_impl<int>(SYS_open, path_name_buffer, O_RDONLY); + int fd = + LIBC_NAMESPACE::syscall_impl<int>(SYS_open, path_name_buffer, O_RDONLY); #else - int fd = __llvm_libc::syscall_impl<int>(SYS_openat, AT_FDCWD, - path_name_buffer, O_RDONLY); + int fd = LIBC_NAMESPACE::syscall_impl<int>(SYS_openat, AT_FDCWD, + path_name_buffer, O_RDONLY); #endif if (fd < 0) return -fd; - int retval = - __llvm_libc::syscall_impl<int>(SYS_read, fd, name_buffer, NAME_SIZE_MAX); - __llvm_libc::syscall_impl<long>(SYS_close, fd); + int retval = LIBC_NAMESPACE::syscall_impl<int>(SYS_read, fd, name_buffer, + NAME_SIZE_MAX); + LIBC_NAMESPACE::syscall_impl<long>(SYS_close, fd); if (retval < 0) return -retval; if (retval == NAME_SIZE_MAX) @@ -505,19 +507,19 @@ void thread_exit(ThreadReturnValue retval, ThreadStyle style) { // Set the CLEAR_TID address to nullptr to prevent the kernel // from signalling at a non-existent futex location. - __llvm_libc::syscall_impl<long>(SYS_set_tid_address, 0); + LIBC_NAMESPACE::syscall_impl<long>(SYS_set_tid_address, 0); // Return value for detached thread should be unused. We need to avoid // referencing `style` or `retval.*` because they may be stored on the stack // and we have deallocated our stack! - __llvm_libc::syscall_impl<long>(SYS_exit, 0); + LIBC_NAMESPACE::syscall_impl<long>(SYS_exit, 0); __builtin_unreachable(); } if (style == ThreadStyle::POSIX) - __llvm_libc::syscall_impl<long>(SYS_exit, retval.posix_retval); + LIBC_NAMESPACE::syscall_impl<long>(SYS_exit, retval.posix_retval); else - __llvm_libc::syscall_impl<long>(SYS_exit, retval.stdc_retval); + LIBC_NAMESPACE::syscall_impl<long>(SYS_exit, retval.stdc_retval); __builtin_unreachable(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/__support/threads/mutex.h b/libc/src/__support/threads/mutex.h index 7b27514..fa2bd64 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 @@ public: ~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 ec275eb..ad8d002 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 bedaa7c..62aa86b 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 6fbacef..3fc3aef 100644 --- a/libc/src/__support/threads/thread.h +++ b/libc/src/__support/threads/thread.h @@ -21,7 +21,7 @@ #include <stddef.h> // For size_t #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { using ThreadRunnerPosix = void *(void *); using ThreadRunnerStdc = int(void *); @@ -247,6 +247,6 @@ void call_atexit_callbacks(ThreadAttributes *attrib); } // namespace internal -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_THREADS_THREAD_H diff --git a/libc/src/__support/wctype_utils.h b/libc/src/__support/wctype_utils.h index d8de9fd..2c8eef8 100644 --- a/libc/src/__support/wctype_utils.h +++ b/libc/src/__support/wctype_utils.h @@ -16,7 +16,7 @@ #define __need_wchar_t #include <stddef.h> // needed for wint_t and wchar_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { // ------------------------------------------------------ @@ -40,6 +40,6 @@ LIBC_INLINE cpp::optional<wint_t> btowc(int c) { } } // namespace internal -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_WCTYPE_UTILS_H diff --git a/libc/src/assert/__assert_fail.h b/libc/src/assert/__assert_fail.h index ba8db9d..6b9dee2 100644 --- a/libc/src/assert/__assert_fail.h +++ b/libc/src/assert/__assert_fail.h @@ -11,11 +11,11 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { [[noreturn]] void __assert_fail(const char *assertion, const char *file, unsigned line, const char *function); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_ASSERT___ASSERT_FAIL_H diff --git a/libc/src/assert/assert.h b/libc/src/assert/assert.h index c1f325d..0318a93 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 10de66f..4cf914b 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 30c5f7f..b239088 100644 --- a/libc/src/assert/gpu/__assert_fail.cpp +++ b/libc/src/assert/gpu/__assert_fail.cpp @@ -13,7 +13,7 @@ #include "src/__support/libc_assert.h" #include "src/stdlib/abort.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // A single-use lock to allow only a single thread to print the assertion. static cpp::Atomic<uint32_t> lock = 0; @@ -32,8 +32,8 @@ LLVM_LIBC_FUNCTION(void, __assert_fail, // Only a single line should be printed if an assertion is hit. if (gpu::is_first_lane(mask)) - __llvm_libc::report_assertion_failure(assertion, file, line, function); - __llvm_libc::abort(); + LIBC_NAMESPACE::report_assertion_failure(assertion, file, line, function); + LIBC_NAMESPACE::abort(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isalnum.cpp b/libc/src/ctype/isalnum.cpp index ce3608f..42ed8ea 100644 --- a/libc/src/ctype/isalnum.cpp +++ b/libc/src/ctype/isalnum.cpp @@ -11,7 +11,7 @@ #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO: Currently restricted to default locale. // These should be extended using locale information. @@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(int, isalnum, (int c)) { return static_cast<int>(internal::isalnum(static_cast<unsigned>(c))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isalnum.h b/libc/src/ctype/isalnum.h index beb202a..71830c9 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 37f80f9..2b1bd0e 100644 --- a/libc/src/ctype/isalpha.cpp +++ b/libc/src/ctype/isalpha.cpp @@ -11,7 +11,7 @@ #include "src/__support/common.h" #include "src/__support/ctype_utils.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO: Currently restricted to default locale. // These should be extended using locale information. @@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(int, isalpha, (int c)) { return static_cast<int>(internal::isalpha(static_cast<unsigned>(c))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isalpha.h b/libc/src/ctype/isalpha.h index d5697a3..b5b07ee 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 8357563..8be3d7e 100644 --- a/libc/src/ctype/isascii.cpp +++ b/libc/src/ctype/isascii.cpp @@ -10,10 +10,10 @@ #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, isascii, (int c)) { return static_cast<int>((c & (~0x7f)) == 0); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isascii.h b/libc/src/ctype/isascii.h index 7e31b3c..5a734a2 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 438eff7..9ac9d36 100644 --- a/libc/src/ctype/isblank.cpp +++ b/libc/src/ctype/isblank.cpp @@ -10,7 +10,7 @@ #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO: Currently restricted to default locale. // These should be extended using locale information. @@ -18,4 +18,4 @@ LLVM_LIBC_FUNCTION(int, isblank, (int c)) { return static_cast<int>(c == ' ' || c == '\t'); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isblank.h b/libc/src/ctype/isblank.h index 0554322..4cacdb3 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 b203e4e..b52b86f 100644 --- a/libc/src/ctype/iscntrl.cpp +++ b/libc/src/ctype/iscntrl.cpp @@ -10,7 +10,7 @@ #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO: Currently restricted to default locale. // These should be extended using locale information. @@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(int, iscntrl, (int c)) { return static_cast<int>(ch < 0x20 || ch == 0x7f); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/iscntrl.h b/libc/src/ctype/iscntrl.h index 26f0940..e0cae0c 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 b478384..d4d5d1f 100644 --- a/libc/src/ctype/isdigit.cpp +++ b/libc/src/ctype/isdigit.cpp @@ -10,7 +10,7 @@ #include "src/__support/common.h" #include "src/__support/ctype_utils.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO: Currently restricted to default locale. // These should be extended using locale information. @@ -18,4 +18,4 @@ LLVM_LIBC_FUNCTION(int, isdigit, (int c)) { return static_cast<int>(internal::isdigit(static_cast<unsigned>(c))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isdigit.h b/libc/src/ctype/isdigit.h index 32a7623..a024cf4 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 6a1f55e..e195f9f 100644 --- a/libc/src/ctype/isgraph.cpp +++ b/libc/src/ctype/isgraph.cpp @@ -11,7 +11,7 @@ #include "src/__support/common.h" #include "src/__support/ctype_utils.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO: Currently restricted to default locale. // These should be extended using locale information. @@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(int, isgraph, (int c)) { return static_cast<int>(internal::isgraph(static_cast<unsigned>(c))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isgraph.h b/libc/src/ctype/isgraph.h index 421d0ff..486c32d 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 b21ccd4..bd252e5 100644 --- a/libc/src/ctype/islower.cpp +++ b/libc/src/ctype/islower.cpp @@ -11,7 +11,7 @@ #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO: Currently restricted to default locale. // These should be extended using locale information. @@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(int, islower, (int c)) { return static_cast<int>(internal::islower(static_cast<unsigned>(c))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/islower.h b/libc/src/ctype/islower.h index 7643542..dc59ce9 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 dd9a085..bdf9d08 100644 --- a/libc/src/ctype/isprint.cpp +++ b/libc/src/ctype/isprint.cpp @@ -10,7 +10,7 @@ #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO: Currently restricted to default locale. // These should be extended using locale information. @@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(int, isprint, (int c)) { return static_cast<int>((ch - ' ') < 95); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isprint.h b/libc/src/ctype/isprint.h index 17ed56e..22c835b 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 7ccad4b..d355c19 100644 --- a/libc/src/ctype/ispunct.cpp +++ b/libc/src/ctype/ispunct.cpp @@ -11,7 +11,7 @@ #include "src/__support/common.h" #include "src/__support/ctype_utils.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO: Currently restricted to default locale. // These should be extended using locale information. @@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(int, ispunct, (int c)) { return static_cast<int>(!internal::isalnum(ch) && internal::isgraph(ch)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/ispunct.h b/libc/src/ctype/ispunct.h index 23cc08a..7eaa83a 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 8cd76c4..8c09eda 100644 --- a/libc/src/ctype/isspace.cpp +++ b/libc/src/ctype/isspace.cpp @@ -11,7 +11,7 @@ #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO: Currently restricted to default locale. // These should be extended using locale information. @@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(int, isspace, (int c)) { return static_cast<int>(internal::isspace(static_cast<unsigned>(c))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isspace.h b/libc/src/ctype/isspace.h index d919e9e..56b7057 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 dcb4cf1..b527e3e 100644 --- a/libc/src/ctype/isupper.cpp +++ b/libc/src/ctype/isupper.cpp @@ -11,7 +11,7 @@ #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO: Currently restricted to default locale. // These should be extended using locale information. @@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(int, isupper, (int c)) { return static_cast<int>(internal::isupper(static_cast<unsigned>(c))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isupper.h b/libc/src/ctype/isupper.h index 7a1f227..8f5ce84 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 96efc8f..79152c9 100644 --- a/libc/src/ctype/isxdigit.cpp +++ b/libc/src/ctype/isxdigit.cpp @@ -11,7 +11,7 @@ #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO: Currently restricted to default locale. // These should be extended using locale information. @@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(int, isxdigit, (int c)) { return static_cast<int>(internal::isdigit(ch) || (ch | 32) - 'a' < 6); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isxdigit.h b/libc/src/ctype/isxdigit.h index a332ecc..4966c32 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 19a97ae..06bf91b 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 c3f48a3..246580e 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 2c4b851..4e8b96d 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 97e675c..8213da9 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 b216cc2..7b0db35 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 a21b0cf..b5d8890 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 2863106..22c27c4 100644 --- a/libc/src/dirent/closedir.cpp +++ b/libc/src/dirent/closedir.cpp @@ -14,10 +14,10 @@ #include <dirent.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, closedir, (::DIR * dir)) { - auto *d = reinterpret_cast<__llvm_libc::Dir *>(dir); + auto *d = reinterpret_cast<LIBC_NAMESPACE::Dir *>(dir); int retval = d->close(); if (retval != 0) { libc_errno = retval; @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, closedir, (::DIR * dir)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/dirent/closedir.h b/libc/src/dirent/closedir.h index c5ee7ae..6d6b898 100644 --- a/libc/src/dirent/closedir.h +++ b/libc/src/dirent/closedir.h @@ -11,10 +11,10 @@ #include <dirent.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int closedir(::DIR *dir); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_DIRENT_CLOSEDIR_H diff --git a/libc/src/dirent/dirfd.cpp b/libc/src/dirent/dirfd.cpp index 214c5c5..27995f6 100644 --- a/libc/src/dirent/dirfd.cpp +++ b/libc/src/dirent/dirfd.cpp @@ -13,11 +13,11 @@ #include <dirent.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, dirfd, (::DIR * dir)) { - auto *d = reinterpret_cast<__llvm_libc::Dir *>(dir); + auto *d = reinterpret_cast<LIBC_NAMESPACE::Dir *>(dir); return d->getfd(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/dirent/dirfd.h b/libc/src/dirent/dirfd.h index 8590e3e..34acb01 100644 --- a/libc/src/dirent/dirfd.h +++ b/libc/src/dirent/dirfd.h @@ -11,10 +11,10 @@ #include <dirent.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int dirfd(::DIR *dir); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_DIRENT_DIRFD_H diff --git a/libc/src/dirent/opendir.cpp b/libc/src/dirent/opendir.cpp index 06749e8..56f7bc8 100644 --- a/libc/src/dirent/opendir.cpp +++ b/libc/src/dirent/opendir.cpp @@ -14,7 +14,7 @@ #include <dirent.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(::DIR *, opendir, (const char *name)) { auto dir = Dir::open(name); @@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(::DIR *, opendir, (const char *name)) { return reinterpret_cast<DIR *>(dir.value()); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/dirent/opendir.h b/libc/src/dirent/opendir.h index e183587..635cb90 100644 --- a/libc/src/dirent/opendir.h +++ b/libc/src/dirent/opendir.h @@ -11,10 +11,10 @@ #include <dirent.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { ::DIR *opendir(const char *name); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_DIRENT_OPENDIR_H diff --git a/libc/src/dirent/readdir.cpp b/libc/src/dirent/readdir.cpp index a9f9491..448935e 100644 --- a/libc/src/dirent/readdir.cpp +++ b/libc/src/dirent/readdir.cpp @@ -14,10 +14,10 @@ #include <dirent.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(struct ::dirent *, readdir, (::DIR * dir)) { - auto *d = reinterpret_cast<__llvm_libc::Dir *>(dir); + auto *d = reinterpret_cast<LIBC_NAMESPACE::Dir *>(dir); auto dirent_val = d->read(); if (!dirent_val) { libc_errno = dirent_val.error(); @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(struct ::dirent *, readdir, (::DIR * dir)) { return dirent_val.value(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/dirent/readdir.h b/libc/src/dirent/readdir.h index b78150b..83c8c56 100644 --- a/libc/src/dirent/readdir.h +++ b/libc/src/dirent/readdir.h @@ -11,10 +11,10 @@ #include <dirent.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { struct ::dirent *readdir(DIR *dir); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_DIRENT_READDIR_H diff --git a/libc/src/errno/libc_errno.cpp b/libc/src/errno/libc_errno.cpp index 0489e11..c8f0bff 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 c81ea31..fbcd1c3 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 0c1abda..fc91a3c 100644 --- a/libc/src/fcntl/creat.h +++ b/libc/src/fcntl/creat.h @@ -11,10 +11,10 @@ #include <fcntl.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int creat(const char *path, int mode); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_FCNTL_CREAT_H diff --git a/libc/src/fcntl/linux/creat.cpp b/libc/src/fcntl/linux/creat.cpp index 0b449bb..0710fab 100644 --- a/libc/src/fcntl/linux/creat.cpp +++ b/libc/src/fcntl/linux/creat.cpp @@ -15,14 +15,14 @@ #include <fcntl.h> #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, creat, (const char *path, int mode_flags)) { #ifdef SYS_open - int fd = __llvm_libc::syscall_impl<int>( + int fd = LIBC_NAMESPACE::syscall_impl<int>( SYS_open, path, O_CREAT | O_WRONLY | O_TRUNC, mode_flags); #else - int fd = __llvm_libc::syscall_impl<int>( + int fd = LIBC_NAMESPACE::syscall_impl<int>( SYS_openat, AT_FDCWD, path, O_CREAT | O_WRONLY | O_TRUNC, mode_flags); #endif @@ -33,4 +33,4 @@ LLVM_LIBC_FUNCTION(int, creat, (const char *path, int mode_flags)) { return -1; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/fcntl/linux/open.cpp b/libc/src/fcntl/linux/open.cpp index 9558a2b0..7394069 100644 --- a/libc/src/fcntl/linux/open.cpp +++ b/libc/src/fcntl/linux/open.cpp @@ -16,7 +16,7 @@ #include <stdarg.h> #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, open, (const char *path, int flags, ...)) { mode_t mode_flags = 0; @@ -30,10 +30,10 @@ LLVM_LIBC_FUNCTION(int, open, (const char *path, int flags, ...)) { } #ifdef SYS_open - int fd = __llvm_libc::syscall_impl<int>(SYS_open, path, flags, mode_flags); + int fd = LIBC_NAMESPACE::syscall_impl<int>(SYS_open, path, flags, mode_flags); #else - int fd = __llvm_libc::syscall_impl<int>(SYS_openat, AT_FDCWD, path, flags, - mode_flags); + int fd = LIBC_NAMESPACE::syscall_impl<int>(SYS_openat, AT_FDCWD, path, flags, + mode_flags); #endif if (fd > 0) return fd; @@ -42,4 +42,4 @@ LLVM_LIBC_FUNCTION(int, open, (const char *path, int flags, ...)) { return -1; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/fcntl/linux/openat.cpp b/libc/src/fcntl/linux/openat.cpp index c6a47bf..a2f7413 100644 --- a/libc/src/fcntl/linux/openat.cpp +++ b/libc/src/fcntl/linux/openat.cpp @@ -16,7 +16,7 @@ #include <stdarg.h> #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, openat, (int dfd, const char *path, int flags, ...)) { mode_t mode_flags = 0; @@ -29,8 +29,8 @@ LLVM_LIBC_FUNCTION(int, openat, (int dfd, const char *path, int flags, ...)) { va_end(varargs); } - int fd = - __llvm_libc::syscall_impl<int>(SYS_openat, dfd, path, flags, mode_flags); + int fd = LIBC_NAMESPACE::syscall_impl<int>(SYS_openat, dfd, path, flags, + mode_flags); if (fd > 0) return fd; @@ -38,4 +38,4 @@ LLVM_LIBC_FUNCTION(int, openat, (int dfd, const char *path, int flags, ...)) { return -1; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/fcntl/open.h b/libc/src/fcntl/open.h index 49cfb50..30950dd 100644 --- a/libc/src/fcntl/open.h +++ b/libc/src/fcntl/open.h @@ -11,10 +11,10 @@ #include <fcntl.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int open(const char *path, int flags, ...); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_FCNTL_OPEN_H diff --git a/libc/src/fcntl/openat.h b/libc/src/fcntl/openat.h index 96a96de..5ea5d7f 100644 --- a/libc/src/fcntl/openat.h +++ b/libc/src/fcntl/openat.h @@ -11,10 +11,10 @@ #include <fcntl.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int openat(int dfd, const char *path, int flags, ...); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_FCNTL_OPENAT_H diff --git a/libc/src/fenv/feclearexcept.cpp b/libc/src/fenv/feclearexcept.cpp index 2bdea88..5eb1b04 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 fa771ce..e7df86d 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 855d707..c715627 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 44a545e..977fd83 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 0b63a7f..cf45b7f 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 58c1e0a..a077162 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 cc98031..fbdb7d5 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 e100168..65831648 100644 --- a/libc/src/fenv/fegetenv.h +++ b/libc/src/fenv/fegetenv.h @@ -11,10 +11,10 @@ #include <fenv.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fegetenv(fenv_t *); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_FENV_FEGETENV_H diff --git a/libc/src/fenv/fegetexcept.cpp b/libc/src/fenv/fegetexcept.cpp index 7cf1294..edc4faf 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 ed6579f..53ce648 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 15c2468..71b87ce 100644 --- a/libc/src/fenv/fegetexceptflag.cpp +++ b/libc/src/fenv/fegetexceptflag.cpp @@ -12,7 +12,7 @@ #include <fenv.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fegetexceptflag, (fexcept_t * flagp, int excepts)) { // TODO: Add a compile time check to see if the excepts actually fit in flagp. @@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(int, fegetexceptflag, (fexcept_t * flagp, int excepts)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/fenv/fegetexceptflag.h b/libc/src/fenv/fegetexceptflag.h index 20913cb..ad72161 100644 --- a/libc/src/fenv/fegetexceptflag.h +++ b/libc/src/fenv/fegetexceptflag.h @@ -11,10 +11,10 @@ #include <fenv.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fegetexceptflag(fexcept_t *, int excepts); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_FENV_FEGETEXCEPTFLAG_H diff --git a/libc/src/fenv/fegetround.cpp b/libc/src/fenv/fegetround.cpp index c01ea2c..edf6eac 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 1bc79cb..40be879 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 fe0f1024..3c73b1f 100644 --- a/libc/src/fenv/feholdexcept.cpp +++ b/libc/src/fenv/feholdexcept.cpp @@ -12,7 +12,7 @@ #include <fenv.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, feholdexcept, (fenv_t * envp)) { if (fputil::get_env(envp) != 0) @@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(int, feholdexcept, (fenv_t * envp)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/fenv/feholdexcept.h b/libc/src/fenv/feholdexcept.h index cfb86b5..bbefc4e 100644 --- a/libc/src/fenv/feholdexcept.h +++ b/libc/src/fenv/feholdexcept.h @@ -11,10 +11,10 @@ #include <fenv.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int feholdexcept(fenv_t *); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_FENV_FEHOLDEXCEPT_H diff --git a/libc/src/fenv/feraiseexcept.cpp b/libc/src/fenv/feraiseexcept.cpp index 4c2a467..0bee7f5 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 5c9eacf..a5ab3b9 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 628da31..25ac789 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 316ecee..8b56beb 100644 --- a/libc/src/fenv/fesetenv.h +++ b/libc/src/fenv/fesetenv.h @@ -11,10 +11,10 @@ #include <fenv.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fesetenv(const fenv_t *); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_FENV_FESETENV_H diff --git a/libc/src/fenv/fesetexceptflag.cpp b/libc/src/fenv/fesetexceptflag.cpp index 3e134ab..2fe7cb5 100644 --- a/libc/src/fenv/fesetexceptflag.cpp +++ b/libc/src/fenv/fesetexceptflag.cpp @@ -12,7 +12,7 @@ #include <fenv.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fesetexceptflag, (const fexcept_t *flagp, int excepts)) { @@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, fesetexceptflag, return fputil::set_except(excepts_to_set); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/fenv/fesetexceptflag.h b/libc/src/fenv/fesetexceptflag.h index 0e6497a..15e62ed 100644 --- a/libc/src/fenv/fesetexceptflag.h +++ b/libc/src/fenv/fesetexceptflag.h @@ -11,10 +11,10 @@ #include <fenv.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fesetexceptflag(const fexcept_t *, int excepts); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_FENV_FESETEXCEPTFLAG_H diff --git a/libc/src/fenv/fesetround.cpp b/libc/src/fenv/fesetround.cpp index 4af8a77..22f2b9d 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 148a5ea..75023bd 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 c70301f..c284a2c 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 fb3e404..dec1ac2 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 5cecf0f..7e81b94 100644 --- a/libc/src/fenv/feupdateenv.cpp +++ b/libc/src/fenv/feupdateenv.cpp @@ -12,7 +12,7 @@ #include <fenv.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, feupdateenv, (const fenv_t *envp)) { int current_excepts = fputil::test_except(FE_ALL_EXCEPT); @@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(int, feupdateenv, (const fenv_t *envp)) { return fputil::raise_except(current_excepts); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/fenv/feupdateenv.h b/libc/src/fenv/feupdateenv.h index 1599c01..294c041 100644 --- a/libc/src/fenv/feupdateenv.h +++ b/libc/src/fenv/feupdateenv.h @@ -11,10 +11,10 @@ #include <fenv.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int feupdateenv(const fenv_t *); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_FENV_FEUPDATEENV_H diff --git a/libc/src/gpu/rpc_host_call.cpp b/libc/src/gpu/rpc_host_call.cpp index b39bef6..7b9b9f2 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 f8e2cdd..14393ab 100644 --- a/libc/src/gpu/rpc_host_call.h +++ b/libc/src/gpu/rpc_host_call.h @@ -11,10 +11,10 @@ #include <stddef.h> // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void rpc_host_call(void *fn, void *buffer, size_t size); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_GPU_RPC_H_HOST_CALL diff --git a/libc/src/inttypes/imaxabs.cpp b/libc/src/inttypes/imaxabs.cpp index 6c29ea2..b390676 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 0add10d..cd30011b 100644 --- a/libc/src/inttypes/imaxabs.h +++ b/libc/src/inttypes/imaxabs.h @@ -11,10 +11,10 @@ #include <inttypes.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { intmax_t imaxabs(intmax_t j); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_INTTYPES_IMAXABS_H diff --git a/libc/src/inttypes/imaxdiv.cpp b/libc/src/inttypes/imaxdiv.cpp index 9ed6a1b..77f0cc5 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 c8af352..7491227 100644 --- a/libc/src/inttypes/imaxdiv.h +++ b/libc/src/inttypes/imaxdiv.h @@ -11,10 +11,10 @@ #include <inttypes.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { imaxdiv_t imaxdiv(intmax_t x, intmax_t y); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_INTTYPES_IMAXDIV_H diff --git a/libc/src/inttypes/strtoimax.cpp b/libc/src/inttypes/strtoimax.cpp index 5a25623..459877e 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 c2097e3..b72547f 100644 --- a/libc/src/inttypes/strtoimax.h +++ b/libc/src/inttypes/strtoimax.h @@ -11,11 +11,11 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { intmax_t strtoimax(const char *__restrict str, char **__restrict str_end, int base); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_INTTYPES_STRTOIMAX_H diff --git a/libc/src/inttypes/strtoumax.cpp b/libc/src/inttypes/strtoumax.cpp index 0e33c55..4011a17 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 e3ec13a..d59e993 100644 --- a/libc/src/inttypes/strtoumax.h +++ b/libc/src/inttypes/strtoumax.h @@ -11,11 +11,11 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { uintmax_t strtoumax(const char *__restrict str, char **__restrict str_end, int base); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_INTTYPES_STRTOUMAX_H diff --git a/libc/src/math/aarch64/ceil.cpp b/libc/src/math/aarch64/ceil.cpp index 73c3cc0..81cd950 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 2268989..3cbcc1f 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 8de1f67..0e3d13a 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 6bb99eb..8942a9e 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 6659060..8972c16 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 6044c8b..8b3a9cf 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 280d919..34ffd17 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 a325ce3..fc2426f 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 9604fbf..3221efa 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 66df878..aac43b4 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 7182127..227f10b 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 ff4b325..32a697c 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 9b264e8..bb4c5a8b 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 8e8b4eb..589ffd0 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 98188de..c424dee 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 e8e6456..0fa3aa8 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 8bf4c56..fbe6563 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 edffe1b..004240f 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 5b7f113..503e7cb 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 4f48323..8b8b37b 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 aca1d6d..aa97ccf 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 1aaabe9..158f311 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 c7a911b..f0c8b6b 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 558dc22..c470a8c 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 9efe062..6f08bf0 100644 --- a/libc/src/math/docs/add_math_function.md +++ b/libc/src/math/docs/add_math_function.md @@ -30,7 +30,7 @@ added to the following locations: ``` libc/src/math/CMakeLists.txt ``` -- Add function declaration (under `__llvm_libc` namespace) to: +- Add function declaration (under `LIBC_NAMESPACE` namespace) to: ``` libc/src/math/<func>.h ``` @@ -56,7 +56,7 @@ located at: ``` - These are preferred to be included as header-only. - To manipulate bits of floating point numbers, use the template class -`__llvm_libc::fputil::FPBits<>` in the header file: +`LIBC_NAMESPACE::fputil::FPBits<>` in the header file: ``` libc/src/__support/FPUtils/FPBits.h ``` @@ -71,7 +71,7 @@ compare your outputs with the corresponding MPFR function. In order for your new function to be supported by these two macros, the following files will need to be updated: -- Add the function enum to `__llvm_libc::testing::mpfr::Operation` in the +- Add the function enum to `LIBC_NAMESPACE::testing::mpfr::Operation` in the header file: ``` libc/utils/MPFRWrapper/MPFRUtils.h diff --git a/libc/src/math/erff.h b/libc/src/math/erff.h index 1f7dcb5..f6c56c7 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 6fed171..6d60a3b 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 5afc95d..081b419 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 7f0ef25..4df5c46 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 ee70722..2feccf6 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 c1f72b1..13af54c 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 c61ce98..38837cba 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 2577e4a..359cbee 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 424d2e0..0aad5ea 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 0ad97a0..ca2cc10 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 fa25b1a..b3df8bf 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 f838c12..457cb47 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 50c586c..01d5a53 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 6de261f..4b18d9a 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 88a76eb..2920c7a 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 029df3a..52d6dd7 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 224cc13..ef53b29 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 fbc7f09..7f0608e 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 48fbb65..29e5bdc 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 9f05798..64baa4d 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 e37df5c..1126323 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 41d80ba..a067300 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 52334ee..bf011bb 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 62dad57..b9c159a6 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 c19505c..e111e26 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 a79ff01..01b9aa7 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 ab9c4ae..90d97e6 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 9258243..963ea7b 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 ed303d2..74eeac2 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 9f75c82..818266ed 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 ab13467..2a9b2a6 100644 --- a/libc/src/math/generic/acosf.cpp +++ b/libc/src/math/generic/acosf.cpp @@ -19,7 +19,7 @@ #include "inv_trigf_utils.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { static constexpr size_t N_EXCEPTS = 4; @@ -119,4 +119,4 @@ LLVM_LIBC_FUNCTION(float, acosf, (float x)) { return static_cast<float>(x_sign ? M_MATH_PI - r : r); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/acoshf.cpp b/libc/src/math/generic/acoshf.cpp index ce35276..9438be1 100644 --- a/libc/src/math/generic/acoshf.cpp +++ b/libc/src/math/generic/acoshf.cpp @@ -16,7 +16,7 @@ #include "src/math/generic/common_constants.h" #include "src/math/generic/explogxf.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(float, acoshf, (float x)) { using FPBits_t = typename fputil::FPBits<float>; @@ -74,4 +74,4 @@ LLVM_LIBC_FUNCTION(float, acoshf, (float x)) { log_eval(x_d + fputil::sqrt(fputil::multiply_add(x_d, x_d, -1.0)))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/asinf.cpp b/libc/src/math/generic/asinf.cpp index 9b724d3..f40a08e 100644 --- a/libc/src/math/generic/asinf.cpp +++ b/libc/src/math/generic/asinf.cpp @@ -20,7 +20,7 @@ #include "inv_trigf_utils.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { static constexpr size_t N_EXCEPTS = 2; @@ -152,4 +152,4 @@ LLVM_LIBC_FUNCTION(float, asinf, (float x)) { return static_cast<float>(fputil::multiply_add(c3, r, c2)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/asinhf.cpp b/libc/src/math/generic/asinhf.cpp index 91ecf45..6bde08d 100644 --- a/libc/src/math/generic/asinhf.cpp +++ b/libc/src/math/generic/asinhf.cpp @@ -15,7 +15,7 @@ #include "src/math/generic/common_constants.h" #include "src/math/generic/explogxf.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(float, asinhf, (float x)) { using FPBits_t = typename fputil::FPBits<float>; @@ -104,4 +104,4 @@ LLVM_LIBC_FUNCTION(float, asinhf, (float x)) { x_d, x_sign, fputil::sqrt(fputil::multiply_add(x_d, x_d, 1.0))))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/atanf.cpp b/libc/src/math/generic/atanf.cpp index 5037806..f2e4f8b 100644 --- a/libc/src/math/generic/atanf.cpp +++ b/libc/src/math/generic/atanf.cpp @@ -13,7 +13,7 @@ #include "src/__support/macros/optimization.h" // LIBC_UNLIKELY #include "src/math/generic/inv_trigf_utils.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(float, atanf, (float x)) { using FPBits = typename fputil::FPBits<float>; @@ -61,4 +61,4 @@ LLVM_LIBC_FUNCTION(float, atanf, (float x)) { return static_cast<float>(atan_eval(x)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/atanhf.cpp b/libc/src/math/generic/atanhf.cpp index 0a4512f..58e7f23 100644 --- a/libc/src/math/generic/atanhf.cpp +++ b/libc/src/math/generic/atanhf.cpp @@ -11,7 +11,7 @@ #include "src/__support/macros/optimization.h" // LIBC_UNLIKELY #include "src/math/generic/explogxf.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(float, atanhf, (float x)) { using FPBits = typename fputil::FPBits<float>; @@ -57,4 +57,4 @@ LLVM_LIBC_FUNCTION(float, atanhf, (float x)) { return static_cast<float>(0.5 * log_eval((xdbl + 1.0) / (xdbl - 1.0))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/ceil.cpp b/libc/src/math/generic/ceil.cpp index 372a035..efd0f24 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 9a51048..d49b342 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 b055d90..7c3b680 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 78f9df9..737d2ab 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 8cb86b6..df9d782 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 51e63f1..c5ad414 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 4773a25..077e1ce 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 5622378..b74393c 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 2e4ca3c..67b60de 100644 --- a/libc/src/math/generic/cosf.cpp +++ b/libc/src/math/generic/cosf.cpp @@ -19,7 +19,7 @@ #include <errno.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Exceptional cases for cosf. static constexpr size_t N_EXCEPTS = 6; @@ -133,4 +133,4 @@ LLVM_LIBC_FUNCTION(float, cosf, (float x)) { sin_y, -sin_k, fputil::multiply_add(cosm1_y, cos_k, cos_k))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/coshf.cpp b/libc/src/math/generic/coshf.cpp index 67d2667..62d7786 100644 --- a/libc/src/math/generic/coshf.cpp +++ b/libc/src/math/generic/coshf.cpp @@ -13,7 +13,7 @@ #include "src/__support/macros/optimization.h" // LIBC_UNLIKELY #include "src/math/generic/explogxf.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(float, coshf, (float x)) { using FPBits = typename fputil::FPBits<float>; @@ -51,4 +51,4 @@ LLVM_LIBC_FUNCTION(float, coshf, (float x)) { return static_cast<float>(exp_pm_eval</*is_sinh*/ false>(x)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/erff.cpp b/libc/src/math/generic/erff.cpp index a2cc8bf..a7b0897 100644 --- a/libc/src/math/generic/erff.cpp +++ b/libc/src/math/generic/erff.cpp @@ -14,7 +14,7 @@ #include "src/__support/common.h" #include "src/__support/macros/optimization.h" // LIBC_UNLIKELY -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Polynomials approximating erf(x)/x on ( k/8, (k + 1)/8 ) generated by Sollya // with: @@ -170,4 +170,4 @@ LLVM_LIBC_FUNCTION(float, erff, (float x)) { return static_cast<float>(xd * fputil::multiply_add(x8, p1, p0)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/exp.cpp b/libc/src/math/generic/exp.cpp index c16b461..110ab96 100644 --- a/libc/src/math/generic/exp.cpp +++ b/libc/src/math/generic/exp.cpp @@ -25,7 +25,7 @@ #include <errno.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { using fputil::DoubleDouble; using fputil::TripleDouble; @@ -413,4 +413,4 @@ LLVM_LIBC_FUNCTION(double, exp, (double x)) { return static_cast<double>(r_f128); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/exp10.cpp b/libc/src/math/generic/exp10.cpp index 4a43259..b152425 100644 --- a/libc/src/math/generic/exp10.cpp +++ b/libc/src/math/generic/exp10.cpp @@ -25,7 +25,7 @@ #include <errno.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { using fputil::DoubleDouble; using fputil::TripleDouble; @@ -473,4 +473,4 @@ LLVM_LIBC_FUNCTION(double, exp10, (double x)) { return static_cast<double>(r_f128); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/exp10f.cpp b/libc/src/math/generic/exp10f.cpp index b0e93dd..52190fb 100644 --- a/libc/src/math/generic/exp10f.cpp +++ b/libc/src/math/generic/exp10f.cpp @@ -20,7 +20,7 @@ #include <errno.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(float, exp10f, (float x)) { using FPBits = typename fputil::FPBits<float>; @@ -133,4 +133,4 @@ LLVM_LIBC_FUNCTION(float, exp10f, (float x)) { return static_cast<float>(multiply_add(p, lo2 * rr.mh, c0 * rr.mh)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/exp2.cpp b/libc/src/math/generic/exp2.cpp index 96710c7..b4b9960 100644 --- a/libc/src/math/generic/exp2.cpp +++ b/libc/src/math/generic/exp2.cpp @@ -25,7 +25,7 @@ #include <errno.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { using fputil::DoubleDouble; using fputil::TripleDouble; @@ -387,4 +387,4 @@ LLVM_LIBC_FUNCTION(double, exp2, (double x)) { return static_cast<double>(r_f128); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/exp2f.cpp b/libc/src/math/generic/exp2f.cpp index 2a5776a..fc91dfd 100644 --- a/libc/src/math/generic/exp2f.cpp +++ b/libc/src/math/generic/exp2f.cpp @@ -22,7 +22,7 @@ #include "explogxf.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { constexpr uint32_t EXVAL1 = 0x3b42'9d37U; constexpr uint32_t EXVAL2 = 0xbcf3'a937U; @@ -158,4 +158,4 @@ LLVM_LIBC_FUNCTION(float, exp2f, (float x)) { return static_cast<float>(fputil::multiply_add(p, dx_sq * mh, c1 * mh)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/exp_utils.cpp b/libc/src/math/generic/exp_utils.cpp index 9555dd6..afdaea3 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 edbd60a..49d9a81 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 2cc8406..5a938a7 100644 --- a/libc/src/math/generic/expf.cpp +++ b/libc/src/math/generic/expf.cpp @@ -20,7 +20,7 @@ #include <errno.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(float, expf, (float x)) { using FPBits = typename fputil::FPBits<float>; @@ -105,4 +105,4 @@ LLVM_LIBC_FUNCTION(float, expf, (float x)) { return static_cast<float>(exp_hi * exp_mid * exp_lo); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/explogxf.cpp b/libc/src/math/generic/explogxf.cpp index 3e12e8a..87ee578 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 97b5854c..512785b 100644 --- a/libc/src/math/generic/explogxf.h +++ b/libc/src/math/generic/explogxf.h @@ -22,7 +22,7 @@ #include <errno.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { struct ExpBase { // Base = e @@ -296,7 +296,7 @@ LIBC_INLINE static double log2_eval(double x) { // c0 = dx * (1.0 / ln(2)) + LOG_P1_LOG2[p1] double c0 = fputil::multiply_add(dx, 0x1.71547652b82fep+0, LOG_P1_LOG2[p1]); - result += __llvm_libc::fputil::polyeval(dx * dx, c0, c1, c2, c3, c4); + result += LIBC_NAMESPACE::fputil::polyeval(dx * dx, c0, c1, c2, c3, c4); return result; } @@ -381,6 +381,6 @@ LIBC_INLINE cpp::optional<double> ziv_test_denorm(int hi, double mid, double lo, return cpp::nullopt; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_MATH_GENERIC_EXPLOGXF_H diff --git a/libc/src/math/generic/expm1f.cpp b/libc/src/math/generic/expm1f.cpp index 811baec..edd0183 100644 --- a/libc/src/math/generic/expm1f.cpp +++ b/libc/src/math/generic/expm1f.cpp @@ -22,7 +22,7 @@ #include <errno.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(float, expm1f, (float x)) { using FPBits = typename fputil::FPBits<float>; @@ -160,4 +160,4 @@ LLVM_LIBC_FUNCTION(float, expm1f, (float x)) { return static_cast<float>(fputil::multiply_add(exp_hi_mid, exp_lo, -1.0)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/fabs.cpp b/libc/src/math/generic/fabs.cpp index 13872ac..0c0b774 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 da4c67e..a57f6bf 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 9dd3665..6b912c9 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 1fcd09b..22d99867 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 db36f50..789a0c5 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 97c46e5..c1091cc 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 982464c..60386f0 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 af66be7..8566668 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 a56bc05..2803127 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 22aa20e..e27e5ba 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 30074b8..7512b82 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 e96794b..7feeee9 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 6ad319f..3241092 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 2a95c98..6c62507 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 d06c8a6..b9f313d 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 658f147..539fedb 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 2f10c84..147f6c5 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 563a164..69e0c8d 100644 --- a/libc/src/math/generic/fmod.cpp +++ b/libc/src/math/generic/fmod.cpp @@ -10,10 +10,10 @@ #include "src/__support/FPUtil/generic/FMod.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(double, fmod, (double x, double y)) { return fputil::generic::FMod<double>::eval(x, y); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/fmodf.cpp b/libc/src/math/generic/fmodf.cpp index dca476c..7a29ff1 100644 --- a/libc/src/math/generic/fmodf.cpp +++ b/libc/src/math/generic/fmodf.cpp @@ -10,10 +10,10 @@ #include "src/__support/FPUtil/generic/FMod.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(float, fmodf, (float x, float y)) { return fputil::generic::FMod<float>::eval(x, y); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/frexp.cpp b/libc/src/math/generic/frexp.cpp index c31526b..a183ba7 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 2185e47..4fdc869 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 4573065..0be4e74 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 9bd2755..a1914d0 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 ffc892e..3fedeed 100644 --- a/libc/src/math/generic/hypotf.cpp +++ b/libc/src/math/generic/hypotf.cpp @@ -11,7 +11,7 @@ #include "src/__support/FPUtil/sqrt.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(float, hypotf, (float x, float y)) { using DoubleBits = fputil::FPBits<double>; @@ -70,4 +70,4 @@ LLVM_LIBC_FUNCTION(float, hypotf, (float x, float y)) { return static_cast<float>(static_cast<double>(result)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/ilogb.cpp b/libc/src/math/generic/ilogb.cpp index 296e302..4e5f7d9 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 476fc3e..ca15879 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 b08ee91..4c18daa 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 d88fe60..8013c04 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 53763d4..c88ded2 100644 --- a/libc/src/math/generic/inv_trigf_utils.h +++ b/libc/src/math/generic/inv_trigf_utils.h @@ -18,7 +18,7 @@ #include <errno.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // PI and PI / 2 constexpr double M_MATH_PI = 0x1.921fb54442d18p+1; @@ -54,16 +54,16 @@ LIBC_INLINE double atan_eval(double x) { auto x_abs = bs.uintval() & FPB::FloatProp::EXP_MANT_MASK; if (x_abs <= umin) { - double pe = __llvm_libc::fputil::polyeval(x * x, 0.0, ATAN_K[1], ATAN_K[2], - ATAN_K[3], ATAN_K[4]); + double pe = LIBC_NAMESPACE::fputil::polyeval( + x * x, 0.0, ATAN_K[1], ATAN_K[2], ATAN_K[3], ATAN_K[4]); return fputil::multiply_add(pe, x, x); } if (x_abs >= umax) { double one_over_x_m = -1.0 / x; double one_over_x2 = one_over_x_m * one_over_x_m; - double pe = __llvm_libc::fputil::polyeval(one_over_x2, ATAN_K[0], ATAN_K[1], - ATAN_K[2], ATAN_K[3]); + double pe = LIBC_NAMESPACE::fputil::polyeval( + one_over_x2, ATAN_K[0], ATAN_K[1], ATAN_K[2], ATAN_K[3]); return fputil::multiply_add(pe, one_over_x_m, sign ? (-M_MATH_PI_2) : (M_MATH_PI_2)); } @@ -79,8 +79,8 @@ LIBC_INLINE double atan_eval(double x) { double v = (pos_x - near_x) / fputil::multiply_add(near_x, pos_x, 1.0); double v2 = v * v; - double pe = __llvm_libc::fputil::polyeval(v2, ATAN_K[0], ATAN_K[1], ATAN_K[2], - ATAN_K[3], ATAN_K[4]); + double pe = LIBC_NAMESPACE::fputil::polyeval(v2, ATAN_K[0], ATAN_K[1], + ATAN_K[2], ATAN_K[3], ATAN_K[4]); double result; if (one_over_x) result = M_MATH_PI_2 - fputil::multiply_add(pe, v, ATAN_T[val - 1]); @@ -107,6 +107,6 @@ LIBC_INLINE double asin_eval(double xsq) { return fputil::multiply_add(xsq, r2, r1); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_MATH_GENERIC_INV_TRIGF_UTILS_H diff --git a/libc/src/math/generic/ldexp.cpp b/libc/src/math/generic/ldexp.cpp index 775aa7b..18aae09 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 24450cc..37f88ab 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 df146cb..8b29009 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 66097f8..87755e8 100644 --- a/libc/src/math/generic/llrint.cpp +++ b/libc/src/math/generic/llrint.cpp @@ -10,7 +10,7 @@ #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(long long, llrint, (double x)) { return fputil::round_to_signed_integer_using_current_rounding_mode<double, @@ -18,4 +18,4 @@ LLVM_LIBC_FUNCTION(long long, llrint, (double x)) { x); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/llrintf.cpp b/libc/src/math/generic/llrintf.cpp index a4ae572..836e7cb 100644 --- a/libc/src/math/generic/llrintf.cpp +++ b/libc/src/math/generic/llrintf.cpp @@ -10,7 +10,7 @@ #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(long long, llrintf, (float x)) { return fputil::round_to_signed_integer_using_current_rounding_mode<float, @@ -18,4 +18,4 @@ LLVM_LIBC_FUNCTION(long long, llrintf, (float x)) { x); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/llrintl.cpp b/libc/src/math/generic/llrintl.cpp index 9d02b74..104e3d4 100644 --- a/libc/src/math/generic/llrintl.cpp +++ b/libc/src/math/generic/llrintl.cpp @@ -10,11 +10,11 @@ #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(long long, llrintl, (long double x)) { return fputil::round_to_signed_integer_using_current_rounding_mode< long double, long long>(x); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/llround.cpp b/libc/src/math/generic/llround.cpp index b3dfd2f..41bee85 100644 --- a/libc/src/math/generic/llround.cpp +++ b/libc/src/math/generic/llround.cpp @@ -10,10 +10,10 @@ #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(long long, llround, (double x)) { return fputil::round_to_signed_integer<double, long long>(x); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/llroundf.cpp b/libc/src/math/generic/llroundf.cpp index 8784b0c..67105e8 100644 --- a/libc/src/math/generic/llroundf.cpp +++ b/libc/src/math/generic/llroundf.cpp @@ -10,10 +10,10 @@ #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(long long, llroundf, (float x)) { return fputil::round_to_signed_integer<float, long long>(x); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/llroundl.cpp b/libc/src/math/generic/llroundl.cpp index 30dec14..98cfb36 100644 --- a/libc/src/math/generic/llroundl.cpp +++ b/libc/src/math/generic/llroundl.cpp @@ -10,10 +10,10 @@ #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(long long, llroundl, (long double x)) { return fputil::round_to_signed_integer<long double, long long>(x); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/log.cpp b/libc/src/math/generic/log.cpp index 54fe970..46b64df 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 b68ed5c..38789ac 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 812850a..bc9af75 100644 --- a/libc/src/math/generic/log10f.cpp +++ b/libc/src/math/generic/log10f.cpp @@ -54,7 +54,7 @@ // Dept. of Comp. Sci., Rutgets U., Technical Report DCS-TR-758, Nov. 2021. // https://arxiv.org/pdf/2111.12852.pdf. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Lookup table for -log10(r) where r is defined in common_constants.cpp. static constexpr double LOG10_R[128] = { @@ -213,4 +213,4 @@ LLVM_LIBC_FUNCTION(float, log10f, (float x)) { return static_cast<float>(r); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/log1p.cpp b/libc/src/math/generic/log1p.cpp index 26e314c..c6ee8d8 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 a7ca548..d479130 100644 --- a/libc/src/math/generic/log1pf.cpp +++ b/libc/src/math/generic/log1pf.cpp @@ -30,7 +30,7 @@ // generated with Sollya using the following command: // fpminimax(log(1 + x)/x, 7, [|D...|], [-2^-6; 2^-6]); -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { @@ -153,4 +153,4 @@ LLVM_LIBC_FUNCTION(float, log1pf, (float x)) { return static_cast<float>(r); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/log2.cpp b/libc/src/math/generic/log2.cpp index 7ba239b..d72b093 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 c48b8c9..cbb71fb 100644 --- a/libc/src/math/generic/log2f.cpp +++ b/libc/src/math/generic/log2f.cpp @@ -51,7 +51,7 @@ // Dept. of Comp. Sci., Rutgets U., Technical Report DCS-TR-758, Nov. 2021. // https://arxiv.org/pdf/2111.12852.pdf. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Lookup table for log2(f) = log2(1 + n*2^(-7)) where n = 0..127. static constexpr double LOG2_R[128] = { @@ -164,4 +164,4 @@ LLVM_LIBC_FUNCTION(float, log2f, (float x)) { return static_cast<float>(r); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/log_range_reduction.h b/libc/src/math/generic/log_range_reduction.h index c4dd649..f04012c 100644 --- a/libc/src/math/generic/log_range_reduction.h +++ b/libc/src/math/generic/log_range_reduction.h @@ -13,7 +13,7 @@ #include "src/__support/FPUtil/dyadic_float.h" #include "src/__support/UInt128.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Struct to store -log*(r) for 4 range reduction steps. struct LogRR { @@ -87,6 +87,6 @@ log_range_reduction(double m_x, const LogRR &log_table, static_cast<uint64_t>(vv4 >> 64)})); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_MATH_GENERIC_LOG_RANGE_REDUCTION_H diff --git a/libc/src/math/generic/logb.cpp b/libc/src/math/generic/logb.cpp index eef428a..8cd6edc 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 1b1241b..78aa33e 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 7f4dc08..f18c372 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 73634e0..1f689f2 100644 --- a/libc/src/math/generic/logf.cpp +++ b/libc/src/math/generic/logf.cpp @@ -49,7 +49,7 @@ // USA, January 16-22, 2022. // https://people.cs.rutgers.edu/~sn349/papers/rlibmall-popl-2022.pdf -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(float, logf, (float x)) { constexpr double LOG_2 = 0x1.62e42fefa39efp-1; @@ -169,4 +169,4 @@ LLVM_LIBC_FUNCTION(float, logf, (float x)) { return static_cast<float>(r); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/lrint.cpp b/libc/src/math/generic/lrint.cpp index 162fa03..59fde7b 100644 --- a/libc/src/math/generic/lrint.cpp +++ b/libc/src/math/generic/lrint.cpp @@ -10,11 +10,11 @@ #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(long, lrint, (double x)) { return fputil::round_to_signed_integer_using_current_rounding_mode<double, long>(x); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/lrintf.cpp b/libc/src/math/generic/lrintf.cpp index 6444ecc..e92014c 100644 --- a/libc/src/math/generic/lrintf.cpp +++ b/libc/src/math/generic/lrintf.cpp @@ -10,11 +10,11 @@ #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(long, lrintf, (float x)) { return fputil::round_to_signed_integer_using_current_rounding_mode<float, long>(x); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/lrintl.cpp b/libc/src/math/generic/lrintl.cpp index 3fcd97c..b363aac 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 413c06f..a22d872 100644 --- a/libc/src/math/generic/lround.cpp +++ b/libc/src/math/generic/lround.cpp @@ -10,10 +10,10 @@ #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(long, lround, (double x)) { return fputil::round_to_signed_integer<double, long>(x); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/lroundf.cpp b/libc/src/math/generic/lroundf.cpp index 919ae35..40c1323 100644 --- a/libc/src/math/generic/lroundf.cpp +++ b/libc/src/math/generic/lroundf.cpp @@ -10,10 +10,10 @@ #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(long, lroundf, (float x)) { return fputil::round_to_signed_integer<float, long>(x); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/lroundl.cpp b/libc/src/math/generic/lroundl.cpp index 9ffa36e..c0c3bde 100644 --- a/libc/src/math/generic/lroundl.cpp +++ b/libc/src/math/generic/lroundl.cpp @@ -10,10 +10,10 @@ #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(long, lroundl, (long double x)) { return fputil::round_to_signed_integer<long double, long>(x); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/math_utils.cpp b/libc/src/math/generic/math_utils.cpp index cc922f7..14bbb2b 100644 --- a/libc/src/math/generic/math_utils.cpp +++ b/libc/src/math/generic/math_utils.cpp @@ -8,7 +8,7 @@ #include "math_utils.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { constexpr float XFlowValues<float>::OVERFLOW_VALUE = 0x1p97f; constexpr float XFlowValues<float>::UNDERFLOW_VALUE = 0x1p-95f; @@ -18,4 +18,4 @@ constexpr double XFlowValues<double>::OVERFLOW_VALUE = 0x1p769; constexpr double XFlowValues<double>::UNDERFLOW_VALUE = 0x1p-767; constexpr double XFlowValues<double>::MAY_UNDERFLOW_VALUE = 0x1.8p-538; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/math_utils.h b/libc/src/math/generic/math_utils.h index f286c9c..38a14a4 100644 --- a/libc/src/math/generic/math_utils.h +++ b/libc/src/math/generic/math_utils.h @@ -18,7 +18,7 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE uint32_t as_uint32_bits(float x) { return cpp::bit_cast<uint32_t>(x); @@ -102,6 +102,6 @@ LIBC_INLINE constexpr float invalid(T x) { return isnan(x) ? y : with_errno(y, EDOM); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_MATH_GENERIC_MATH_UTILS_H diff --git a/libc/src/math/generic/modf.cpp b/libc/src/math/generic/modf.cpp index 2c4f051..d465d19 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 a979cff..daa6697 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 535c319..3271da2 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 b1becee..20cbf6c 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 1b0c2cc0..5fb1033 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 75eb49e..9cbff01 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 3566cd6b..57a58b1 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 07dabdc..dd09fb7 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 6e5c369..e12ad04 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 f620bcd..551f245 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 79c076d..13a7360 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 149f458..3703a32 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 9de40b2..5e8c5e9 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 1360ae7..def5d4b 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 905547c..bd88742 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 d4232db..b59606f 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 3756a05..7a08af3 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 9427b6f..e3189ea 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 8c2e9c9..259a46f 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 493d825..5110f23 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 b7366f7..ca8f19f 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 bcdd61e..9627390 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 6c59c27..c734225 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 faccf6c..3908f58 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 391da1f..4a4fa86 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 9ef6f230..681338ec 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 1611567..7ed1c43 100644 --- a/libc/src/math/generic/sincosf.cpp +++ b/libc/src/math/generic/sincosf.cpp @@ -18,7 +18,7 @@ #include <errno.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Exceptional values static constexpr int N_EXCEPTS = 6; @@ -200,4 +200,4 @@ LLVM_LIBC_FUNCTION(void, sincosf, (float x, float *sinp, float *cosp)) { sin_y, -sin_k, fputil::multiply_add(cosm1_y, cos_k, cos_k))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/sincosf_utils.h b/libc/src/math/generic/sincosf_utils.h index 2488f50..904df4f 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 01d2f70..6fc1abb 100644 --- a/libc/src/math/generic/sinf.cpp +++ b/libc/src/math/generic/sinf.cpp @@ -26,7 +26,7 @@ #include "range_reduction.h" #endif -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(float, sinf, (float x)) { using FPBits = typename fputil::FPBits<float>; @@ -155,4 +155,4 @@ LLVM_LIBC_FUNCTION(float, sinf, (float x)) { sin_y, cos_k, fputil::multiply_add(cosm1_y, sin_k, sin_k))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/sinhf.cpp b/libc/src/math/generic/sinhf.cpp index 3ebfe6b..4917b99 100644 --- a/libc/src/math/generic/sinhf.cpp +++ b/libc/src/math/generic/sinhf.cpp @@ -12,7 +12,7 @@ #include "src/__support/macros/optimization.h" // LIBC_UNLIKELY #include "src/math/generic/explogxf.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(float, sinhf, (float x)) { using FPBits = typename fputil::FPBits<float>; @@ -74,4 +74,4 @@ LLVM_LIBC_FUNCTION(float, sinhf, (float x)) { return static_cast<float>(exp_pm_eval</*is_sinh*/ true>(x)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/sqrt.cpp b/libc/src/math/generic/sqrt.cpp index de21f32..b4d0278 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 3ca8d38..bc74252 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 970646a..b2aaa27 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 681f161..7909e9e 100644 --- a/libc/src/math/generic/tanf.cpp +++ b/libc/src/math/generic/tanf.cpp @@ -20,7 +20,7 @@ #include <errno.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Exceptional cases for tanf. constexpr size_t N_EXCEPTS = 6; @@ -139,4 +139,4 @@ LLVM_LIBC_FUNCTION(float, tanf, (float x)) { multiply_add(sin_y, -sin_k, multiply_add(cosm1_y, cos_k, cos_k))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/tanhf.cpp b/libc/src/math/generic/tanhf.cpp index 1620e37..7d9f86c 100644 --- a/libc/src/math/generic/tanhf.cpp +++ b/libc/src/math/generic/tanhf.cpp @@ -15,7 +15,7 @@ #include "src/__support/macros/properties/cpu_features.h" #include "src/math/generic/explogxf.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // 2^6 * log2(e) constexpr double LOG2_E_EXP2_6 = ExpBase::LOG2_B * 2.0; @@ -118,4 +118,4 @@ LLVM_LIBC_FUNCTION(float, tanhf, (float x)) { return static_cast<float>((r - mh) / (r + mh)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/trunc.cpp b/libc/src/math/generic/trunc.cpp index 50220d9..d171ab1 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 dc11d5e..93bfb7f 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 df5fc03..3429129 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 1e84f7a..ad1407d 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 4979116..c4fc58d 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 b09c3e6..6f804bd 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 fe3f451..4d7e132 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 d8b0a54..c0d063d 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 64d7058e..398ffd0 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 850c4ee..eada89c 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 22c8b73..a5611c5 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 f3803af..41a6ddf 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 48b52a8..c948e32 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 f3c255f..a2c3537 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 f540b4c..67178b3e 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 d6e9859..7303adc 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 67b1862..bbf0c67 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 2ae5142..0654cdd 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 ad1db49..b689046 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 b6b06da..07dbbd6 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 b89c9c3..ad35f90 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 35a4a8d..9c7b600 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 e732b7c..7fbe9f4 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 af06432..89b235f 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 b0f9c8f..9fee6f8 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 e21b469..44d494a 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 5e82837..daf98d9 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 ab840ba..9d8b558 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 32d54b8..8743e4e 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 2946e47..054e046 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 729f3bb..ed69dff 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 fe814c7..60ca5af 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 a712e45..e17f942 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 81f04a2..d02b106 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 32af4449..da7bd54 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 c587258..778e883 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 dd97af9..be666fd 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 b470824..773600f 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 352733d..534797a 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 7ae0811..ac62976 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 fa0dd58..a0384f8 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 7755174..280ae49 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 7219d5a..b07c079 100644 --- a/libc/src/math/gpu/vendor/amdgpu/declarations.h +++ b/libc/src/math/gpu/vendor/amdgpu/declarations.h @@ -11,7 +11,7 @@ #include "src/__support/GPU/utils.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { extern "C" { float __ocml_acos_f32(float); @@ -58,6 +58,6 @@ float __ocml_remquo_f32(float, float, gpu::Private<int> *); double __ocml_remquo_f64(double, double, gpu::Private<int> *); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_MATH_GPU_AMDGPU_DECLARATIONS_H diff --git a/libc/src/math/gpu/vendor/amdgpu/platform.h b/libc/src/math/gpu/vendor/amdgpu/platform.h index 6ec47c2..480a46b 100644 --- a/libc/src/math/gpu/vendor/amdgpu/platform.h +++ b/libc/src/math/gpu/vendor/amdgpu/platform.h @@ -11,7 +11,7 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // The ROCm device library uses control globals to alter codegen for the // different targets. To avoid needing to link them in manually we simply @@ -109,6 +109,6 @@ extern const uint32_t __oclc_ISA_version = 11501; #endif } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_MATH_GPU_AMDGPU_PLATFORM_H diff --git a/libc/src/math/gpu/vendor/asinf.cpp b/libc/src/math/gpu/vendor/asinf.cpp index 9a9ffb2..595a48f 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 7d1d7e8..78e5543 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 7193d8c..132c43d 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 b044a73..521c413 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 a3e2d65..37c7507 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 3ce8fa6..1bd42ba 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 3dc5c2b..3be05e5 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 c2933ec..1b945bb 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 05b7535..8448093 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 818c380..cb61557 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 e243385..89c194e 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 062e4a7..c549779 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 b06787c..f30dafb 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 a675d48..e307362 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 4bd47fa2..5fc2c14 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 c6d3980..e928d37 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 5bac6fc..45b629e 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 34ce290..533e9dc 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 ea41099..1d07502 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 e15f4e1..8dc2ff0 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 d9988fa..f760a42 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 bdd40a6..d00d391 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 064d277..aafd160 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 d1befb6..39cd3ad 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 51b8370..e53701b 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 0131d27..ddb5ec0 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 9e8e57e..f88e17f 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 9780471..7a39dc8 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 8b67028..003a9a8 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 6ea1743..4298d56 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 7945bc0..d49f261 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 2fd2dcd..37e02d2 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 755efea..e92c9b3 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 c2be2cd8..b234885 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 44aa286..435533a 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 6d02f86..0a4844c 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 4eda066..96e07c9 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 589d65f..d882157 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 bf3593b..17892ce 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 4be642c..af93227 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 c65cb55..be6b3ae 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 4d1fcbb..99c399b 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 16587dc2..9a1bd9c 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 99b3363..a5266a8 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 de38d15..57d764f 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 a673a49..1c9c2f3 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 6c901ee..981473f 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 084fd7f..1d290b4 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 9667207..e851a6a 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 1afb76a..edea346 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 4d1cc19..1b4782f3 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 74f9a60..7a8bcc3 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 f30d601..c06b487 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 3ee9c04..f2df0c8 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 96bd7b8..69c881e 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 eecf380..023e84a 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 94dfba7..4dbcc60 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 5b2b7fc..265b4fd 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 65faad1..2141ca9 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 f859485..9cb4251 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 eff98b4..67f5d7f 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 d866941..3d8249a 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 d544ab5..ca3eadc 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 0f25ce61..48eb9ca 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 ea00377..854f76f 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 f55ffed..49f0549 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 94d2c54..04b7743 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 b875dcd..e24dd43 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 46dcd3c..e8d5018 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 3630e52..bc32993 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 1955801..b69be46 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 62df79a..e40f860 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 af51594..93b2c8c 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 812acec..c17901d 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 8c555e8..4a67cc9 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 3d318a7..9d4f4e8 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 a8b5aff..86673dc 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 1dc732f..91453a0 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 21457e0..85bf2aa 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 ff89239..5ea2c6d 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 957a06b..df292a2 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 3793f6b..3860dc0 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 7029e86a..e22cae6 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 1f6d24d..fc4c9eb 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 8afac0e..de7870d 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 9128778..1b94e24 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 26fed17..dd9b4a6 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 ec2d67b..6582dc3 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 8a720fc..f1f8954 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 19a16d0..31a9bbe 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 f283763..584af37 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 cb753fe..7590e7d 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 feb2e4f..8b8e877 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 d1b0e20..ba9b099 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 e4910ad..3cd676b 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 0091ba3..d0246a32 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 2bf095d..bddfa18 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 bb09ea4..3e6a3b3 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 6bab35a..d6ca186 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 43fb63e..0abe87a 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 e24f29e..9fc1dc4d 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 f5316ee..6b5a5f9 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 6839a75..876f147 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 f3919c4..50ecdc7 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 47ef983..56539f5 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 e63db04..aa0b753 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 2784ca2..bf1b1f1 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 843ecec..65cb39f 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 2390e07..d003e3f 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 d1d06f3..fe4192a 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 5fbfa14..e632c19 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 05366db..5d0121f 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 7a9fa01..e0f06a8 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 5400c3d..66561ee 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 ec5ba80..ff9d02e 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 f7fed01..d766aff 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 b4f1cd7..e666d77 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 2a78ffa..38f414f 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 1d2480e..2cb8db4 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 bda4acb..2c7b8aa 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 f25ff77..bc0e0fc 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 983fcadd..862d5e3 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 eab5648..c7743df 100644 --- a/libc/src/network/htonl.h +++ b/libc/src/network/htonl.h @@ -11,10 +11,10 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { uint32_t htonl(uint32_t hostlong); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_NETWORK_HTONL_H diff --git a/libc/src/network/htons.cpp b/libc/src/network/htons.cpp index 1d2c6bf..e844454 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 a3abaf6..e0a379f 100644 --- a/libc/src/network/htons.h +++ b/libc/src/network/htons.h @@ -11,10 +11,10 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { uint16_t htons(uint16_t hostshort); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_NETWORK_HTONS_H diff --git a/libc/src/network/ntohl.cpp b/libc/src/network/ntohl.cpp index c525f72..c00f4a5 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 bec626f..2fc4ef0 100644 --- a/libc/src/network/ntohl.h +++ b/libc/src/network/ntohl.h @@ -11,10 +11,10 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { uint32_t ntohl(uint32_t netlong); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_NETWORK_NTOHL_H diff --git a/libc/src/network/ntohs.cpp b/libc/src/network/ntohs.cpp index 8556b3e..572b686 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 b10aaa9..a84c52ee 100644 --- a/libc/src/network/ntohs.h +++ b/libc/src/network/ntohs.h @@ -11,10 +11,10 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { uint16_t ntohs(uint16_t netshort); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_NETWORK_NTOHS_H diff --git a/libc/src/pthread/pthread_atfork.cpp b/libc/src/pthread/pthread_atfork.cpp index 7136bf3..57191b8 100644 --- a/libc/src/pthread/pthread_atfork.cpp +++ b/libc/src/pthread/pthread_atfork.cpp @@ -14,7 +14,7 @@ #include <errno.h> #include <pthread.h> // For pthread_* type definitions. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_atfork, (__atfork_callback_t prepare, __atfork_callback_t parent, @@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(int, pthread_atfork, return register_atfork_callbacks(prepare, parent, child) ? 0 : ENOMEM; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_atfork.h b/libc/src/pthread/pthread_atfork.h index bd8bc8a..8b89d68 100644 --- a/libc/src/pthread/pthread_atfork.h +++ b/libc/src/pthread/pthread_atfork.h @@ -11,11 +11,11 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_atfork(__atfork_callback_t prepare, __atfork_callback_t parent, __atfork_callback_t child); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATFORK_H diff --git a/libc/src/pthread/pthread_attr_destroy.cpp b/libc/src/pthread/pthread_attr_destroy.cpp index f51b056..a5bde84 100644 --- a/libc/src/pthread/pthread_attr_destroy.cpp +++ b/libc/src/pthread/pthread_attr_destroy.cpp @@ -12,11 +12,11 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_attr_destroy, (pthread_attr_t *)) { // There is nothing to cleanup. return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_attr_destroy.h b/libc/src/pthread/pthread_attr_destroy.h index 5d01bc8..532a0f4 100644 --- a/libc/src/pthread/pthread_attr_destroy.h +++ b/libc/src/pthread/pthread_attr_destroy.h @@ -11,10 +11,10 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_attr_destroy(pthread_attr_t *attr); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATTR_DESTROY_H diff --git a/libc/src/pthread/pthread_attr_getdetachstate.cpp b/libc/src/pthread/pthread_attr_getdetachstate.cpp index 18f4637..4bff85d 100644 --- a/libc/src/pthread/pthread_attr_getdetachstate.cpp +++ b/libc/src/pthread/pthread_attr_getdetachstate.cpp @@ -12,7 +12,7 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_attr_getdetachstate, (const pthread_attr_t *attr, int *detachstate)) { @@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(int, pthread_attr_getdetachstate, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_attr_getdetachstate.h b/libc/src/pthread/pthread_attr_getdetachstate.h index fd5ee886d..57a47b7 100644 --- a/libc/src/pthread/pthread_attr_getdetachstate.h +++ b/libc/src/pthread/pthread_attr_getdetachstate.h @@ -11,10 +11,10 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detach_state); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATTR_GETDETACHSTATE_H diff --git a/libc/src/pthread/pthread_attr_getguardsize.cpp b/libc/src/pthread/pthread_attr_getguardsize.cpp index 79d80fe..8f28db8 100644 --- a/libc/src/pthread/pthread_attr_getguardsize.cpp +++ b/libc/src/pthread/pthread_attr_getguardsize.cpp @@ -12,7 +12,7 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_attr_getguardsize, (const pthread_attr_t *__restrict attr, @@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(int, pthread_attr_getguardsize, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_attr_getguardsize.h b/libc/src/pthread/pthread_attr_getguardsize.h index 61072b93..ef2e758 100644 --- a/libc/src/pthread/pthread_attr_getguardsize.h +++ b/libc/src/pthread/pthread_attr_getguardsize.h @@ -11,11 +11,11 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_attr_getguardsize(const pthread_attr_t *__restrict attr, size_t *__restrict guardsize); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATTR_GETGUARDSIZE_H diff --git a/libc/src/pthread/pthread_attr_getstack.cpp b/libc/src/pthread/pthread_attr_getstack.cpp index 564b8fd..8788fbc 100644 --- a/libc/src/pthread/pthread_attr_getstack.cpp +++ b/libc/src/pthread/pthread_attr_getstack.cpp @@ -14,17 +14,17 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_attr_getstack, (const pthread_attr_t *__restrict attr, void **__restrict stack, size_t *__restrict stacksize)) { // As of writing this `pthread_attr_getstacksize` can never fail. - int result = __llvm_libc::pthread_attr_getstacksize(attr, stacksize); + int result = LIBC_NAMESPACE::pthread_attr_getstacksize(attr, stacksize); if (LIBC_UNLIKELY(result != 0)) return result; *stack = attr->__stack; return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_attr_getstack.h b/libc/src/pthread/pthread_attr_getstack.h index d016473..22ac24a 100644 --- a/libc/src/pthread/pthread_attr_getstack.h +++ b/libc/src/pthread/pthread_attr_getstack.h @@ -11,12 +11,12 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_attr_getstack(const pthread_attr_t *__restrict attr, void **__restrict stack, size_t *__restrict stacksize); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATTR_GETSTACK_H diff --git a/libc/src/pthread/pthread_attr_getstacksize.cpp b/libc/src/pthread/pthread_attr_getstacksize.cpp index 2b33d6f..ecc4787 100644 --- a/libc/src/pthread/pthread_attr_getstacksize.cpp +++ b/libc/src/pthread/pthread_attr_getstacksize.cpp @@ -12,7 +12,7 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_attr_getstacksize, (const pthread_attr_t *__restrict attr, @@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(int, pthread_attr_getstacksize, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_attr_getstacksize.h b/libc/src/pthread/pthread_attr_getstacksize.h index cb27a5e..3136f08 100644 --- a/libc/src/pthread/pthread_attr_getstacksize.h +++ b/libc/src/pthread/pthread_attr_getstacksize.h @@ -11,11 +11,11 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_attr_getstacksize(const pthread_attr_t *__restrict attr, size_t *__restrict stacksize); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATTR_GETSTACKSIZE_H diff --git a/libc/src/pthread/pthread_attr_init.cpp b/libc/src/pthread/pthread_attr_init.cpp index 32e54ef..13d302c 100644 --- a/libc/src/pthread/pthread_attr_init.cpp +++ b/libc/src/pthread/pthread_attr_init.cpp @@ -13,7 +13,7 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_attr_init, (pthread_attr_t * attr)) { *attr = pthread_attr_t{ @@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, pthread_attr_init, (pthread_attr_t * attr)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_attr_init.h b/libc/src/pthread/pthread_attr_init.h index 609e653..3a2ad3d 100644 --- a/libc/src/pthread/pthread_attr_init.h +++ b/libc/src/pthread/pthread_attr_init.h @@ -11,10 +11,10 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_attr_init(pthread_attr_t *attr); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATTR_INIT_H diff --git a/libc/src/pthread/pthread_attr_setdetachstate.cpp b/libc/src/pthread/pthread_attr_setdetachstate.cpp index e136538..029b4d5 100644 --- a/libc/src/pthread/pthread_attr_setdetachstate.cpp +++ b/libc/src/pthread/pthread_attr_setdetachstate.cpp @@ -13,7 +13,7 @@ #include <errno.h> #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_attr_setdetachstate, (pthread_attr_t * attr, int detachstate)) { @@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, pthread_attr_setdetachstate, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_attr_setdetachstate.h b/libc/src/pthread/pthread_attr_setdetachstate.h index a8f5866..2b994d9 100644 --- a/libc/src/pthread/pthread_attr_setdetachstate.h +++ b/libc/src/pthread/pthread_attr_setdetachstate.h @@ -11,10 +11,10 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_attr_setdetachstate(pthread_attr_t *attr, int detach_state); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATTR_SETDETACHSTATE_H diff --git a/libc/src/pthread/pthread_attr_setguardsize.cpp b/libc/src/pthread/pthread_attr_setguardsize.cpp index dd2584a..98855b2 100644 --- a/libc/src/pthread/pthread_attr_setguardsize.cpp +++ b/libc/src/pthread/pthread_attr_setguardsize.cpp @@ -14,7 +14,7 @@ #include <linux/param.h> // For EXEC_PAGESIZE. #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_attr_setguardsize, (pthread_attr_t *__restrict attr, size_t guardsize)) { @@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, pthread_attr_setguardsize, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_attr_setguardsize.h b/libc/src/pthread/pthread_attr_setguardsize.h index d9e1598..64d896a 100644 --- a/libc/src/pthread/pthread_attr_setguardsize.h +++ b/libc/src/pthread/pthread_attr_setguardsize.h @@ -11,10 +11,10 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_attr_setguardsize(pthread_attr_t *attr, size_t guardsize); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATTR_SETGUARDSIZE_H diff --git a/libc/src/pthread/pthread_attr_setstack.cpp b/libc/src/pthread/pthread_attr_setstack.cpp index a16196a..dde4e3f 100644 --- a/libc/src/pthread/pthread_attr_setstack.cpp +++ b/libc/src/pthread/pthread_attr_setstack.cpp @@ -16,7 +16,7 @@ #include <pthread.h> #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_attr_setstack, (pthread_attr_t *__restrict attr, void *stack, @@ -35,4 +35,4 @@ LLVM_LIBC_FUNCTION(int, pthread_attr_setstack, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_attr_setstack.h b/libc/src/pthread/pthread_attr_setstack.h index 44ee2c9..fe2a7f4 100644 --- a/libc/src/pthread/pthread_attr_setstack.h +++ b/libc/src/pthread/pthread_attr_setstack.h @@ -11,10 +11,10 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_attr_setstack(pthread_attr_t *attr, void *stack, size_t stacksize); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATTR_SETSTACK_H diff --git a/libc/src/pthread/pthread_attr_setstacksize.cpp b/libc/src/pthread/pthread_attr_setstacksize.cpp index b23a7ce..642a888 100644 --- a/libc/src/pthread/pthread_attr_setstacksize.cpp +++ b/libc/src/pthread/pthread_attr_setstacksize.cpp @@ -13,7 +13,7 @@ #include <errno.h> #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_attr_setstacksize, (pthread_attr_t *__restrict attr, size_t stacksize)) { @@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, pthread_attr_setstacksize, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_attr_setstacksize.h b/libc/src/pthread/pthread_attr_setstacksize.h index 40ee5c0..f594094 100644 --- a/libc/src/pthread/pthread_attr_setstacksize.h +++ b/libc/src/pthread/pthread_attr_setstacksize.h @@ -11,10 +11,10 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATTR_SETSTACKSIZE_H diff --git a/libc/src/pthread/pthread_create.cpp b/libc/src/pthread/pthread_create.cpp index 9eebb80..8b406cd 100644 --- a/libc/src/pthread/pthread_create.cpp +++ b/libc/src/pthread/pthread_create.cpp @@ -22,9 +22,9 @@ #include <errno.h> #include <pthread.h> // For pthread_* type definitions. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -static_assert(sizeof(pthread_t) == sizeof(__llvm_libc::Thread), +static_assert(sizeof(pthread_t) == sizeof(LIBC_NAMESPACE::Thread), "Mismatch between pthread_t and internal Thread."); LLVM_LIBC_FUNCTION(int, pthread_create, @@ -34,7 +34,7 @@ LLVM_LIBC_FUNCTION(int, pthread_create, pthread_attr_t default_attr; if (attr == nullptr) { // We failed to initialize attributes (should be impossible) - if (LIBC_UNLIKELY(__llvm_libc::pthread_attr_init(&default_attr) != 0)) + if (LIBC_UNLIKELY(LIBC_NAMESPACE::pthread_attr_init(&default_attr) != 0)) return EINVAL; attr = &default_attr; @@ -46,21 +46,21 @@ LLVM_LIBC_FUNCTION(int, pthread_create, // As of writing this all the `pthread_attr_get*` functions always succeed. if (LIBC_UNLIKELY( - __llvm_libc::pthread_attr_getstack(attr, &stack, &stacksize) != 0)) + LIBC_NAMESPACE::pthread_attr_getstack(attr, &stack, &stacksize) != 0)) return EINVAL; - if (LIBC_UNLIKELY(__llvm_libc::pthread_attr_getguardsize(attr, &guardsize) != - 0)) + if (LIBC_UNLIKELY( + LIBC_NAMESPACE::pthread_attr_getguardsize(attr, &guardsize) != 0)) return EINVAL; if (LIBC_UNLIKELY( - __llvm_libc::pthread_attr_getdetachstate(attr, &detachstate) != 0)) + LIBC_NAMESPACE::pthread_attr_getdetachstate(attr, &detachstate) != 0)) return EINVAL; if (attr == &default_attr) // Should we fail here? Its non-issue as the moment as pthread_attr_destroy // can only succeed. - if (LIBC_UNLIKELY(__llvm_libc::pthread_attr_destroy(&default_attr) != 0)) + if (LIBC_UNLIKELY(LIBC_NAMESPACE::pthread_attr_destroy(&default_attr) != 0)) return EINVAL; if (stacksize && stacksize < PTHREAD_STACK_MIN) @@ -76,7 +76,7 @@ LLVM_LIBC_FUNCTION(int, pthread_create, // Thread::run will check validity of the `stack` argument (stack alignment is // universal, not sure a pthread requirement). - auto *thread = reinterpret_cast<__llvm_libc::Thread *>(th); + auto *thread = reinterpret_cast<LIBC_NAMESPACE::Thread *>(th); int result = thread->run(func, arg, stack, stacksize, guardsize, detachstate == PTHREAD_CREATE_DETACHED); if (result != 0 && result != EPERM && result != EINVAL) @@ -84,4 +84,4 @@ LLVM_LIBC_FUNCTION(int, pthread_create, return result; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_create.h b/libc/src/pthread/pthread_create.h index 6df6c95..75466e3 100644 --- a/libc/src/pthread/pthread_create.h +++ b/libc/src/pthread/pthread_create.h @@ -11,12 +11,12 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_create(pthread_t *__restrict thread, const pthread_attr_t *__restrict attr, __pthread_start_t func, void *arg); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_CREATE_H diff --git a/libc/src/pthread/pthread_detach.cpp b/libc/src/pthread/pthread_detach.cpp index 009438e..e8b69b6 100644 --- a/libc/src/pthread/pthread_detach.cpp +++ b/libc/src/pthread/pthread_detach.cpp @@ -13,9 +13,9 @@ #include <pthread.h> // For pthread_* type definitions. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -static_assert(sizeof(pthread_t) == sizeof(__llvm_libc::Thread), +static_assert(sizeof(pthread_t) == sizeof(LIBC_NAMESPACE::Thread), "Mismatch between pthread_t and internal Thread."); LLVM_LIBC_FUNCTION(int, pthread_detach, (pthread_t th)) { @@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, pthread_detach, (pthread_t th)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_detach.h b/libc/src/pthread/pthread_detach.h index 5beab40..d54fdf8 100644 --- a/libc/src/pthread/pthread_detach.h +++ b/libc/src/pthread/pthread_detach.h @@ -11,10 +11,10 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_detach(pthread_t thread); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_DETACH_H diff --git a/libc/src/pthread/pthread_equal.cpp b/libc/src/pthread/pthread_equal.cpp index 2946020..f154e9b 100644 --- a/libc/src/pthread/pthread_equal.cpp +++ b/libc/src/pthread/pthread_equal.cpp @@ -13,9 +13,9 @@ #include <pthread.h> // For pthread_* type definitions. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -static_assert(sizeof(pthread_t) == sizeof(__llvm_libc::Thread), +static_assert(sizeof(pthread_t) == sizeof(LIBC_NAMESPACE::Thread), "Mismatch between pthread_t and internal Thread."); LLVM_LIBC_FUNCTION(int, pthread_equal, (pthread_t lhs, pthread_t rhs)) { @@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, pthread_equal, (pthread_t lhs, pthread_t rhs)) { return *lhs_internal == *rhs_internal; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_equal.h b/libc/src/pthread/pthread_equal.h index aa5dfed..448fb8f 100644 --- a/libc/src/pthread/pthread_equal.h +++ b/libc/src/pthread/pthread_equal.h @@ -11,10 +11,10 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_equal(pthread_t lhs, pthread_t rhs); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_EQUAL_H diff --git a/libc/src/pthread/pthread_exit.cpp b/libc/src/pthread/pthread_exit.cpp index 1d1a737..acba665 100644 --- a/libc/src/pthread/pthread_exit.cpp +++ b/libc/src/pthread/pthread_exit.cpp @@ -13,13 +13,13 @@ #include <pthread.h> // For pthread_* type definitions. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -static_assert(sizeof(pthread_t) == sizeof(__llvm_libc::Thread), +static_assert(sizeof(pthread_t) == sizeof(LIBC_NAMESPACE::Thread), "Mismatch between pthread_t and internal Thread."); LLVM_LIBC_FUNCTION(void, pthread_exit, (void *retval)) { - __llvm_libc::thread_exit(ThreadReturnValue(retval), ThreadStyle::POSIX); + LIBC_NAMESPACE::thread_exit(ThreadReturnValue(retval), ThreadStyle::POSIX); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_exit.h b/libc/src/pthread/pthread_exit.h index 40051d7..6617dab 100644 --- a/libc/src/pthread/pthread_exit.h +++ b/libc/src/pthread/pthread_exit.h @@ -11,10 +11,10 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { [[noreturn]] void pthread_exit(void *retval); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_EXIT_H diff --git a/libc/src/pthread/pthread_getname_np.cpp b/libc/src/pthread/pthread_getname_np.cpp index e1c3549..3de8c2e 100644 --- a/libc/src/pthread/pthread_getname_np.cpp +++ b/libc/src/pthread/pthread_getname_np.cpp @@ -16,17 +16,17 @@ #include <pthread.h> #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -static_assert(sizeof(pthread_t) == sizeof(__llvm_libc::Thread), +static_assert(sizeof(pthread_t) == sizeof(LIBC_NAMESPACE::Thread), "Mismatch between pthread_t and internal Thread."); LLVM_LIBC_FUNCTION(int, pthread_getname_np, (pthread_t th, char *buf, size_t len)) { - auto *thread = reinterpret_cast<__llvm_libc::Thread *>(&th); + auto *thread = reinterpret_cast<LIBC_NAMESPACE::Thread *>(&th); cpp::span<char> name_buf(buf, len); cpp::StringStream name_stream(name_buf); return thread->get_name(name_stream); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_getname_np.h b/libc/src/pthread/pthread_getname_np.h index da9c771..a515737 100644 --- a/libc/src/pthread/pthread_getname_np.h +++ b/libc/src/pthread/pthread_getname_np.h @@ -12,10 +12,10 @@ #include <pthread.h> #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_getname_np(pthread_t, char *, size_t); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_GETNAME_NP_H diff --git a/libc/src/pthread/pthread_getspecific.cpp b/libc/src/pthread/pthread_getspecific.cpp index 0254556..3893b52 100644 --- a/libc/src/pthread/pthread_getspecific.cpp +++ b/libc/src/pthread/pthread_getspecific.cpp @@ -14,10 +14,10 @@ #include <pthread.h> #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void *, pthread_getspecific, (pthread_key_t key)) { return get_tss_value(key); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_getspecific.h b/libc/src/pthread/pthread_getspecific.h index c7da013..2843983 100644 --- a/libc/src/pthread/pthread_getspecific.h +++ b/libc/src/pthread/pthread_getspecific.h @@ -12,10 +12,10 @@ #include <pthread.h> #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void *pthread_getspecific(pthread_key_t); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_GETSPECIFIC_H diff --git a/libc/src/pthread/pthread_join.cpp b/libc/src/pthread/pthread_join.cpp index b8882602..8d4c2dd 100644 --- a/libc/src/pthread/pthread_join.cpp +++ b/libc/src/pthread/pthread_join.cpp @@ -13,9 +13,9 @@ #include <pthread.h> // For pthread_* type definitions. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -static_assert(sizeof(pthread_t) == sizeof(__llvm_libc::Thread), +static_assert(sizeof(pthread_t) == sizeof(LIBC_NAMESPACE::Thread), "Mismatch between pthread_t and internal Thread."); LLVM_LIBC_FUNCTION(int, pthread_join, (pthread_t th, void **retval)) { @@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, pthread_join, (pthread_t th, void **retval)) { return result; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_join.h b/libc/src/pthread/pthread_join.h index 1200fba..506efae 100644 --- a/libc/src/pthread/pthread_join.h +++ b/libc/src/pthread/pthread_join.h @@ -11,10 +11,10 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_join(pthread_t thread, void **retval); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_JOIN_H diff --git a/libc/src/pthread/pthread_key_create.cpp b/libc/src/pthread/pthread_key_create.cpp index 1dc8eec..81c1f39 100644 --- a/libc/src/pthread/pthread_key_create.cpp +++ b/libc/src/pthread/pthread_key_create.cpp @@ -14,15 +14,15 @@ #include <errno.h> #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_key_create, (pthread_key_t * key, __pthread_tss_dtor_t dtor)) { - auto k = __llvm_libc::new_tss_key(dtor); + auto k = LIBC_NAMESPACE::new_tss_key(dtor); if (!k) return EINVAL; *key = *k; return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_key_create.h b/libc/src/pthread/pthread_key_create.h index cd5916a..f12c908 100644 --- a/libc/src/pthread/pthread_key_create.h +++ b/libc/src/pthread/pthread_key_create.h @@ -11,10 +11,10 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_key_create(pthread_key_t *key, __pthread_tss_dtor_t dtor); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_KEY_CREATE_H diff --git a/libc/src/pthread/pthread_key_delete.cpp b/libc/src/pthread/pthread_key_delete.cpp index d45424c..18a4cc7 100644 --- a/libc/src/pthread/pthread_key_delete.cpp +++ b/libc/src/pthread/pthread_key_delete.cpp @@ -14,13 +14,13 @@ #include <errno.h> #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_key_delete, (pthread_key_t key)) { - if (__llvm_libc::tss_key_delete(key)) + if (LIBC_NAMESPACE::tss_key_delete(key)) return 0; else return EINVAL; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_key_delete.h b/libc/src/pthread/pthread_key_delete.h index 3ec528d..5b7e40b 100644 --- a/libc/src/pthread/pthread_key_delete.h +++ b/libc/src/pthread/pthread_key_delete.h @@ -11,10 +11,10 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_key_delete(pthread_key_t key); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_KEY_DELETE_H diff --git a/libc/src/pthread/pthread_mutex_destroy.cpp b/libc/src/pthread/pthread_mutex_destroy.cpp index acb344b..65f4b790 100644 --- a/libc/src/pthread/pthread_mutex_destroy.cpp +++ b/libc/src/pthread/pthread_mutex_destroy.cpp @@ -13,7 +13,7 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_mutex_destroy, (pthread_mutex_t * mutex)) { auto *m = reinterpret_cast<Mutex *>(mutex); @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutex_destroy, (pthread_mutex_t * mutex)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_mutex_destroy.h b/libc/src/pthread/pthread_mutex_destroy.h index b6461a0..2df303e 100644 --- a/libc/src/pthread/pthread_mutex_destroy.h +++ b/libc/src/pthread/pthread_mutex_destroy.h @@ -11,10 +11,10 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_mutex_destroy(pthread_mutex_t *mutex); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEX_DESTROY_H diff --git a/libc/src/pthread/pthread_mutex_init.cpp b/libc/src/pthread/pthread_mutex_init.cpp index 5038ee0..f64d1fe 100644 --- a/libc/src/pthread/pthread_mutex_init.cpp +++ b/libc/src/pthread/pthread_mutex_init.cpp @@ -15,7 +15,7 @@ #include <errno.h> #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { static_assert(sizeof(Mutex) <= sizeof(pthread_mutex_t), "The public pthread_mutex_t type cannot accommodate the internal " @@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutex_init, return err == MutexError::NONE ? 0 : EAGAIN; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_mutex_init.h b/libc/src/pthread/pthread_mutex_init.h index 678cac3..e6b5a0a 100644 --- a/libc/src/pthread/pthread_mutex_init.h +++ b/libc/src/pthread/pthread_mutex_init.h @@ -11,11 +11,11 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *__restrict attr); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEX_INIT_H diff --git a/libc/src/pthread/pthread_mutex_lock.cpp b/libc/src/pthread/pthread_mutex_lock.cpp index 9daffaf..efc6f75 100644 --- a/libc/src/pthread/pthread_mutex_lock.cpp +++ b/libc/src/pthread/pthread_mutex_lock.cpp @@ -13,7 +13,7 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // The implementation currently handles only plain mutexes. LLVM_LIBC_FUNCTION(int, pthread_mutex_lock, (pthread_mutex_t * mutex)) { @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutex_lock, (pthread_mutex_t * mutex)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_mutex_lock.h b/libc/src/pthread/pthread_mutex_lock.h index bb47e59..c5a835e 100644 --- a/libc/src/pthread/pthread_mutex_lock.h +++ b/libc/src/pthread/pthread_mutex_lock.h @@ -11,10 +11,10 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_mutex_lock(pthread_mutex_t *mutex); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEX_LOCK_H diff --git a/libc/src/pthread/pthread_mutex_unlock.cpp b/libc/src/pthread/pthread_mutex_unlock.cpp index 3cc8c7c..b0819bd 100644 --- a/libc/src/pthread/pthread_mutex_unlock.cpp +++ b/libc/src/pthread/pthread_mutex_unlock.cpp @@ -13,7 +13,7 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // The implementation currently handles only plain mutexes. LLVM_LIBC_FUNCTION(int, pthread_mutex_unlock, (pthread_mutex_t * mutex)) { @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutex_unlock, (pthread_mutex_t * mutex)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_mutex_unlock.h b/libc/src/pthread/pthread_mutex_unlock.h index 4653841..303ec00 100644 --- a/libc/src/pthread/pthread_mutex_unlock.h +++ b/libc/src/pthread/pthread_mutex_unlock.h @@ -11,10 +11,10 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_mutex_unlock(pthread_mutex_t *mutex); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEX_UNLOCK_H diff --git a/libc/src/pthread/pthread_mutexattr.h b/libc/src/pthread/pthread_mutexattr.h index b65c672..8b43585 100644 --- a/libc/src/pthread/pthread_mutexattr.h +++ b/libc/src/pthread/pthread_mutexattr.h @@ -13,7 +13,7 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { enum class PThreadMutexAttrPos : unsigned int { TYPE_SHIFT = 0, @@ -43,6 +43,6 @@ LIBC_INLINE int get_mutexattr_robust(pthread_mutexattr_t attr) { unsigned(PThreadMutexAttrPos::ROBUST_SHIFT); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEXATTR_H diff --git a/libc/src/pthread/pthread_mutexattr_destroy.cpp b/libc/src/pthread/pthread_mutexattr_destroy.cpp index cedfbe3..9722d2b 100644 --- a/libc/src/pthread/pthread_mutexattr_destroy.cpp +++ b/libc/src/pthread/pthread_mutexattr_destroy.cpp @@ -13,10 +13,10 @@ #include <errno.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_mutexattr_destroy, (pthread_mutexattr_t *)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_mutexattr_destroy.h b/libc/src/pthread/pthread_mutexattr_destroy.h index 2d7a5ed..32a8b94 100644 --- a/libc/src/pthread/pthread_mutexattr_destroy.h +++ b/libc/src/pthread/pthread_mutexattr_destroy.h @@ -11,10 +11,10 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_mutexattr_destroy(pthread_mutexattr_t *attr); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEXATTR_DESTROY_H diff --git a/libc/src/pthread/pthread_mutexattr_getpshared.cpp b/libc/src/pthread/pthread_mutexattr_getpshared.cpp index 636bc1a..a89af08 100644 --- a/libc/src/pthread/pthread_mutexattr_getpshared.cpp +++ b/libc/src/pthread/pthread_mutexattr_getpshared.cpp @@ -13,7 +13,7 @@ #include <errno.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_mutexattr_getpshared, (const pthread_mutexattr_t *__restrict attr, @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutexattr_getpshared, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_mutexattr_getpshared.h b/libc/src/pthread/pthread_mutexattr_getpshared.h index 12c60ea..843fa36 100644 --- a/libc/src/pthread/pthread_mutexattr_getpshared.h +++ b/libc/src/pthread/pthread_mutexattr_getpshared.h @@ -11,11 +11,11 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_mutexattr_getpshared(const pthread_mutexattr_t *__restrict attr, int *__restrict pshared); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEXATTR_GETPSHARED_H diff --git a/libc/src/pthread/pthread_mutexattr_getrobust.cpp b/libc/src/pthread/pthread_mutexattr_getrobust.cpp index e3677ee..9c54b07 100644 --- a/libc/src/pthread/pthread_mutexattr_getrobust.cpp +++ b/libc/src/pthread/pthread_mutexattr_getrobust.cpp @@ -13,7 +13,7 @@ #include <errno.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_mutexattr_getrobust, (const pthread_mutexattr_t *__restrict attr, @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutexattr_getrobust, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_mutexattr_getrobust.h b/libc/src/pthread/pthread_mutexattr_getrobust.h index 762cde0..5ef2b92 100644 --- a/libc/src/pthread/pthread_mutexattr_getrobust.h +++ b/libc/src/pthread/pthread_mutexattr_getrobust.h @@ -11,11 +11,11 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_mutexattr_getrobust(const pthread_mutexattr_t *__restrict attr, int *__restrict robust); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEXATTR_GETROBUST_H diff --git a/libc/src/pthread/pthread_mutexattr_gettype.cpp b/libc/src/pthread/pthread_mutexattr_gettype.cpp index 6a17e88..c54396e 100644 --- a/libc/src/pthread/pthread_mutexattr_gettype.cpp +++ b/libc/src/pthread/pthread_mutexattr_gettype.cpp @@ -13,7 +13,7 @@ #include <errno.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_mutexattr_gettype, (const pthread_mutexattr_t *__restrict attr, @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutexattr_gettype, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_mutexattr_gettype.h b/libc/src/pthread/pthread_mutexattr_gettype.h index b0a7ea8..b0e7c6e 100644 --- a/libc/src/pthread/pthread_mutexattr_gettype.h +++ b/libc/src/pthread/pthread_mutexattr_gettype.h @@ -11,11 +11,11 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_mutexattr_gettype(const pthread_mutexattr_t *__restrict attr, int *__restrict type); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEXATTR_GETTYPE_H diff --git a/libc/src/pthread/pthread_mutexattr_init.cpp b/libc/src/pthread/pthread_mutexattr_init.cpp index 818aea1..439d198 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 af6cf29..13de2e5 100644 --- a/libc/src/pthread/pthread_mutexattr_init.h +++ b/libc/src/pthread/pthread_mutexattr_init.h @@ -11,10 +11,10 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_mutexattr_init(pthread_mutexattr_t *attr); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEXATTR_INIT_H diff --git a/libc/src/pthread/pthread_mutexattr_setpshared.cpp b/libc/src/pthread/pthread_mutexattr_setpshared.cpp index 1554031..f654d33 100644 --- a/libc/src/pthread/pthread_mutexattr_setpshared.cpp +++ b/libc/src/pthread/pthread_mutexattr_setpshared.cpp @@ -14,7 +14,7 @@ #include <errno.h> #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_mutexattr_setpshared, (pthread_mutexattr_t *__restrict attr, int pshared)) { @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutexattr_setpshared, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_mutexattr_setpshared.h b/libc/src/pthread/pthread_mutexattr_setpshared.h index 21c7734..0726b77 100644 --- a/libc/src/pthread/pthread_mutexattr_setpshared.h +++ b/libc/src/pthread/pthread_mutexattr_setpshared.h @@ -11,11 +11,11 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_mutexattr_setpshared(pthread_mutexattr_t *__restrict attr, int pshared); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEXATTR_SETPSHARED_H diff --git a/libc/src/pthread/pthread_mutexattr_setrobust.cpp b/libc/src/pthread/pthread_mutexattr_setrobust.cpp index b09e397..15fdac6 100644 --- a/libc/src/pthread/pthread_mutexattr_setrobust.cpp +++ b/libc/src/pthread/pthread_mutexattr_setrobust.cpp @@ -14,7 +14,7 @@ #include <errno.h> #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_mutexattr_setrobust, (pthread_mutexattr_t *__restrict attr, int robust)) { @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutexattr_setrobust, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_mutexattr_setrobust.h b/libc/src/pthread/pthread_mutexattr_setrobust.h index 253a319..8361a14 100644 --- a/libc/src/pthread/pthread_mutexattr_setrobust.h +++ b/libc/src/pthread/pthread_mutexattr_setrobust.h @@ -11,11 +11,11 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_mutexattr_setrobust(pthread_mutexattr_t *__restrict attr, int robust); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEXATTR_SETROBUST_H diff --git a/libc/src/pthread/pthread_mutexattr_settype.cpp b/libc/src/pthread/pthread_mutexattr_settype.cpp index e813465..d5514a1 100644 --- a/libc/src/pthread/pthread_mutexattr_settype.cpp +++ b/libc/src/pthread/pthread_mutexattr_settype.cpp @@ -14,7 +14,7 @@ #include <errno.h> #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_mutexattr_settype, (pthread_mutexattr_t *__restrict attr, int type)) { @@ -28,4 +28,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutexattr_settype, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_mutexattr_settype.h b/libc/src/pthread/pthread_mutexattr_settype.h index 2411558..8ad3285 100644 --- a/libc/src/pthread/pthread_mutexattr_settype.h +++ b/libc/src/pthread/pthread_mutexattr_settype.h @@ -11,10 +11,10 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_mutexattr_settype(pthread_mutexattr_t *__restrict attr, int type); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEXATTR_SETTYPE_H diff --git a/libc/src/pthread/pthread_once.cpp b/libc/src/pthread/pthread_once.cpp index 4d141a6..0e0045e 100644 --- a/libc/src/pthread/pthread_once.cpp +++ b/libc/src/pthread/pthread_once.cpp @@ -12,7 +12,7 @@ #include <pthread.h> // For pthread_once_t and __pthread_once_func_t definitions. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_once, (pthread_once_t * flag, __pthread_once_func_t func)) { @@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(int, pthread_once, reinterpret_cast<CallOnceCallback *>(func)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_once.h b/libc/src/pthread/pthread_once.h index b9b7212..25ee70a 100644 --- a/libc/src/pthread/pthread_once.h +++ b/libc/src/pthread/pthread_once.h @@ -11,10 +11,10 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_once(pthread_once_t *flag, __pthread_once_func_t func); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ONCE_H diff --git a/libc/src/pthread/pthread_self.cpp b/libc/src/pthread/pthread_self.cpp index 5b3145f..3e74f96 100644 --- a/libc/src/pthread/pthread_self.cpp +++ b/libc/src/pthread/pthread_self.cpp @@ -13,9 +13,9 @@ #include <pthread.h> // For pthread_* type definitions. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -static_assert(sizeof(pthread_t) == sizeof(__llvm_libc::Thread), +static_assert(sizeof(pthread_t) == sizeof(LIBC_NAMESPACE::Thread), "Mismatch between pthread_t and internal Thread."); LLVM_LIBC_FUNCTION(pthread_t, pthread_self, ()) { @@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(pthread_t, pthread_self, ()) { return th; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_self.h b/libc/src/pthread/pthread_self.h index 1c4080b..058072e 100644 --- a/libc/src/pthread/pthread_self.h +++ b/libc/src/pthread/pthread_self.h @@ -11,10 +11,10 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { pthread_t pthread_self(); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_SELF_H diff --git a/libc/src/pthread/pthread_setname_np.cpp b/libc/src/pthread/pthread_setname_np.cpp index 425c25b..e211d7e 100644 --- a/libc/src/pthread/pthread_setname_np.cpp +++ b/libc/src/pthread/pthread_setname_np.cpp @@ -14,14 +14,14 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -static_assert(sizeof(pthread_t) == sizeof(__llvm_libc::Thread), +static_assert(sizeof(pthread_t) == sizeof(LIBC_NAMESPACE::Thread), "Mismatch between pthread_t and internal Thread."); LLVM_LIBC_FUNCTION(int, pthread_setname_np, (pthread_t th, const char *name)) { - auto *thread = reinterpret_cast<__llvm_libc::Thread *>(&th); + auto *thread = reinterpret_cast<LIBC_NAMESPACE::Thread *>(&th); return thread->set_name(cpp::string_view(name)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_setname_np.h b/libc/src/pthread/pthread_setname_np.h index 25b8c1f..e240425 100644 --- a/libc/src/pthread/pthread_setname_np.h +++ b/libc/src/pthread/pthread_setname_np.h @@ -11,10 +11,10 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_setname_np(pthread_t, const char *name); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_SETNAME_NP_H diff --git a/libc/src/pthread/pthread_setspecific.cpp b/libc/src/pthread/pthread_setspecific.cpp index 15504f7..e9b23d8 100644 --- a/libc/src/pthread/pthread_setspecific.cpp +++ b/libc/src/pthread/pthread_setspecific.cpp @@ -14,7 +14,7 @@ #include <errno.h> #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_setspecific, (pthread_key_t key, const void *data)) { @@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, pthread_setspecific, return EINVAL; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_setspecific.h b/libc/src/pthread/pthread_setspecific.h index 4211a8e..af9a890 100644 --- a/libc/src/pthread/pthread_setspecific.h +++ b/libc/src/pthread/pthread_setspecific.h @@ -11,10 +11,10 @@ #include <pthread.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_setspecific(pthread_key_t, const void *); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_SETSPECIFIC_H diff --git a/libc/src/sched/linux/sched_get_priority_max.cpp b/libc/src/sched/linux/sched_get_priority_max.cpp index c2954e3..0b6537ec 100644 --- a/libc/src/sched/linux/sched_get_priority_max.cpp +++ b/libc/src/sched/linux/sched_get_priority_max.cpp @@ -14,10 +14,11 @@ #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sched_get_priority_max, (int policy)) { - int ret = __llvm_libc::syscall_impl<int>(SYS_sched_get_priority_max, policy); + int ret = + LIBC_NAMESPACE::syscall_impl<int>(SYS_sched_get_priority_max, policy); if (ret < 0) { libc_errno = -ret; return -1; @@ -25,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, sched_get_priority_max, (int policy)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sched/linux/sched_get_priority_min.cpp b/libc/src/sched/linux/sched_get_priority_min.cpp index 442b857..1240a50 100644 --- a/libc/src/sched/linux/sched_get_priority_min.cpp +++ b/libc/src/sched/linux/sched_get_priority_min.cpp @@ -14,10 +14,11 @@ #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sched_get_priority_min, (int policy)) { - int ret = __llvm_libc::syscall_impl<int>(SYS_sched_get_priority_min, policy); + int ret = + LIBC_NAMESPACE::syscall_impl<int>(SYS_sched_get_priority_min, policy); if (ret < 0) { libc_errno = -ret; return -1; @@ -25,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, sched_get_priority_min, (int policy)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sched/linux/sched_getaffinity.cpp b/libc/src/sched/linux/sched_getaffinity.cpp index fcdd8c3..4765761 100644 --- a/libc/src/sched/linux/sched_getaffinity.cpp +++ b/libc/src/sched/linux/sched_getaffinity.cpp @@ -16,12 +16,12 @@ #include <stdint.h> #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sched_getaffinity, (pid_t tid, size_t cpuset_size, cpu_set_t *mask)) { - int ret = __llvm_libc::syscall_impl<int>(SYS_sched_getaffinity, tid, - cpuset_size, mask); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_sched_getaffinity, tid, + cpuset_size, mask); if (ret < 0) { libc_errno = -ret; return -1; @@ -36,4 +36,4 @@ LLVM_LIBC_FUNCTION(int, sched_getaffinity, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sched/linux/sched_getcpucount.cpp b/libc/src/sched/linux/sched_getcpucount.cpp index bcb5e82..a816d92 100644 --- a/libc/src/sched/linux/sched_getcpucount.cpp +++ b/libc/src/sched/linux/sched_getcpucount.cpp @@ -13,7 +13,7 @@ #include <sched.h> #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, __sched_getcpucount, (size_t cpuset_size, const cpu_set_t *mask)) { @@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, __sched_getcpucount, return result; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sched/linux/sched_getparam.cpp b/libc/src/sched/linux/sched_getparam.cpp index 3b19c2e..64a62c5 100644 --- a/libc/src/sched/linux/sched_getparam.cpp +++ b/libc/src/sched/linux/sched_getparam.cpp @@ -14,11 +14,11 @@ #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sched_getparam, (pid_t tid, struct sched_param *param)) { - int ret = __llvm_libc::syscall_impl<int>(SYS_sched_getparam, tid, param); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_sched_getparam, tid, param); if (ret < 0) { libc_errno = -ret; return -1; @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, sched_getparam, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sched/linux/sched_getscheduler.cpp b/libc/src/sched/linux/sched_getscheduler.cpp index 1f9affb..992a11d 100644 --- a/libc/src/sched/linux/sched_getscheduler.cpp +++ b/libc/src/sched/linux/sched_getscheduler.cpp @@ -14,10 +14,10 @@ #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sched_getscheduler, (pid_t tid)) { - int ret = __llvm_libc::syscall_impl<int>(SYS_sched_getscheduler, tid); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_sched_getscheduler, tid); if (ret < 0) { libc_errno = -ret; return -1; @@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, sched_getscheduler, (pid_t tid)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sched/linux/sched_rr_get_interval.cpp b/libc/src/sched/linux/sched_rr_get_interval.cpp index c50dc71..9d7d0e9 100644 --- a/libc/src/sched/linux/sched_rr_get_interval.cpp +++ b/libc/src/sched/linux/sched_rr_get_interval.cpp @@ -18,12 +18,13 @@ #include <linux/time_types.h> // For __kernel_timespec. #endif -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sched_rr_get_interval, (pid_t tid, struct timespec *tp)) { #ifdef SYS_sched_rr_get_interval - int ret = __llvm_libc::syscall_impl<int>(SYS_sched_rr_get_interval, tid, tp); + int ret = + LIBC_NAMESPACE::syscall_impl<int>(SYS_sched_rr_get_interval, tid, tp); #elif defined(SYS_sched_rr_get_interval_time64) // The difference between the and SYS_sched_rr_get_interval // SYS_sched_rr_get_interval_time64 syscalls is the data type used for the @@ -31,16 +32,16 @@ LLVM_LIBC_FUNCTION(int, sched_rr_get_interval, int ret; if (tp) { struct __kernel_timespec ts32; - ret = __llvm_libc::syscall_impl<int>(SYS_sched_rr_get_interval_time64, tid, - &ts32); + ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_sched_rr_get_interval_time64, + tid, &ts32); if (ret == 0) { tp->tv_sec = ts32.tv_sec; tp->tv_nsec = ts32.tv_nsec; } } else // When tp is a nullptr, we still do the syscall to set ret and errno - ret = __llvm_libc::syscall_impl<int>(SYS_sched_rr_get_interval_time64, tid, - nullptr); + ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_sched_rr_get_interval_time64, + tid, nullptr); #else #error \ "sched_rr_get_interval and sched_rr_get_interval_time64 syscalls not available." @@ -52,4 +53,4 @@ LLVM_LIBC_FUNCTION(int, sched_rr_get_interval, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sched/linux/sched_setaffinity.cpp b/libc/src/sched/linux/sched_setaffinity.cpp index 1c99254..5098942 100644 --- a/libc/src/sched/linux/sched_setaffinity.cpp +++ b/libc/src/sched/linux/sched_setaffinity.cpp @@ -15,12 +15,12 @@ #include <sched.h> #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sched_setaffinity, (pid_t tid, size_t cpuset_size, const cpu_set_t *mask)) { - int ret = __llvm_libc::syscall_impl<int>(SYS_sched_setaffinity, tid, - cpuset_size, mask); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_sched_setaffinity, tid, + cpuset_size, mask); if (ret < 0) { libc_errno = -ret; return -1; @@ -28,4 +28,4 @@ LLVM_LIBC_FUNCTION(int, sched_setaffinity, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sched/linux/sched_setparam.cpp b/libc/src/sched/linux/sched_setparam.cpp index 2869800..79acf78 100644 --- a/libc/src/sched/linux/sched_setparam.cpp +++ b/libc/src/sched/linux/sched_setparam.cpp @@ -14,11 +14,11 @@ #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sched_setparam, (pid_t tid, const struct sched_param *param)) { - int ret = __llvm_libc::syscall_impl<int>(SYS_sched_setparam, tid, param); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_sched_setparam, tid, param); if (ret < 0) { libc_errno = -ret; return -1; @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, sched_setparam, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sched/linux/sched_setscheduler.cpp b/libc/src/sched/linux/sched_setscheduler.cpp index c0b6205..1c18526 100644 --- a/libc/src/sched/linux/sched_setscheduler.cpp +++ b/libc/src/sched/linux/sched_setscheduler.cpp @@ -14,12 +14,12 @@ #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sched_setscheduler, (pid_t tid, int policy, const struct sched_param *param)) { - int ret = __llvm_libc::syscall_impl<int>(SYS_sched_setscheduler, tid, policy, - param); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_sched_setscheduler, tid, + policy, param); if (ret < 0) { libc_errno = -ret; return -1; @@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(int, sched_setscheduler, return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sched/linux/sched_yield.cpp b/libc/src/sched/linux/sched_yield.cpp index 27a6f37..6878a37 100644 --- a/libc/src/sched/linux/sched_yield.cpp +++ b/libc/src/sched/linux/sched_yield.cpp @@ -14,10 +14,10 @@ #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sched_yield, ()) { - int ret = __llvm_libc::syscall_impl<int>(SYS_sched_yield); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_sched_yield); // As of writing this, yield() cannot fail if (ret < 0) { libc_errno = -ret; @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, sched_yield, ()) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sched/sched_get_priority_max.h b/libc/src/sched/sched_get_priority_max.h index 3ddcb08..01611da 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 10bca87..f4b5d54 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 1231772..2f29b7e 100644 --- a/libc/src/sched/sched_getaffinity.h +++ b/libc/src/sched/sched_getaffinity.h @@ -11,10 +11,10 @@ #include <sched.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int sched_getaffinity(pid_t tid, size_t cpuset_size, cpu_set_t *mask); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SCHED_SCHED_GETAFFINITY_H diff --git a/libc/src/sched/sched_getcpucount.h b/libc/src/sched/sched_getcpucount.h index f55ec14..a0c696f 100644 --- a/libc/src/sched/sched_getcpucount.h +++ b/libc/src/sched/sched_getcpucount.h @@ -12,12 +12,12 @@ #include <sched.h> #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // This function is for internal use in the CPU_COUNT macro, but since that's a // macro and will be applied to client files, this must be a public entrypoint. int __sched_getcpucount(size_t cpuset_size, const cpu_set_t *mask); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SCHED_SCHED_GETCPUCOUNT_H diff --git a/libc/src/sched/sched_getparam.h b/libc/src/sched/sched_getparam.h index fcae11b..09bed70 100644 --- a/libc/src/sched/sched_getparam.h +++ b/libc/src/sched/sched_getparam.h @@ -11,10 +11,10 @@ #include <sched.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int sched_getparam(pid_t tid, struct sched_param *param); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SCHED_SCHED_GETPARAM_H diff --git a/libc/src/sched/sched_getscheduler.h b/libc/src/sched/sched_getscheduler.h index 543b72d..6e4fe06 100644 --- a/libc/src/sched/sched_getscheduler.h +++ b/libc/src/sched/sched_getscheduler.h @@ -11,10 +11,10 @@ #include <sched.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int sched_getscheduler(pid_t tid); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SCHED_SCHED_GETSCHEDULER_H diff --git a/libc/src/sched/sched_rr_get_interval.h b/libc/src/sched/sched_rr_get_interval.h index b90e4c3..f9eb2d9 100644 --- a/libc/src/sched/sched_rr_get_interval.h +++ b/libc/src/sched/sched_rr_get_interval.h @@ -11,10 +11,10 @@ #include <sched.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int sched_rr_get_interval(pid_t tid, struct timespec *tp); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SCHED_SCHED_RR_GET_INTERVAL_H diff --git a/libc/src/sched/sched_setaffinity.h b/libc/src/sched/sched_setaffinity.h index 9f3f8fe..5da6dd4 100644 --- a/libc/src/sched/sched_setaffinity.h +++ b/libc/src/sched/sched_setaffinity.h @@ -11,10 +11,10 @@ #include <sched.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int sched_setaffinity(pid_t pid, size_t cpuset_size, const cpu_set_t *mask); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SCHED_SCHED_SETAFFINITY_H diff --git a/libc/src/sched/sched_setparam.h b/libc/src/sched/sched_setparam.h index 1707597..c371bc0 100644 --- a/libc/src/sched/sched_setparam.h +++ b/libc/src/sched/sched_setparam.h @@ -11,10 +11,10 @@ #include <sched.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int sched_setparam(pid_t tid, const struct sched_param *param); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SCHED_SCHED_SETPARAM_H diff --git a/libc/src/sched/sched_setscheduler.h b/libc/src/sched/sched_setscheduler.h index 2a56e27..8e0cb0d 100644 --- a/libc/src/sched/sched_setscheduler.h +++ b/libc/src/sched/sched_setscheduler.h @@ -11,10 +11,10 @@ #include <sched.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int sched_setscheduler(pid_t tid, int policy, const struct sched_param *param); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SCHED_SCHED_SETSCHEDULER_H diff --git a/libc/src/sched/sched_yield.h b/libc/src/sched/sched_yield.h index a649500..493646a 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 5937504..3697d62 100644 --- a/libc/src/setjmp/longjmp.h +++ b/libc/src/setjmp/longjmp.h @@ -11,10 +11,10 @@ #include <setjmp.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void longjmp(__jmp_buf *buf, int val); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SETJMP_LONGJMP_H diff --git a/libc/src/setjmp/riscv64/longjmp.cpp b/libc/src/setjmp/riscv64/longjmp.cpp index 7d8acd3..0aed25e 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 1ffc8d4..826aa40 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 9dc5396..52c835c 100644 --- a/libc/src/setjmp/setjmp_impl.h +++ b/libc/src/setjmp/setjmp_impl.h @@ -13,10 +13,10 @@ // public header setjmp.h which is also included. here. #include <setjmp.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int setjmp(__jmp_buf *buf); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SETJMP_SETJMP_IMPL_H diff --git a/libc/src/setjmp/x86_64/longjmp.cpp b/libc/src/setjmp/x86_64/longjmp.cpp index d509b25..3234046 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 988db64..8b6981d 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 52d5b0d..a6d1893 100644 --- a/libc/src/signal/kill.h +++ b/libc/src/signal/kill.h @@ -11,10 +11,10 @@ #include <signal.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int kill(pid_t pid, int sig); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SIGNAL_KILL_H diff --git a/libc/src/signal/linux/__restore.cpp b/libc/src/signal/linux/__restore.cpp index 9473730..36fa375 100644 --- a/libc/src/signal/linux/__restore.cpp +++ b/libc/src/signal/linux/__restore.cpp @@ -14,14 +14,14 @@ #include <sys/syscall.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { extern "C" void __restore_rt() __attribute__((no_sanitize("all"), hidden)); extern "C" void __restore_rt() { - __llvm_libc::syscall_impl<long>(SYS_rt_sigreturn); + LIBC_NAMESPACE::syscall_impl<long>(SYS_rt_sigreturn); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/signal/linux/kill.cpp b/libc/src/signal/linux/kill.cpp index 10d5076..a02b3b1 100644 --- a/libc/src/signal/linux/kill.cpp +++ b/libc/src/signal/linux/kill.cpp @@ -16,10 +16,10 @@ #include <signal.h> #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, kill, (pid_t pid, int sig)) { - int ret = __llvm_libc::syscall_impl<int>(SYS_kill, pid, sig); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_kill, pid, sig); // A negative return value indicates an error with the magnitude of the // value being the error code. @@ -31,4 +31,4 @@ LLVM_LIBC_FUNCTION(int, kill, (pid_t pid, int sig)) { return ret; // always 0 } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/signal/linux/raise.cpp b/libc/src/signal/linux/raise.cpp index 0a9bf29..dd6f5eb 100644 --- a/libc/src/signal/linux/raise.cpp +++ b/libc/src/signal/linux/raise.cpp @@ -11,16 +11,16 @@ #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, raise, (int sig)) { ::sigset_t sigset; block_all_signals(sigset); - long pid = __llvm_libc::syscall_impl<long>(SYS_getpid); - long tid = __llvm_libc::syscall_impl<long>(SYS_gettid); - int ret = __llvm_libc::syscall_impl<int>(SYS_tgkill, pid, tid, sig); + long pid = LIBC_NAMESPACE::syscall_impl<long>(SYS_getpid); + long tid = LIBC_NAMESPACE::syscall_impl<long>(SYS_gettid); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_tgkill, pid, tid, sig); restore_signals(sigset); return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/signal/linux/sigaction.cpp b/libc/src/signal/linux/sigaction.cpp index 08f4d0a..7ddc2dc 100644 --- a/libc/src/signal/linux/sigaction.cpp +++ b/libc/src/signal/linux/sigaction.cpp @@ -14,7 +14,7 @@ #include <signal.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TOOD: Some architectures will have their signal trampoline functions in the // vdso, use those when available. @@ -34,7 +34,7 @@ LLVM_LIBC_FUNCTION(int, sigaction, } KernelSigaction kernel_old; - int ret = __llvm_libc::syscall_impl<int>( + int ret = LIBC_NAMESPACE::syscall_impl<int>( SYS_rt_sigaction, signal, libc_new ? &kernel_new : nullptr, libc_old ? &kernel_old : nullptr, sizeof(sigset_t)); if (ret) { @@ -47,4 +47,4 @@ LLVM_LIBC_FUNCTION(int, sigaction, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/signal/linux/sigaddset.cpp b/libc/src/signal/linux/sigaddset.cpp index ff65c04..5363917 100644 --- a/libc/src/signal/linux/sigaddset.cpp +++ b/libc/src/signal/linux/sigaddset.cpp @@ -13,7 +13,7 @@ #include <signal.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sigaddset, (sigset_t * set, int signum)) { if (set != nullptr && add_signal(*set, signum)) @@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(int, sigaddset, (sigset_t * set, int signum)) { return -1; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/signal/linux/sigaltstack.cpp b/libc/src/signal/linux/sigaltstack.cpp index 1e58dc7..47e0b23 100644 --- a/libc/src/signal/linux/sigaltstack.cpp +++ b/libc/src/signal/linux/sigaltstack.cpp @@ -15,7 +15,7 @@ #include <signal.h> #include <sys/syscall.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sigaltstack, (const stack_t *__restrict ss, stack_t *__restrict oss)) { @@ -34,7 +34,7 @@ LLVM_LIBC_FUNCTION(int, sigaltstack, } } - int ret = __llvm_libc::syscall_impl<int>(SYS_sigaltstack, ss, oss); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_sigaltstack, ss, oss); if (ret < 0) { libc_errno = -ret; return -1; @@ -42,4 +42,4 @@ LLVM_LIBC_FUNCTION(int, sigaltstack, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/signal/linux/sigdelset.cpp b/libc/src/signal/linux/sigdelset.cpp index ebaa412..5cb645e 100644 --- a/libc/src/signal/linux/sigdelset.cpp +++ b/libc/src/signal/linux/sigdelset.cpp @@ -13,7 +13,7 @@ #include <signal.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sigdelset, (sigset_t * set, int signum)) { if (set != nullptr && delete_signal(*set, signum)) @@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(int, sigdelset, (sigset_t * set, int signum)) { return -1; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/signal/linux/sigemptyset.cpp b/libc/src/signal/linux/sigemptyset.cpp index 6f4c731..d08191e 100644 --- a/libc/src/signal/linux/sigemptyset.cpp +++ b/libc/src/signal/linux/sigemptyset.cpp @@ -14,7 +14,7 @@ #include <signal.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sigemptyset, (sigset_t * set)) { if (!set) { @@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, sigemptyset, (sigset_t * set)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/signal/linux/sigfillset.cpp b/libc/src/signal/linux/sigfillset.cpp index 9c3796d..e17c85a 100644 --- a/libc/src/signal/linux/sigfillset.cpp +++ b/libc/src/signal/linux/sigfillset.cpp @@ -13,7 +13,7 @@ #include <signal.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sigfillset, (sigset_t * set)) { if (!set) { @@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, sigfillset, (sigset_t * set)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/signal/linux/signal.cpp b/libc/src/signal/linux/signal.cpp index 464a23c..a517fa7 100644 --- a/libc/src/signal/linux/signal.cpp +++ b/libc/src/signal/linux/signal.cpp @@ -13,15 +13,16 @@ #include <signal.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(sighandler_t, signal, (int signum, sighandler_t handler)) { struct sigaction action, old; action.sa_handler = handler; action.sa_flags = SA_RESTART; // Errno will already be set so no need to worry about changing errno here. - return __llvm_libc::sigaction(signum, &action, &old) == -1 ? SIG_ERR - : old.sa_handler; + return LIBC_NAMESPACE::sigaction(signum, &action, &old) == -1 + ? SIG_ERR + : old.sa_handler; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/signal/linux/signal_utils.h b/libc/src/signal/linux/signal_utils.h index 7b976fca..ca6fd3a 100644 --- a/libc/src/signal/linux/signal_utils.h +++ b/libc/src/signal/linux/signal_utils.h @@ -16,7 +16,7 @@ #include <stddef.h> #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // The POSIX definition of struct sigaction and the sigaction data structure // expected by the rt_sigaction syscall differ in their definition. So, we @@ -96,15 +96,15 @@ LIBC_INLINE constexpr bool delete_signal(sigset_t &set, int signal) { LIBC_INLINE int block_all_signals(sigset_t &set) { sigset_t full = full_set(); - return __llvm_libc::syscall_impl<int>(SYS_rt_sigprocmask, SIG_BLOCK, &full, - &set, sizeof(sigset_t)); + return LIBC_NAMESPACE::syscall_impl<int>(SYS_rt_sigprocmask, SIG_BLOCK, &full, + &set, sizeof(sigset_t)); } LIBC_INLINE int restore_signals(const sigset_t &set) { - return __llvm_libc::syscall_impl<int>(SYS_rt_sigprocmask, SIG_SETMASK, &set, - nullptr, sizeof(sigset_t)); + return LIBC_NAMESPACE::syscall_impl<int>(SYS_rt_sigprocmask, SIG_SETMASK, + &set, nullptr, sizeof(sigset_t)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SIGNAL_LINUX_SIGNAL_UTILS_H diff --git a/libc/src/signal/linux/sigprocmask.cpp b/libc/src/signal/linux/sigprocmask.cpp index f47cbd8..79a35dd 100644 --- a/libc/src/signal/linux/sigprocmask.cpp +++ b/libc/src/signal/linux/sigprocmask.cpp @@ -16,13 +16,13 @@ #include <signal.h> #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sigprocmask, (int how, const sigset_t *__restrict set, sigset_t *__restrict oldset)) { - int ret = __llvm_libc::syscall_impl<int>(SYS_rt_sigprocmask, how, set, oldset, - sizeof(sigset_t)); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_rt_sigprocmask, how, set, + oldset, sizeof(sigset_t)); if (!ret) return 0; @@ -30,4 +30,4 @@ LLVM_LIBC_FUNCTION(int, sigprocmask, return -1; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/signal/raise.h b/libc/src/signal/raise.h index 624b93c..ee4f3c9 100644 --- a/libc/src/signal/raise.h +++ b/libc/src/signal/raise.h @@ -11,10 +11,10 @@ #include <signal.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int raise(int sig); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SIGNAL_RAISE_H diff --git a/libc/src/signal/sigaction.h b/libc/src/signal/sigaction.h index 8315a56..c36a3ec 100644 --- a/libc/src/signal/sigaction.h +++ b/libc/src/signal/sigaction.h @@ -11,11 +11,11 @@ #include <signal.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int sigaction(int signal, const struct sigaction *__restrict libc_new, struct sigaction *__restrict libc_old); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SIGNAL_SIGACTION_H diff --git a/libc/src/signal/sigaddset.h b/libc/src/signal/sigaddset.h index 7d4613e..626eb20 100644 --- a/libc/src/signal/sigaddset.h +++ b/libc/src/signal/sigaddset.h @@ -11,10 +11,10 @@ #include <signal.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int sigaddset(sigset_t *set, int signum); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SIGNAL_SIGADDSET_H diff --git a/libc/src/signal/sigaltstack.h b/libc/src/signal/sigaltstack.h index 7cc77aa..705bd36 100644 --- a/libc/src/signal/sigaltstack.h +++ b/libc/src/signal/sigaltstack.h @@ -11,10 +11,10 @@ #include <signal.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int sigaltstack(const stack_t *__restrict ss, stack_t *__restrict oss); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SIGNAL_SIGALTSTACK_H diff --git a/libc/src/signal/sigdelset.h b/libc/src/signal/sigdelset.h index 2283bb5f..c4fdb99 100644 --- a/libc/src/signal/sigdelset.h +++ b/libc/src/signal/sigdelset.h @@ -11,10 +11,10 @@ #include <signal.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int sigdelset(sigset_t *set, int signum); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SIGNAL_SIGDELSET_H diff --git a/libc/src/signal/sigemptyset.h b/libc/src/signal/sigemptyset.h index bcb9c1a..f3763d1 100644 --- a/libc/src/signal/sigemptyset.h +++ b/libc/src/signal/sigemptyset.h @@ -11,10 +11,10 @@ #include <signal.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int sigemptyset(sigset_t *set); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SIGNAL_SIGEMPTYSET_H diff --git a/libc/src/signal/sigfillset.h b/libc/src/signal/sigfillset.h index 08a70a4..d8e3168 100644 --- a/libc/src/signal/sigfillset.h +++ b/libc/src/signal/sigfillset.h @@ -11,10 +11,10 @@ #include <signal.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int sigfillset(sigset_t *set); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SIGNAL_SIGFILLSET_H diff --git a/libc/src/signal/signal.h b/libc/src/signal/signal.h index c45564c..15bb5f0 100644 --- a/libc/src/signal/signal.h +++ b/libc/src/signal/signal.h @@ -11,12 +11,12 @@ #include <signal.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { using sighandler_t = __sighandler_t; sighandler_t signal(int signum, sighandler_t handler); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SIGNAL_SIGNAL_H diff --git a/libc/src/signal/sigprocmask.h b/libc/src/signal/sigprocmask.h index 490a16d..e065886 100644 --- a/libc/src/signal/sigprocmask.h +++ b/libc/src/signal/sigprocmask.h @@ -11,11 +11,11 @@ #include <signal.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int sigprocmask(int how, const sigset_t *__restrict set, sigset_t *__restrict oldset); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SIGNAL_SIGPROCMASK_H diff --git a/libc/src/spawn/file_actions.h b/libc/src/spawn/file_actions.h index ee509a1..7113256 100644 --- a/libc/src/spawn/file_actions.h +++ b/libc/src/spawn/file_actions.h @@ -12,7 +12,7 @@ #include <spawn.h> // For mode_t #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { struct BaseSpawnFileAction { enum ActionType { @@ -67,6 +67,6 @@ struct SpawnFileDup2Action : public BaseSpawnFileAction { newfd(new_fdesc) {} }; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SPAWN_FILE_ACTIONS_H diff --git a/libc/src/spawn/linux/posix_spawn.cpp b/libc/src/spawn/linux/posix_spawn.cpp index 44c79f9..0a0467d 100644 --- a/libc/src/spawn/linux/posix_spawn.cpp +++ b/libc/src/spawn/linux/posix_spawn.cpp @@ -18,7 +18,7 @@ #include <spawn.h> #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace { @@ -27,9 +27,9 @@ pid_t fork() { // to avoid duplicating the complete stack from the parent. A new stack will // be created on exec anyway so duplicating the full stack is unnecessary. #ifdef SYS_fork - return __llvm_libc::syscall_impl<pid_t>(SYS_fork); + return LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_fork); #elif defined(SYS_clone) - return __llvm_libc::syscall_impl<pid_t>(SYS_clone, SIGCHLD, 0); + return LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_clone, SIGCHLD, 0); #else #error "fork or clone syscalls not available." #endif @@ -37,10 +37,10 @@ pid_t fork() { cpp::optional<int> open(const char *path, int oflags, mode_t mode) { #ifdef SYS_open - int fd = __llvm_libc::syscall_impl<int>(SYS_open, path, oflags, mode); + int fd = LIBC_NAMESPACE::syscall_impl<int>(SYS_open, path, oflags, mode); #else - int fd = - __llvm_libc::syscall_impl<int>(SYS_openat, AT_FDCWD, path, oflags, mode); + int fd = LIBC_NAMESPACE::syscall_impl<int>(SYS_openat, AT_FDCWD, path, oflags, + mode); #endif if (fd > 0) return fd; @@ -50,14 +50,14 @@ cpp::optional<int> open(const char *path, int oflags, mode_t mode) { return cpp::nullopt; } -void close(int fd) { __llvm_libc::syscall_impl<long>(SYS_close, fd); } +void close(int fd) { LIBC_NAMESPACE::syscall_impl<long>(SYS_close, fd); } // We use dup3 if dup2 is not available, similar to our implementation of dup2 bool dup2(int fd, int newfd) { #ifdef SYS_dup2 - int ret = __llvm_libc::syscall_impl<int>(SYS_dup2, fd, newfd); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_dup2, fd, newfd); #elif defined(SYS_dup3) - int ret = __llvm_libc::syscall_impl<int>(SYS_dup3, fd, newfd, 0); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_dup3, fd, newfd, 0); #else #error "dup2 and dup3 syscalls not available." #endif @@ -68,8 +68,8 @@ bool dup2(int fd, int newfd) { // exit implementation which exits with code 127. void exit() { for (;;) { - __llvm_libc::syscall_impl<long>(SYS_exit_group, 127); - __llvm_libc::syscall_impl<long>(SYS_exit, 127); + LIBC_NAMESPACE::syscall_impl<long>(SYS_exit_group, 127); + LIBC_NAMESPACE::syscall_impl<long>(SYS_exit, 127); } } @@ -117,7 +117,7 @@ void child_process(const char *__restrict path, } } - if (__llvm_libc::syscall_impl<long>(SYS_execve, path, argv, envp) < 0) + if (LIBC_NAMESPACE::syscall_impl<long>(SYS_execve, path, argv, envp) < 0) exit(); } @@ -145,4 +145,4 @@ LLVM_LIBC_FUNCTION(int, posix_spawn, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/spawn/posix_spawn.h b/libc/src/spawn/posix_spawn.h index 7214627..354b94c 100644 --- a/libc/src/spawn/posix_spawn.h +++ b/libc/src/spawn/posix_spawn.h @@ -11,13 +11,13 @@ #include <spawn.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int posix_spawn(pid_t *__restrict pid, const char *__restrict path, const posix_spawn_file_actions_t *file_actions, const posix_spawnattr_t *__restrict attr, char *const *__restrict argv, char *const *__restrict envp); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SPAWN_POSIX_SPAWN_H diff --git a/libc/src/spawn/posix_spawn_file_actions_addclose.cpp b/libc/src/spawn/posix_spawn_file_actions_addclose.cpp index 492c3e0..9b3c488 100644 --- a/libc/src/spawn/posix_spawn_file_actions_addclose.cpp +++ b/libc/src/spawn/posix_spawn_file_actions_addclose.cpp @@ -15,7 +15,7 @@ #include <errno.h> #include <spawn.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, posix_spawn_file_actions_addclose, (posix_spawn_file_actions_t *__restrict actions, int fd)) { @@ -33,4 +33,4 @@ LLVM_LIBC_FUNCTION(int, posix_spawn_file_actions_addclose, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/spawn/posix_spawn_file_actions_addclose.h b/libc/src/spawn/posix_spawn_file_actions_addclose.h index 5eda292..c849651 100644 --- a/libc/src/spawn/posix_spawn_file_actions_addclose.h +++ b/libc/src/spawn/posix_spawn_file_actions_addclose.h @@ -11,11 +11,11 @@ #include <spawn.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int posix_spawn_file_actions_addclose( posix_spawn_file_actions_t *__restrict actions, int fd); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SPAWN_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE_H diff --git a/libc/src/spawn/posix_spawn_file_actions_adddup2.cpp b/libc/src/spawn/posix_spawn_file_actions_adddup2.cpp index ca18629..caa558e 100644 --- a/libc/src/spawn/posix_spawn_file_actions_adddup2.cpp +++ b/libc/src/spawn/posix_spawn_file_actions_adddup2.cpp @@ -15,7 +15,7 @@ #include <errno.h> #include <spawn.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, posix_spawn_file_actions_adddup2, (posix_spawn_file_actions_t * actions, int fd, int newfd)) { @@ -33,4 +33,4 @@ LLVM_LIBC_FUNCTION(int, posix_spawn_file_actions_adddup2, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/spawn/posix_spawn_file_actions_adddup2.h b/libc/src/spawn/posix_spawn_file_actions_adddup2.h index 3344418..7a7f3a5 100644 --- a/libc/src/spawn/posix_spawn_file_actions_adddup2.h +++ b/libc/src/spawn/posix_spawn_file_actions_adddup2.h @@ -11,11 +11,11 @@ #include <spawn.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *actions, int fd, int newfd); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SPAWN_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2_H diff --git a/libc/src/spawn/posix_spawn_file_actions_addopen.cpp b/libc/src/spawn/posix_spawn_file_actions_addopen.cpp index 3b12c8b..c544f04 100644 --- a/libc/src/spawn/posix_spawn_file_actions_addopen.cpp +++ b/libc/src/spawn/posix_spawn_file_actions_addopen.cpp @@ -15,7 +15,7 @@ #include <errno.h> #include <spawn.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, posix_spawn_file_actions_addopen, (posix_spawn_file_actions_t *__restrict actions, int fd, @@ -34,4 +34,4 @@ LLVM_LIBC_FUNCTION(int, posix_spawn_file_actions_addopen, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/spawn/posix_spawn_file_actions_addopen.h b/libc/src/spawn/posix_spawn_file_actions_addopen.h index ff757d42..121213a 100644 --- a/libc/src/spawn/posix_spawn_file_actions_addopen.h +++ b/libc/src/spawn/posix_spawn_file_actions_addopen.h @@ -11,12 +11,12 @@ #include <spawn.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int posix_spawn_file_actions_addopen( posix_spawn_file_actions_t *__restrict actions, int fd, const char *__restrict path, int oflag, mode_t mode); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SPAWN_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN_H diff --git a/libc/src/spawn/posix_spawn_file_actions_destroy.cpp b/libc/src/spawn/posix_spawn_file_actions_destroy.cpp index 7be531c..73e0ac8 100644 --- a/libc/src/spawn/posix_spawn_file_actions_destroy.cpp +++ b/libc/src/spawn/posix_spawn_file_actions_destroy.cpp @@ -15,7 +15,7 @@ #include <errno.h> #include <spawn.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, posix_spawn_file_actions_destroy, (posix_spawn_file_actions_t * actions)) { @@ -49,4 +49,4 @@ LLVM_LIBC_FUNCTION(int, posix_spawn_file_actions_destroy, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/spawn/posix_spawn_file_actions_destroy.h b/libc/src/spawn/posix_spawn_file_actions_destroy.h index 89f3c55..28b9b05 100644 --- a/libc/src/spawn/posix_spawn_file_actions_destroy.h +++ b/libc/src/spawn/posix_spawn_file_actions_destroy.h @@ -11,10 +11,10 @@ #include <spawn.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *actions); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SPAWN_POSIX_SPAWN_FILE_ACTIONS_DESTROY_H diff --git a/libc/src/spawn/posix_spawn_file_actions_init.cpp b/libc/src/spawn/posix_spawn_file_actions_init.cpp index 99502ff..04e5610 100644 --- a/libc/src/spawn/posix_spawn_file_actions_init.cpp +++ b/libc/src/spawn/posix_spawn_file_actions_init.cpp @@ -12,7 +12,7 @@ #include <spawn.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, posix_spawn_file_actions_init, (posix_spawn_file_actions_t * actions)) { @@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(int, posix_spawn_file_actions_init, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/spawn/posix_spawn_file_actions_init.h b/libc/src/spawn/posix_spawn_file_actions_init.h index da354e1..d7b228f 100644 --- a/libc/src/spawn/posix_spawn_file_actions_init.h +++ b/libc/src/spawn/posix_spawn_file_actions_init.h @@ -11,10 +11,10 @@ #include <spawn.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int posix_spawn_file_actions_init(posix_spawn_file_actions_t *actions); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SPAWN_POSIX_SPAWN_FILE_ACTIONS_INIT_H diff --git a/libc/src/stdio/clearerr.h b/libc/src/stdio/clearerr.h index 446e0fd..b8e8d7c 100644 --- a/libc/src/stdio/clearerr.h +++ b/libc/src/stdio/clearerr.h @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void clearerr(::FILE *stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_CLEARERR_H diff --git a/libc/src/stdio/clearerr_unlocked.h b/libc/src/stdio/clearerr_unlocked.h index 8c14fd2..ff447ce 100644 --- a/libc/src/stdio/clearerr_unlocked.h +++ b/libc/src/stdio/clearerr_unlocked.h @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void clearerr_unlocked(::FILE *stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_CLEARERR_UNLOCKED_H diff --git a/libc/src/stdio/fclose.h b/libc/src/stdio/fclose.h index 21ffa43..7fe6951 100644 --- a/libc/src/stdio/fclose.h +++ b/libc/src/stdio/fclose.h @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fclose(::FILE *stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FCLOSE_H diff --git a/libc/src/stdio/feof.h b/libc/src/stdio/feof.h index eab056e..66a49bdd 100644 --- a/libc/src/stdio/feof.h +++ b/libc/src/stdio/feof.h @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int feof(::FILE *stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FEOF_H diff --git a/libc/src/stdio/feof_unlocked.h b/libc/src/stdio/feof_unlocked.h index 8e20f96..359609c 100644 --- a/libc/src/stdio/feof_unlocked.h +++ b/libc/src/stdio/feof_unlocked.h @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int feof_unlocked(::FILE *stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FEOF_UNLOCKED_H diff --git a/libc/src/stdio/ferror.h b/libc/src/stdio/ferror.h index 3971cff..194dff6 100644 --- a/libc/src/stdio/ferror.h +++ b/libc/src/stdio/ferror.h @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int ferror(::FILE *stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FERROR_H diff --git a/libc/src/stdio/ferror_unlocked.h b/libc/src/stdio/ferror_unlocked.h index 9b0f12c..8628102 100644 --- a/libc/src/stdio/ferror_unlocked.h +++ b/libc/src/stdio/ferror_unlocked.h @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int ferror_unlocked(::FILE *stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FERROR_UNLOCKED_H diff --git a/libc/src/stdio/fflush.cpp b/libc/src/stdio/fflush.cpp index d7a5652..dc5275b 100644 --- a/libc/src/stdio/fflush.cpp +++ b/libc/src/stdio/fflush.cpp @@ -12,10 +12,10 @@ #include "src/errno/libc_errno.h" #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fflush, (::FILE * stream)) { - int result = reinterpret_cast<__llvm_libc::File *>(stream)->flush(); + int result = reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->flush(); if (result != 0) { libc_errno = result; return EOF; @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, fflush, (::FILE * stream)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/fflush.h b/libc/src/stdio/fflush.h index f2adbe1..839fd98 100644 --- a/libc/src/stdio/fflush.h +++ b/libc/src/stdio/fflush.h @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fflush(::FILE *stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FFLUSH_H diff --git a/libc/src/stdio/fgetc.h b/libc/src/stdio/fgetc.h index 13d22de..26a3248 100644 --- a/libc/src/stdio/fgetc.h +++ b/libc/src/stdio/fgetc.h @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fgetc(::FILE *f); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FGETC_H diff --git a/libc/src/stdio/fgetc_unlocked.h b/libc/src/stdio/fgetc_unlocked.h index e374a6d..f765e8d 100644 --- a/libc/src/stdio/fgetc_unlocked.h +++ b/libc/src/stdio/fgetc_unlocked.h @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fgetc_unlocked(::FILE *f); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FGETC_UNLOCKED_H diff --git a/libc/src/stdio/fgets.h b/libc/src/stdio/fgets.h index 6f4ed93..4264557 100644 --- a/libc/src/stdio/fgets.h +++ b/libc/src/stdio/fgets.h @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { char *fgets(char *__restrict str, int count, ::FILE *__restrict raw_stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FGETS_H diff --git a/libc/src/stdio/flockfile.cpp b/libc/src/stdio/flockfile.cpp index 3b13a6f4..62606c9 100644 --- a/libc/src/stdio/flockfile.cpp +++ b/libc/src/stdio/flockfile.cpp @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, flockfile, (::FILE * stream)) { - reinterpret_cast<__llvm_libc::File *>(stream)->lock(); + reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->lock(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/flockfile.h b/libc/src/stdio/flockfile.h index 961ad8f..1509c14 100644 --- a/libc/src/stdio/flockfile.h +++ b/libc/src/stdio/flockfile.h @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void flockfile(::FILE *stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FLOCKFILE_H diff --git a/libc/src/stdio/fopen.h b/libc/src/stdio/fopen.h index f8ab054..68f93f5 100644 --- a/libc/src/stdio/fopen.h +++ b/libc/src/stdio/fopen.h @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { ::FILE *fopen(const char *__restrict name, const char *__restrict mode); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FOPEN_H diff --git a/libc/src/stdio/fopencookie.cpp b/libc/src/stdio/fopencookie.cpp index 7a4479c..2cb7ad2 100644 --- a/libc/src/stdio/fopencookie.cpp +++ b/libc/src/stdio/fopencookie.cpp @@ -14,11 +14,11 @@ #include <stdio.h> #include <stdlib.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace { -class CookieFile : public __llvm_libc::File { +class CookieFile : public LIBC_NAMESPACE::File { void *cookie; cookie_io_functions_t ops; @@ -96,4 +96,4 @@ LLVM_LIBC_FUNCTION(::FILE *, fopencookie, return reinterpret_cast<::FILE *>(file); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/fopencookie.h b/libc/src/stdio/fopencookie.h index d78e5ac..3dff894 100644 --- a/libc/src/stdio/fopencookie.h +++ b/libc/src/stdio/fopencookie.h @@ -11,11 +11,11 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { ::FILE *fopencookie(void *cookie, const char *__restrict mode, cookie_io_functions_t desc); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FOPENCOOKIE_H diff --git a/libc/src/stdio/fprintf.cpp b/libc/src/stdio/fprintf.cpp index e13ed4d..87b0e74 100644 --- a/libc/src/stdio/fprintf.cpp +++ b/libc/src/stdio/fprintf.cpp @@ -15,7 +15,7 @@ #include <stdarg.h> #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fprintf, (::FILE *__restrict stream, const char *__restrict format, @@ -30,4 +30,4 @@ LLVM_LIBC_FUNCTION(int, fprintf, return ret_val; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/fprintf.h b/libc/src/stdio/fprintf.h index caac3e8..41cd8a8 100644 --- a/libc/src/stdio/fprintf.h +++ b/libc/src/stdio/fprintf.h @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fprintf(::FILE *__restrict stream, const char *__restrict format, ...); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FPRINTF_H diff --git a/libc/src/stdio/fputc.h b/libc/src/stdio/fputc.h index 24732ec..578e569 100644 --- a/libc/src/stdio/fputc.h +++ b/libc/src/stdio/fputc.h @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fputc(int c, ::FILE *stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FPUTC_H diff --git a/libc/src/stdio/fputs.h b/libc/src/stdio/fputs.h index 2419fe8..0238e46 100644 --- a/libc/src/stdio/fputs.h +++ b/libc/src/stdio/fputs.h @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fputs(const char *__restrict str, ::FILE *__restrict stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FPUTS_H diff --git a/libc/src/stdio/fread.h b/libc/src/stdio/fread.h index 995367c..ae22950 100644 --- a/libc/src/stdio/fread.h +++ b/libc/src/stdio/fread.h @@ -11,11 +11,11 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { size_t fread(void *__restrict buffer, size_t size, size_t nmemb, ::FILE *stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FREAD_H diff --git a/libc/src/stdio/fread_unlocked.h b/libc/src/stdio/fread_unlocked.h index 5c965b0..7cd0ed3 100644 --- a/libc/src/stdio/fread_unlocked.h +++ b/libc/src/stdio/fread_unlocked.h @@ -11,11 +11,11 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { size_t fread_unlocked(void *__restrict buffer, size_t size, size_t nmemb, ::FILE *stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FREAD_UNLOCKED_H diff --git a/libc/src/stdio/fscanf.cpp b/libc/src/stdio/fscanf.cpp index 4fe0a3e..188e28e 100644 --- a/libc/src/stdio/fscanf.cpp +++ b/libc/src/stdio/fscanf.cpp @@ -15,7 +15,7 @@ #include <stdarg.h> #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fscanf, (::FILE *__restrict stream, const char *__restrict format, @@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(int, fscanf, return (ret_val == -1) ? EOF : ret_val; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/fscanf.h b/libc/src/stdio/fscanf.h index cc36cd7..0e2247d 100644 --- a/libc/src/stdio/fscanf.h +++ b/libc/src/stdio/fscanf.h @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fscanf(::FILE *__restrict stream, const char *__restrict format, ...); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FSCANF_H diff --git a/libc/src/stdio/fseek.cpp b/libc/src/stdio/fseek.cpp index 928ff84..7666e71 100644 --- a/libc/src/stdio/fseek.cpp +++ b/libc/src/stdio/fseek.cpp @@ -12,11 +12,11 @@ #include "src/errno/libc_errno.h" #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fseek, (::FILE * stream, long offset, int whence)) { auto result = - reinterpret_cast<__llvm_libc::File *>(stream)->seek(offset, whence); + reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->seek(offset, whence); if (!result.has_value()) { libc_errno = result.error(); return -1; @@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, fseek, (::FILE * stream, long offset, int whence)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/fseek.h b/libc/src/stdio/fseek.h index f3865c4..6a7f715 100644 --- a/libc/src/stdio/fseek.h +++ b/libc/src/stdio/fseek.h @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fseek(::FILE *stream, long offset, int whence); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FSEEK_H diff --git a/libc/src/stdio/ftell.cpp b/libc/src/stdio/ftell.cpp index 697e9bc..5f78031 100644 --- a/libc/src/stdio/ftell.cpp +++ b/libc/src/stdio/ftell.cpp @@ -12,10 +12,10 @@ #include "src/errno/libc_errno.h" #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(long, ftell, (::FILE * stream)) { - auto result = reinterpret_cast<__llvm_libc::File *>(stream)->tell(); + auto result = reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->tell(); if (!result.has_value()) { libc_errno = result.error(); return -1; @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(long, ftell, (::FILE * stream)) { return result.value(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/ftell.h b/libc/src/stdio/ftell.h index 95d4494..e72bb8b 100644 --- a/libc/src/stdio/ftell.h +++ b/libc/src/stdio/ftell.h @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { long ftell(::FILE *f); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FTELL_H diff --git a/libc/src/stdio/funlockfile.cpp b/libc/src/stdio/funlockfile.cpp index 6c7dbee..88e2eae 100644 --- a/libc/src/stdio/funlockfile.cpp +++ b/libc/src/stdio/funlockfile.cpp @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, funlockfile, (::FILE * stream)) { - reinterpret_cast<__llvm_libc::File *>(stream)->unlock(); + reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->unlock(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/funlockfile.h b/libc/src/stdio/funlockfile.h index cb04b7e..c50f9dd 100644 --- a/libc/src/stdio/funlockfile.h +++ b/libc/src/stdio/funlockfile.h @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void funlockfile(::FILE *stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FUNLOCKFILE_H diff --git a/libc/src/stdio/fwrite.h b/libc/src/stdio/fwrite.h index eb258fc..a71f20c 100644 --- a/libc/src/stdio/fwrite.h +++ b/libc/src/stdio/fwrite.h @@ -11,11 +11,11 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { size_t fwrite(const void *__restrict ptr, size_t size, size_t nmemb, ::FILE *__restrict stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FWRITE_H diff --git a/libc/src/stdio/fwrite_unlocked.h b/libc/src/stdio/fwrite_unlocked.h index 33bcc21..7012e0d 100644 --- a/libc/src/stdio/fwrite_unlocked.h +++ b/libc/src/stdio/fwrite_unlocked.h @@ -11,11 +11,11 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { size_t fwrite_unlocked(const void *__restrict ptr, size_t size, size_t nmemb, ::FILE *__restrict stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FWRITE_UNLOCKED_H diff --git a/libc/src/stdio/generic/clearerr.cpp b/libc/src/stdio/generic/clearerr.cpp index 95556bf..1f1ce38 100644 --- a/libc/src/stdio/generic/clearerr.cpp +++ b/libc/src/stdio/generic/clearerr.cpp @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, clearerr, (::FILE * stream)) { - reinterpret_cast<__llvm_libc::File *>(stream)->clearerr(); + reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->clearerr(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/clearerr_unlocked.cpp b/libc/src/stdio/generic/clearerr_unlocked.cpp index 88f26a8..2840e37 100644 --- a/libc/src/stdio/generic/clearerr_unlocked.cpp +++ b/libc/src/stdio/generic/clearerr_unlocked.cpp @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, clearerr_unlocked, (::FILE * stream)) { - reinterpret_cast<__llvm_libc::File *>(stream)->clearerr_unlocked(); + reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->clearerr_unlocked(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/fclose.cpp b/libc/src/stdio/generic/fclose.cpp index da75e9b..cc163ab 100644 --- a/libc/src/stdio/generic/fclose.cpp +++ b/libc/src/stdio/generic/fclose.cpp @@ -12,10 +12,10 @@ #include "src/errno/libc_errno.h" #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fclose, (::FILE * stream)) { - int result = reinterpret_cast<__llvm_libc::File *>(stream)->close(); + int result = reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->close(); if (result != 0) { libc_errno = result; return EOF; @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, fclose, (::FILE * stream)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/feof.cpp b/libc/src/stdio/generic/feof.cpp index 3d22a19..311561c 100644 --- a/libc/src/stdio/generic/feof.cpp +++ b/libc/src/stdio/generic/feof.cpp @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, feof, (::FILE * stream)) { - return reinterpret_cast<__llvm_libc::File *>(stream)->iseof(); + return reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->iseof(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/feof_unlocked.cpp b/libc/src/stdio/generic/feof_unlocked.cpp index fdb9e2c..e8c718c 100644 --- a/libc/src/stdio/generic/feof_unlocked.cpp +++ b/libc/src/stdio/generic/feof_unlocked.cpp @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, feof_unlocked, (::FILE * stream)) { - return reinterpret_cast<__llvm_libc::File *>(stream)->iseof_unlocked(); + return reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->iseof_unlocked(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/ferror.cpp b/libc/src/stdio/generic/ferror.cpp index 12bfc2a..65cf99f 100644 --- a/libc/src/stdio/generic/ferror.cpp +++ b/libc/src/stdio/generic/ferror.cpp @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, ferror, (::FILE * stream)) { - return reinterpret_cast<__llvm_libc::File *>(stream)->error(); + return reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->error(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/ferror_unlocked.cpp b/libc/src/stdio/generic/ferror_unlocked.cpp index 301aa83..089ea4a 100644 --- a/libc/src/stdio/generic/ferror_unlocked.cpp +++ b/libc/src/stdio/generic/ferror_unlocked.cpp @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, ferror_unlocked, (::FILE * stream)) { - return reinterpret_cast<__llvm_libc::File *>(stream)->error_unlocked(); + return reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->error_unlocked(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/fgetc.cpp b/libc/src/stdio/generic/fgetc.cpp index 9a61096..7718113 100644 --- a/libc/src/stdio/generic/fgetc.cpp +++ b/libc/src/stdio/generic/fgetc.cpp @@ -12,11 +12,11 @@ #include "src/errno/libc_errno.h" #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fgetc, (::FILE * stream)) { unsigned char c; - auto result = reinterpret_cast<__llvm_libc::File *>(stream)->read(&c, 1); + auto result = reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->read(&c, 1); size_t r = result.value; if (result.has_error()) libc_errno = result.error; @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, fgetc, (::FILE * stream)) { return c; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/fgetc_unlocked.cpp b/libc/src/stdio/generic/fgetc_unlocked.cpp index 032a9fb..e7aaf9d 100644 --- a/libc/src/stdio/generic/fgetc_unlocked.cpp +++ b/libc/src/stdio/generic/fgetc_unlocked.cpp @@ -12,12 +12,12 @@ #include "src/errno/libc_errno.h" #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fgetc_unlocked, (::FILE * stream)) { unsigned char c; auto result = - reinterpret_cast<__llvm_libc::File *>(stream)->read_unlocked(&c, 1); + reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->read_unlocked(&c, 1); size_t r = result.value; if (result.has_error()) libc_errno = result.error; @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, fgetc_unlocked, (::FILE * stream)) { return c; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/fgets.cpp b/libc/src/stdio/generic/fgets.cpp index dd5051a..8c9dac8 100644 --- a/libc/src/stdio/generic/fgets.cpp +++ b/libc/src/stdio/generic/fgets.cpp @@ -13,7 +13,7 @@ #include <stddef.h> #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(char *, fgets, (char *__restrict str, int count, @@ -22,7 +22,7 @@ LLVM_LIBC_FUNCTION(char *, fgets, return nullptr; unsigned char c = '\0'; - auto stream = reinterpret_cast<__llvm_libc::File *__restrict>(raw_stream); + auto stream = reinterpret_cast<LIBC_NAMESPACE::File *__restrict>(raw_stream); stream->lock(); // i is an int because it's frequently compared to count, which is also int. @@ -52,4 +52,4 @@ LLVM_LIBC_FUNCTION(char *, fgets, return str; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/fopen.cpp b/libc/src/stdio/generic/fopen.cpp index 3062a05..794ef03 100644 --- a/libc/src/stdio/generic/fopen.cpp +++ b/libc/src/stdio/generic/fopen.cpp @@ -12,11 +12,11 @@ #include "src/errno/libc_errno.h" #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(::FILE *, fopen, (const char *__restrict name, const char *__restrict mode)) { - auto result = __llvm_libc::openfile(name, mode); + auto result = LIBC_NAMESPACE::openfile(name, mode); if (!result.has_value()) { libc_errno = result.error(); return nullptr; @@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(::FILE *, fopen, return reinterpret_cast<::FILE *>(result.value()); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/fputc.cpp b/libc/src/stdio/generic/fputc.cpp index 5f41e5c..ecbe45e 100644 --- a/libc/src/stdio/generic/fputc.cpp +++ b/libc/src/stdio/generic/fputc.cpp @@ -12,12 +12,12 @@ #include "src/errno/libc_errno.h" #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fputc, (int c, ::FILE *stream)) { unsigned char uc = static_cast<unsigned char>(c); - auto result = reinterpret_cast<__llvm_libc::File *>(stream)->write(&uc, 1); + auto result = reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->write(&uc, 1); if (result.has_error()) libc_errno = result.error; size_t written = result.value; @@ -29,4 +29,4 @@ LLVM_LIBC_FUNCTION(int, fputc, (int c, ::FILE *stream)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/fputs.cpp b/libc/src/stdio/generic/fputs.cpp index d8ba18f..ef77ad4 100644 --- a/libc/src/stdio/generic/fputs.cpp +++ b/libc/src/stdio/generic/fputs.cpp @@ -13,13 +13,13 @@ #include "src/errno/libc_errno.h" #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fputs, (const char *__restrict str, ::FILE *__restrict stream)) { cpp::string_view str_view(str); - auto result = reinterpret_cast<__llvm_libc::File *>(stream)->write( + auto result = reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->write( str, str_view.size()); if (result.has_error()) libc_errno = result.error; @@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(int, fputs, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/fread.cpp b/libc/src/stdio/generic/fread.cpp index affc6b7..e8bd251 100644 --- a/libc/src/stdio/generic/fread.cpp +++ b/libc/src/stdio/generic/fread.cpp @@ -12,18 +12,18 @@ #include "src/errno/libc_errno.h" #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(size_t, fread, (void *__restrict buffer, size_t size, size_t nmemb, ::FILE *stream)) { if (size == 0 || nmemb == 0) return 0; - auto result = - reinterpret_cast<__llvm_libc::File *>(stream)->read(buffer, size * nmemb); + auto result = reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->read( + buffer, size * nmemb); if (result.has_error()) libc_errno = result.error; return result.value / size; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/fread_unlocked.cpp b/libc/src/stdio/generic/fread_unlocked.cpp index 3f922c5..9810c9d 100644 --- a/libc/src/stdio/generic/fread_unlocked.cpp +++ b/libc/src/stdio/generic/fread_unlocked.cpp @@ -12,18 +12,18 @@ #include "src/errno/libc_errno.h" #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(size_t, fread_unlocked, (void *__restrict buffer, size_t size, size_t nmemb, ::FILE *stream)) { if (size == 0 || nmemb == 0) return 0; - auto result = reinterpret_cast<__llvm_libc::File *>(stream)->read_unlocked( + auto result = reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->read_unlocked( buffer, size * nmemb); if (result.has_error()) libc_errno = result.error; return result.value / size; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/fwrite.cpp b/libc/src/stdio/generic/fwrite.cpp index cc6c450..bd11f62 100644 --- a/libc/src/stdio/generic/fwrite.cpp +++ b/libc/src/stdio/generic/fwrite.cpp @@ -12,14 +12,14 @@ #include "src/errno/libc_errno.h" #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(size_t, fwrite, (const void *__restrict buffer, size_t size, size_t nmemb, ::FILE *stream)) { if (size == 0 || nmemb == 0) return 0; - auto result = reinterpret_cast<__llvm_libc::File *>(stream)->write( + auto result = reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->write( buffer, size * nmemb); if (result.has_error()) libc_errno = result.error; @@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(size_t, fwrite, return result.value / size; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/fwrite_unlocked.cpp b/libc/src/stdio/generic/fwrite_unlocked.cpp index 736dfe0..5ab7c76 100644 --- a/libc/src/stdio/generic/fwrite_unlocked.cpp +++ b/libc/src/stdio/generic/fwrite_unlocked.cpp @@ -12,7 +12,7 @@ #include "src/errno/libc_errno.h" #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(size_t, fwrite_unlocked, (const void *__restrict buffer, size_t size, size_t nmemb, @@ -20,12 +20,13 @@ LLVM_LIBC_FUNCTION(size_t, fwrite_unlocked, if (size == 0 || nmemb == 0) return 0; - auto result = reinterpret_cast<__llvm_libc::File *>(stream)->write_unlocked( - buffer, size * nmemb); + auto result = + reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->write_unlocked( + buffer, size * nmemb); if (result.has_error()) libc_errno = result.error; return result.value / size; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/getc.cpp b/libc/src/stdio/generic/getc.cpp index 730be68..5cea28d 100644 --- a/libc/src/stdio/generic/getc.cpp +++ b/libc/src/stdio/generic/getc.cpp @@ -12,11 +12,11 @@ #include "src/errno/libc_errno.h" #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, getc, (::FILE * stream)) { unsigned char c; - auto result = reinterpret_cast<__llvm_libc::File *>(stream)->read(&c, 1); + auto result = reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->read(&c, 1); size_t r = result.value; if (result.has_error()) libc_errno = result.error; @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, getc, (::FILE * stream)) { return c; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/getc_unlocked.cpp b/libc/src/stdio/generic/getc_unlocked.cpp index 4eae5c1..883405e 100644 --- a/libc/src/stdio/generic/getc_unlocked.cpp +++ b/libc/src/stdio/generic/getc_unlocked.cpp @@ -12,12 +12,12 @@ #include "src/errno/libc_errno.h" #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, getc_unlocked, (::FILE * stream)) { unsigned char c; auto result = - reinterpret_cast<__llvm_libc::File *>(stream)->read_unlocked(&c, 1); + reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->read_unlocked(&c, 1); size_t r = result.value; if (result.has_error()) libc_errno = result.error; @@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(int, getc_unlocked, (::FILE * stream)) { return c; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/getchar.cpp b/libc/src/stdio/generic/getchar.cpp index 91e01e3..181999f 100644 --- a/libc/src/stdio/generic/getchar.cpp +++ b/libc/src/stdio/generic/getchar.cpp @@ -12,7 +12,7 @@ #include "src/errno/libc_errno.h" #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, getchar, ()) { unsigned char c; @@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, getchar, ()) { return c; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/getchar_unlocked.cpp b/libc/src/stdio/generic/getchar_unlocked.cpp index 1a9a44e..be98d03 100644 --- a/libc/src/stdio/generic/getchar_unlocked.cpp +++ b/libc/src/stdio/generic/getchar_unlocked.cpp @@ -12,7 +12,7 @@ #include "src/errno/libc_errno.h" #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, getchar_unlocked, ()) { unsigned char c; @@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, getchar_unlocked, ()) { return c; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/putc.cpp b/libc/src/stdio/generic/putc.cpp index 37937df..58e3b4d 100644 --- a/libc/src/stdio/generic/putc.cpp +++ b/libc/src/stdio/generic/putc.cpp @@ -12,12 +12,12 @@ #include "src/errno/libc_errno.h" #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, putc, (int c, ::FILE *stream)) { unsigned char uc = static_cast<unsigned char>(c); - auto result = reinterpret_cast<__llvm_libc::File *>(stream)->write(&uc, 1); + auto result = reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->write(&uc, 1); if (result.has_error()) libc_errno = result.error; size_t written = result.value; @@ -29,4 +29,4 @@ LLVM_LIBC_FUNCTION(int, putc, (int c, ::FILE *stream)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/putchar.cpp b/libc/src/stdio/generic/putchar.cpp index 9190b71..4a4aeb5 100644 --- a/libc/src/stdio/generic/putchar.cpp +++ b/libc/src/stdio/generic/putchar.cpp @@ -12,12 +12,12 @@ #include "src/errno/libc_errno.h" #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, putchar, (int c)) { unsigned char uc = static_cast<unsigned char>(c); - auto result = __llvm_libc::stdout->write(&uc, 1); + auto result = LIBC_NAMESPACE::stdout->write(&uc, 1); if (result.has_error()) libc_errno = result.error; size_t written = result.value; @@ -29,4 +29,4 @@ LLVM_LIBC_FUNCTION(int, putchar, (int c)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/puts.cpp b/libc/src/stdio/generic/puts.cpp index ffcbf56..d8d6933 100644 --- a/libc/src/stdio/generic/puts.cpp +++ b/libc/src/stdio/generic/puts.cpp @@ -13,11 +13,11 @@ #include "src/errno/libc_errno.h" #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, puts, (const char *__restrict str)) { cpp::string_view str_view(str); - auto result = __llvm_libc::stdout->write(str, str_view.size()); + auto result = LIBC_NAMESPACE::stdout->write(str, str_view.size()); if (result.has_error()) libc_errno = result.error; size_t written = result.value; @@ -25,7 +25,7 @@ LLVM_LIBC_FUNCTION(int, puts, (const char *__restrict str)) { // The stream should be in an error state in this case. return EOF; } - result = __llvm_libc::stdout->write("\n", 1); + result = LIBC_NAMESPACE::stdout->write("\n", 1); if (result.has_error()) libc_errno = result.error; written = result.value; @@ -36,4 +36,4 @@ LLVM_LIBC_FUNCTION(int, puts, (const char *__restrict str)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/getc.h b/libc/src/stdio/getc.h index b5de6a7..c085d35 100644 --- a/libc/src/stdio/getc.h +++ b/libc/src/stdio/getc.h @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int getc(::FILE *f); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_GETC_H diff --git a/libc/src/stdio/getc_unlocked.h b/libc/src/stdio/getc_unlocked.h index b318dfc..f4e1165 100644 --- a/libc/src/stdio/getc_unlocked.h +++ b/libc/src/stdio/getc_unlocked.h @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int getc_unlocked(::FILE *f); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_GETC_UNLOCKED_H diff --git a/libc/src/stdio/getchar.h b/libc/src/stdio/getchar.h index 51f2f7a..4168808 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 6bbd49a..24fdb75 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 01c34ca..2267fdf 100644 --- a/libc/src/stdio/gpu/clearerr.cpp +++ b/libc/src/stdio/gpu/clearerr.cpp @@ -11,7 +11,7 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, clearerr, (::FILE * stream)) { rpc::Client::Port port = rpc::client.open<RPC_CLEARERR>(); @@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(void, clearerr, (::FILE * stream)) { port.close(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/fclose.cpp b/libc/src/stdio/gpu/fclose.cpp index a8e36bc..bdedbe5 100644 --- a/libc/src/stdio/gpu/fclose.cpp +++ b/libc/src/stdio/gpu/fclose.cpp @@ -11,7 +11,7 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fclose, (::FILE * stream)) { uint64_t ret = 0; @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, fclose, (::FILE * stream)) { return static_cast<int>(ret); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/feof.cpp b/libc/src/stdio/gpu/feof.cpp index 27d27a4..ddcef38 100644 --- a/libc/src/stdio/gpu/feof.cpp +++ b/libc/src/stdio/gpu/feof.cpp @@ -11,7 +11,7 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, feof, (::FILE * stream)) { int ret; @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, feof, (::FILE * stream)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/ferror.cpp b/libc/src/stdio/gpu/ferror.cpp index e4bd631..9ed598f 100644 --- a/libc/src/stdio/gpu/ferror.cpp +++ b/libc/src/stdio/gpu/ferror.cpp @@ -11,7 +11,7 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, ferror, (::FILE * stream)) { int ret; @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, ferror, (::FILE * stream)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/fgetc.cpp b/libc/src/stdio/gpu/fgetc.cpp index ff4ef27..56f42a0 100644 --- a/libc/src/stdio/gpu/fgetc.cpp +++ b/libc/src/stdio/gpu/fgetc.cpp @@ -11,7 +11,7 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fgetc, (::FILE * stream)) { unsigned char c; @@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(int, fgetc, (::FILE * stream)) { return c; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/fgets.cpp b/libc/src/stdio/gpu/fgets.cpp index df00451..4cabd15 100644 --- a/libc/src/stdio/gpu/fgets.cpp +++ b/libc/src/stdio/gpu/fgets.cpp @@ -14,7 +14,7 @@ #include <stddef.h> #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(char *, fgets, (char *__restrict str, int count, @@ -33,8 +33,8 @@ LLVM_LIBC_FUNCTION(char *, fgets, str[i] = c; } - bool has_error = __llvm_libc::ferror(stream); - bool has_eof = __llvm_libc::feof(stream); + bool has_error = LIBC_NAMESPACE::ferror(stream); + bool has_eof = LIBC_NAMESPACE::feof(stream); if (has_error || (i == 0 && has_eof)) return nullptr; @@ -43,4 +43,4 @@ LLVM_LIBC_FUNCTION(char *, fgets, return str; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/file.h b/libc/src/stdio/gpu/file.h index 4b07f9f..2cab2e6 100644 --- a/libc/src/stdio/gpu/file.h +++ b/libc/src/stdio/gpu/file.h @@ -11,7 +11,7 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace file { 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 5d88b65..41d2c89 100644 --- a/libc/src/stdio/gpu/fopen.cpp +++ b/libc/src/stdio/gpu/fopen.cpp @@ -12,7 +12,7 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(::FILE *, fopen, (const char *__restrict path, const char *__restrict mode)) { @@ -29,4 +29,4 @@ LLVM_LIBC_FUNCTION(::FILE *, fopen, return reinterpret_cast<FILE *>(file); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/fputc.cpp b/libc/src/stdio/gpu/fputc.cpp index 90d2389..e6ef12f 100644 --- a/libc/src/stdio/gpu/fputc.cpp +++ b/libc/src/stdio/gpu/fputc.cpp @@ -11,7 +11,7 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fputc, (int c, ::FILE *stream)) { unsigned char uc = static_cast<unsigned char>(c); @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, fputc, (int c, ::FILE *stream)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/fputs.cpp b/libc/src/stdio/gpu/fputs.cpp index c5919e8..1b6e073 100644 --- a/libc/src/stdio/gpu/fputs.cpp +++ b/libc/src/stdio/gpu/fputs.cpp @@ -13,7 +13,7 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fputs, (const char *__restrict str, ::FILE *__restrict stream)) { @@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, fputs, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/fread.cpp b/libc/src/stdio/gpu/fread.cpp index 2b9112e..fe367ae1 100644 --- a/libc/src/stdio/gpu/fread.cpp +++ b/libc/src/stdio/gpu/fread.cpp @@ -11,7 +11,7 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(size_t, fread, (void *__restrict buffer, size_t size, size_t nmemb, @@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(size_t, fread, return result / size; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/fwrite.cpp b/libc/src/stdio/gpu/fwrite.cpp index fccaabd..a059bd5 100644 --- a/libc/src/stdio/gpu/fwrite.cpp +++ b/libc/src/stdio/gpu/fwrite.cpp @@ -11,7 +11,7 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(size_t, fwrite, (const void *__restrict buffer, size_t size, size_t nmemb, @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(size_t, fwrite, return result / size; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/getc.cpp b/libc/src/stdio/gpu/getc.cpp index a227222..b50e396 100644 --- a/libc/src/stdio/gpu/getc.cpp +++ b/libc/src/stdio/gpu/getc.cpp @@ -11,7 +11,7 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, getc, (::FILE * stream)) { unsigned char c; @@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(int, getc, (::FILE * stream)) { return c; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/getchar.cpp b/libc/src/stdio/gpu/getchar.cpp index a7a6e6c..c8a0041 100644 --- a/libc/src/stdio/gpu/getchar.cpp +++ b/libc/src/stdio/gpu/getchar.cpp @@ -11,7 +11,7 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, getchar, ()) { unsigned char c; @@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(int, getchar, ()) { return c; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/putc.cpp b/libc/src/stdio/gpu/putc.cpp index d450edb..b5ecbfc 100644 --- a/libc/src/stdio/gpu/putc.cpp +++ b/libc/src/stdio/gpu/putc.cpp @@ -11,7 +11,7 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, putc, (int c, ::FILE *stream)) { unsigned char uc = static_cast<unsigned char>(c); @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, putc, (int c, ::FILE *stream)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/putchar.cpp b/libc/src/stdio/gpu/putchar.cpp index df57754..57663ee 100644 --- a/libc/src/stdio/gpu/putchar.cpp +++ b/libc/src/stdio/gpu/putchar.cpp @@ -11,7 +11,7 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, putchar, (int c)) { unsigned char uc = static_cast<unsigned char>(c); @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, putchar, (int c)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/puts.cpp b/libc/src/stdio/gpu/puts.cpp index e50e2cc..10573a8 100644 --- a/libc/src/stdio/gpu/puts.cpp +++ b/libc/src/stdio/gpu/puts.cpp @@ -13,7 +13,7 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, puts, (const char *__restrict str)) { cpp::string_view str_view(str); @@ -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 5e7b79e..7084682 100644 --- a/libc/src/stdio/gpu/stderr.cpp +++ b/libc/src/stdio/gpu/stderr.cpp @@ -8,9 +8,9 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { static struct { } stub; FILE *stderr = reinterpret_cast<FILE *>(&stub); -} // namespace __llvm_libc -extern "C" FILE *stderr = reinterpret_cast<FILE *>(&__llvm_libc::stub); +} // namespace LIBC_NAMESPACE +extern "C" FILE *stderr = reinterpret_cast<FILE *>(&LIBC_NAMESPACE::stub); diff --git a/libc/src/stdio/gpu/stdin.cpp b/libc/src/stdio/gpu/stdin.cpp index 408852b..1a58461 100644 --- a/libc/src/stdio/gpu/stdin.cpp +++ b/libc/src/stdio/gpu/stdin.cpp @@ -8,9 +8,9 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { static struct { } stub; FILE *stdin = reinterpret_cast<FILE *>(&stub); -} // namespace __llvm_libc -extern "C" FILE *stdin = reinterpret_cast<FILE *>(&__llvm_libc::stub); +} // namespace LIBC_NAMESPACE +extern "C" FILE *stdin = reinterpret_cast<FILE *>(&LIBC_NAMESPACE::stub); diff --git a/libc/src/stdio/gpu/stdout.cpp b/libc/src/stdio/gpu/stdout.cpp index 02425d3..abeeff2 100644 --- a/libc/src/stdio/gpu/stdout.cpp +++ b/libc/src/stdio/gpu/stdout.cpp @@ -8,9 +8,9 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { static struct { } stub; FILE *stdout = reinterpret_cast<FILE *>(&stub); -} // namespace __llvm_libc -extern "C" FILE *stdout = reinterpret_cast<FILE *>(&__llvm_libc::stub); +} // namespace LIBC_NAMESPACE +extern "C" FILE *stdout = reinterpret_cast<FILE *>(&LIBC_NAMESPACE::stub); diff --git a/libc/src/stdio/linux/remove.cpp b/libc/src/stdio/linux/remove.cpp index 1f97567..b2742c2 100644 --- a/libc/src/stdio/linux/remove.cpp +++ b/libc/src/stdio/linux/remove.cpp @@ -15,19 +15,19 @@ #include <fcntl.h> // For AT_* macros. #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, remove, (const char *path)) { // We first try unlinking it as a file. If it is ia file, it will succeed. If // it fails with EISDIR, we will try unlinking it as a directory. - int ret = __llvm_libc::syscall_impl<int>(SYS_unlinkat, AT_FDCWD, path, 0); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_unlinkat, AT_FDCWD, path, 0); if (ret == -EISDIR) - ret = __llvm_libc::syscall_impl<int>(SYS_unlinkat, AT_FDCWD, path, - AT_REMOVEDIR); + ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_unlinkat, AT_FDCWD, path, + AT_REMOVEDIR); if (ret >= 0) return 0; libc_errno = -ret; return -1; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/printf.cpp b/libc/src/stdio/printf.cpp index c59a084..5701ca9 100644 --- a/libc/src/stdio/printf.cpp +++ b/libc/src/stdio/printf.cpp @@ -16,12 +16,12 @@ #include <stdio.h> #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 c568b04..c5b4603 100644 --- a/libc/src/stdio/printf.h +++ b/libc/src/stdio/printf.h @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int printf(const char *__restrict format, ...); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_PRINTF_H diff --git a/libc/src/stdio/printf_core/char_converter.h b/libc/src/stdio/printf_core/char_converter.h index ffd2422..9b1501f 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 e27deb4..74a36cb 100644 --- a/libc/src/stdio/printf_core/converter.cpp +++ b/libc/src/stdio/printf_core/converter.cpp @@ -21,7 +21,7 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { int convert(Writer *writer, const FormatSection &to_conv) { @@ -86,4 +86,4 @@ int convert(Writer *writer, const FormatSection &to_conv) { } } // namespace printf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/printf_core/converter.h b/libc/src/stdio/printf_core/converter.h index ae281ba..d653f1e 100644 --- a/libc/src/stdio/printf_core/converter.h +++ b/libc/src/stdio/printf_core/converter.h @@ -14,7 +14,7 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { // convert will call a conversion function to convert the FormatSection into @@ -23,6 +23,6 @@ namespace printf_core { int convert(Writer *writer, const FormatSection &to_conv); } // namespace printf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_CONVERTER_H diff --git a/libc/src/stdio/printf_core/converter_utils.h b/libc/src/stdio/printf_core/converter_utils.h index 54948a2..4540bba 100644 --- a/libc/src/stdio/printf_core/converter_utils.h +++ b/libc/src/stdio/printf_core/converter_utils.h @@ -16,7 +16,7 @@ #include <inttypes.h> #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { LIBC_INLINE uintmax_t apply_length_modifier(uintmax_t num, LengthModifier lm) { @@ -53,6 +53,6 @@ LIBC_INLINE uintmax_t apply_length_modifier(uintmax_t num, LengthModifier lm) { } } // namespace printf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_CONVERTER_UTILS_H diff --git a/libc/src/stdio/printf_core/core_structs.h b/libc/src/stdio/printf_core/core_structs.h index 771d5a8..e96bc4d 100644 --- a/libc/src/stdio/printf_core/core_structs.h +++ b/libc/src/stdio/printf_core/core_structs.h @@ -15,7 +15,7 @@ #include <inttypes.h> #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { // These length modifiers match the length modifiers in the format string, which @@ -111,6 +111,6 @@ constexpr int NULLPTR_WRITE_ERROR = -3; constexpr int INT_CONVERSION_ERROR = -4; } // namespace printf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_CORE_STRUCTS_H diff --git a/libc/src/stdio/printf_core/float_dec_converter.h b/libc/src/stdio/printf_core/float_dec_converter.h index 5e6f1d1..8c5ba0d2 100644 --- a/libc/src/stdio/printf_core/float_dec_converter.h +++ b/libc/src/stdio/printf_core/float_dec_converter.h @@ -28,7 +28,7 @@ #include <inttypes.h> #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { using MantissaInt = fputil::FPBits<long double>::UIntType; @@ -1176,6 +1176,6 @@ LIBC_INLINE int convert_float_dec_auto(Writer *writer, } } // namespace printf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_FLOAT_DEC_CONVERTER_H diff --git a/libc/src/stdio/printf_core/float_hex_converter.h b/libc/src/stdio/printf_core/float_hex_converter.h index 4bd0f91..e264af9 100644 --- a/libc/src/stdio/printf_core/float_hex_converter.h +++ b/libc/src/stdio/printf_core/float_hex_converter.h @@ -22,7 +22,7 @@ #include <inttypes.h> #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { using MantissaInt = fputil::FPBits<long double>::UIntType; @@ -256,6 +256,6 @@ LIBC_INLINE int convert_float_hex_exp(Writer *writer, } } // namespace printf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_FLOAT_HEX_CONVERTER_H diff --git a/libc/src/stdio/printf_core/float_inf_nan_converter.h b/libc/src/stdio/printf_core/float_inf_nan_converter.h index 0b7a1c3..3c24c39 100644 --- a/libc/src/stdio/printf_core/float_inf_nan_converter.h +++ b/libc/src/stdio/printf_core/float_inf_nan_converter.h @@ -18,7 +18,7 @@ #include <inttypes.h> #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { using MantissaInt = fputil::FPBits<long double>::UIntType; @@ -79,6 +79,6 @@ LIBC_INLINE int convert_inf_nan(Writer *writer, const FormatSection &to_conv) { } } // namespace printf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_FLOAT_INF_NAN_CONVERTER_H diff --git a/libc/src/stdio/printf_core/int_converter.h b/libc/src/stdio/printf_core/int_converter.h index 044721b..348e81a 100644 --- a/libc/src/stdio/printf_core/int_converter.h +++ b/libc/src/stdio/printf_core/int_converter.h @@ -20,7 +20,7 @@ #include <inttypes.h> #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { // These functions only work on characters that are already known to be in the @@ -189,6 +189,6 @@ LIBC_INLINE int convert_int(Writer *writer, const FormatSection &to_conv) { } } // namespace printf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_INT_CONVERTER_H diff --git a/libc/src/stdio/printf_core/parser.h b/libc/src/stdio/printf_core/parser.h index ddffe96..7cf87dd 100644 --- a/libc/src/stdio/printf_core/parser.h +++ b/libc/src/stdio/printf_core/parser.h @@ -19,7 +19,7 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { template <typename T> struct int_type_of { @@ -558,6 +558,6 @@ private: }; } // 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 60d1e21..54e70f5 100644 --- a/libc/src/stdio/printf_core/printf_main.cpp +++ b/libc/src/stdio/printf_core/printf_main.cpp @@ -16,7 +16,7 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { int printf_main(Writer *writer, const char *__restrict str, @@ -39,4 +39,4 @@ int printf_main(Writer *writer, const char *__restrict str, } } // namespace printf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/printf_core/printf_main.h b/libc/src/stdio/printf_core/printf_main.h index 341bd4c..15c6977 100644 --- a/libc/src/stdio/printf_core/printf_main.h +++ b/libc/src/stdio/printf_core/printf_main.h @@ -14,13 +14,13 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { int printf_main(Writer *writer, const char *__restrict str, internal::ArgList &args); } // namespace printf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_PRINTF_MAIN_H diff --git a/libc/src/stdio/printf_core/ptr_converter.h b/libc/src/stdio/printf_core/ptr_converter.h index 6304abc..73c6e60 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 460f195..1583153 100644 --- a/libc/src/stdio/printf_core/string_converter.h +++ b/libc/src/stdio/printf_core/string_converter.h @@ -17,7 +17,7 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { LIBC_INLINE int convert_string(Writer *writer, const FormatSection &to_conv) { @@ -59,6 +59,6 @@ LIBC_INLINE int convert_string(Writer *writer, const FormatSection &to_conv) { } } // namespace printf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_STRING_CONVERTER_H diff --git a/libc/src/stdio/printf_core/vfprintf_internal.h b/libc/src/stdio/printf_core/vfprintf_internal.h index d66b53b..c16c3ae 100644 --- a/libc/src/stdio/printf_core/vfprintf_internal.h +++ b/libc/src/stdio/printf_core/vfprintf_internal.h @@ -18,26 +18,26 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { #ifndef LIBC_COPT_STDIO_USE_SYSTEM_FILE LIBC_INLINE int ferror_unlocked(FILE *f) { - return reinterpret_cast<__llvm_libc::File *>(f)->error_unlocked(); + return reinterpret_cast<LIBC_NAMESPACE::File *>(f)->error_unlocked(); } LIBC_INLINE void flockfile(FILE *f) { - reinterpret_cast<__llvm_libc::File *>(f)->lock(); + reinterpret_cast<LIBC_NAMESPACE::File *>(f)->lock(); } LIBC_INLINE void funlockfile(FILE *f) { - reinterpret_cast<__llvm_libc::File *>(f)->unlock(); + reinterpret_cast<LIBC_NAMESPACE::File *>(f)->unlock(); } LIBC_INLINE size_t fwrite_unlocked(const void *ptr, size_t size, size_t nmemb, FILE *f) { - return reinterpret_cast<__llvm_libc::File *>(f)->write_unlocked(ptr, - size * nmemb); + return reinterpret_cast<LIBC_NAMESPACE::File *>(f)->write_unlocked( + ptr, size * nmemb); } #else // defined(LIBC_COPT_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 8204942..35cafac 100644 --- a/libc/src/stdio/printf_core/write_int_converter.h +++ b/libc/src/stdio/printf_core/write_int_converter.h @@ -16,7 +16,7 @@ #include <inttypes.h> #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { LIBC_INLINE int convert_write_int(Writer *writer, @@ -63,6 +63,6 @@ LIBC_INLINE int convert_write_int(Writer *writer, } } // namespace printf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_WRITE_INT_CONVERTER_H diff --git a/libc/src/stdio/printf_core/writer.cpp b/libc/src/stdio/printf_core/writer.cpp index 5f8091a..c831ca1 100644 --- a/libc/src/stdio/printf_core/writer.cpp +++ b/libc/src/stdio/printf_core/writer.cpp @@ -14,7 +14,7 @@ #include "src/string/memory_utils/inline_memset.h" #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { int Writer::pad(char new_char, size_t length) { @@ -44,4 +44,4 @@ int Writer::pad(char new_char, size_t length) { } } // namespace printf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/printf_core/writer.h b/libc/src/stdio/printf_core/writer.h index 1cf05de..1d4ff99 100644 --- a/libc/src/stdio/printf_core/writer.h +++ b/libc/src/stdio/printf_core/writer.h @@ -17,7 +17,7 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { struct WriteBuffer { @@ -134,6 +134,6 @@ public: }; } // 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 f21cad0..a8fb5b7 100644 --- a/libc/src/stdio/putc.h +++ b/libc/src/stdio/putc.h @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int putc(int c, ::FILE *stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_PUTC_H diff --git a/libc/src/stdio/putchar.h b/libc/src/stdio/putchar.h index e6df828..99a7453 100644 --- a/libc/src/stdio/putchar.h +++ b/libc/src/stdio/putchar.h @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int putchar(int c); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_PUTCHAR_H diff --git a/libc/src/stdio/puts.h b/libc/src/stdio/puts.h index fa5d6f7..11fbd0b 100644 --- a/libc/src/stdio/puts.h +++ b/libc/src/stdio/puts.h @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int puts(const char *__restrict str); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_PUTS_H diff --git a/libc/src/stdio/remove.h b/libc/src/stdio/remove.h index 4862799..8c52fe5 100644 --- a/libc/src/stdio/remove.h +++ b/libc/src/stdio/remove.h @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int remove(const char *path); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_REMOVE_H diff --git a/libc/src/stdio/scanf.cpp b/libc/src/stdio/scanf.cpp index 67c6e19..3a9fafa 100644 --- a/libc/src/stdio/scanf.cpp +++ b/libc/src/stdio/scanf.cpp @@ -16,12 +16,12 @@ #include <stdio.h> #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 6b4ece12a..58e42d1 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 5d7b7aa..5334af1 100644 --- a/libc/src/stdio/scanf_core/converter.cpp +++ b/libc/src/stdio/scanf_core/converter.cpp @@ -22,7 +22,7 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { int convert(Reader *reader, const FormatSection &to_conv) { @@ -99,4 +99,4 @@ int raw_match(Reader *reader, cpp::string_view raw_string) { } } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/scanf_core/converter.h b/libc/src/stdio/scanf_core/converter.h index cd91ff6..f741840 100644 --- a/libc/src/stdio/scanf_core/converter.h +++ b/libc/src/stdio/scanf_core/converter.h @@ -15,7 +15,7 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { // convert will call a conversion function to convert the FormatSection into @@ -28,6 +28,6 @@ int convert(Reader *reader, const FormatSection &to_conv); int raw_match(Reader *reader, cpp::string_view raw_string); } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_CONVERTER_H diff --git a/libc/src/stdio/scanf_core/converter_utils.h b/libc/src/stdio/scanf_core/converter_utils.h index a2e36e6..a14f357 100644 --- a/libc/src/stdio/scanf_core/converter_utils.h +++ b/libc/src/stdio/scanf_core/converter_utils.h @@ -17,7 +17,7 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { LIBC_INLINE constexpr char to_lower(char a) { return a | 32; } @@ -108,6 +108,6 @@ LIBC_INLINE void write_float_with_length(char *str, } } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_CONVERTER_UTILS_H diff --git a/libc/src/stdio/scanf_core/core_structs.h b/libc/src/stdio/scanf_core/core_structs.h index 4555595..246f770 100644 --- a/libc/src/stdio/scanf_core/core_structs.h +++ b/libc/src/stdio/scanf_core/core_structs.h @@ -16,7 +16,7 @@ #include <inttypes.h> #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { // These length modifiers match the length modifiers in the format string, which @@ -87,6 +87,6 @@ enum ErrorCodes : int { ALLOCATION_FAILURE = -4, }; } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_CORE_STRUCTS_H diff --git a/libc/src/stdio/scanf_core/current_pos_converter.h b/libc/src/stdio/scanf_core/current_pos_converter.h index be4b655..fd62383 100644 --- a/libc/src/stdio/scanf_core/current_pos_converter.h +++ b/libc/src/stdio/scanf_core/current_pos_converter.h @@ -16,7 +16,7 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { LIBC_INLINE int convert_current_pos(Reader *reader, @@ -26,6 +26,6 @@ LIBC_INLINE int convert_current_pos(Reader *reader, } } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_CURRENT_POS_CONVERTER_H diff --git a/libc/src/stdio/scanf_core/float_converter.cpp b/libc/src/stdio/scanf_core/float_converter.cpp index 5ffb9b0..47a43d5 100644 --- a/libc/src/stdio/scanf_core/float_converter.cpp +++ b/libc/src/stdio/scanf_core/float_converter.cpp @@ -17,7 +17,7 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { // All of the floating point conversions are the same for scanf, every name will @@ -223,4 +223,4 @@ int convert_float(Reader *reader, const FormatSection &to_conv) { } } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/scanf_core/float_converter.h b/libc/src/stdio/scanf_core/float_converter.h index e8abe8d..a3ea1da 100644 --- a/libc/src/stdio/scanf_core/float_converter.h +++ b/libc/src/stdio/scanf_core/float_converter.h @@ -14,12 +14,12 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { int convert_float(Reader *reader, const FormatSection &to_conv); } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_FLOAT_CONVERTER_H diff --git a/libc/src/stdio/scanf_core/int_converter.cpp b/libc/src/stdio/scanf_core/int_converter.cpp index 6370c98..05d6ed6 100644 --- a/libc/src/stdio/scanf_core/int_converter.cpp +++ b/libc/src/stdio/scanf_core/int_converter.cpp @@ -16,7 +16,7 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { // This code is very similar to the code in __support/str_to_integer.h but is @@ -212,4 +212,4 @@ int convert_int(Reader *reader, const FormatSection &to_conv) { } } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/scanf_core/int_converter.h b/libc/src/stdio/scanf_core/int_converter.h index af5ab3e..7c9d8b4 100644 --- a/libc/src/stdio/scanf_core/int_converter.h +++ b/libc/src/stdio/scanf_core/int_converter.h @@ -14,12 +14,12 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { int convert_int(Reader *reader, const FormatSection &to_conv); } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_INT_CONVERTER_H diff --git a/libc/src/stdio/scanf_core/parser.h b/libc/src/stdio/scanf_core/parser.h index f0cebc8..7f3a53b 100644 --- a/libc/src/stdio/scanf_core/parser.h +++ b/libc/src/stdio/scanf_core/parser.h @@ -18,7 +18,7 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { #ifndef LIBC_COPT_SCANF_DISABLE_INDEX_MODE @@ -280,6 +280,6 @@ private: }; } // 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 31d6476..cc233c3 100644 --- a/libc/src/stdio/scanf_core/ptr_converter.cpp +++ b/libc/src/stdio/scanf_core/ptr_converter.cpp @@ -15,7 +15,7 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { int convert_pointer(Reader *reader, const FormatSection &to_conv) { static const char nullptr_string[] = "(nullptr)"; @@ -40,4 +40,4 @@ int convert_pointer(Reader *reader, const FormatSection &to_conv) { return convert_int(reader, to_conv); } } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/scanf_core/ptr_converter.h b/libc/src/stdio/scanf_core/ptr_converter.h index 642898c..363d9aa 100644 --- a/libc/src/stdio/scanf_core/ptr_converter.h +++ b/libc/src/stdio/scanf_core/ptr_converter.h @@ -14,12 +14,12 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { int convert_pointer(Reader *reader, const FormatSection &to_conv); } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_PTR_CONVERTER_H diff --git a/libc/src/stdio/scanf_core/reader.cpp b/libc/src/stdio/scanf_core/reader.cpp index 45241d8..eca0e37 100644 --- a/libc/src/stdio/scanf_core/reader.cpp +++ b/libc/src/stdio/scanf_core/reader.cpp @@ -9,7 +9,7 @@ #include "src/stdio/scanf_core/reader.h" #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { void Reader::ungetc(char c) { @@ -25,4 +25,4 @@ void Reader::ungetc(char c) { stream_ungetc(static_cast<int>(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 7e9cfc5..d8647fe 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 <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { using StreamGetc = int (*)(void *); @@ -67,6 +67,6 @@ public: }; } // 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 ba6a92c..dc7740d 100644 --- a/libc/src/stdio/scanf_core/scanf_main.cpp +++ b/libc/src/stdio/scanf_core/scanf_main.cpp @@ -16,7 +16,7 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { int scanf_main(Reader *reader, const char *__restrict str, @@ -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 d1db46b..f1688d6 100644 --- a/libc/src/stdio/scanf_core/scanf_main.h +++ b/libc/src/stdio/scanf_core/scanf_main.h @@ -14,13 +14,13 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { int scanf_main(Reader *reader, const char *__restrict str, internal::ArgList &args); } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_SCANF_MAIN_H diff --git a/libc/src/stdio/scanf_core/string_converter.cpp b/libc/src/stdio/scanf_core/string_converter.cpp index bdbb5c8..94a7fc4 100644 --- a/libc/src/stdio/scanf_core/string_converter.cpp +++ b/libc/src/stdio/scanf_core/string_converter.cpp @@ -15,7 +15,7 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { int convert_string(Reader *reader, const FormatSection &to_conv) { @@ -73,4 +73,4 @@ int convert_string(Reader *reader, const FormatSection &to_conv) { } } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/scanf_core/string_converter.h b/libc/src/stdio/scanf_core/string_converter.h index 4113f5c..165fc47 100644 --- a/libc/src/stdio/scanf_core/string_converter.h +++ b/libc/src/stdio/scanf_core/string_converter.h @@ -14,12 +14,12 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { int convert_string(Reader *reader, const FormatSection &to_conv); } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_STRING_CONVERTER_H diff --git a/libc/src/stdio/scanf_core/vfscanf_internal.h b/libc/src/stdio/scanf_core/vfscanf_internal.h index 715d31ab1..8081136 100644 --- a/libc/src/stdio/scanf_core/vfscanf_internal.h +++ b/libc/src/stdio/scanf_core/vfscanf_internal.h @@ -16,23 +16,24 @@ #include <stdio.h> -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<LIBC_NAMESPACE::File *>(f)->lock(); } LIBC_INLINE void funlockfile(FILE *f) { - reinterpret_cast<__llvm_libc::File *>(f)->unlock(); + reinterpret_cast<LIBC_NAMESPACE::File *>(f)->unlock(); } LIBC_INLINE int getc(void *f) { unsigned char c; - auto result = reinterpret_cast<__llvm_libc::File *>(f)->read_unlocked(&c, 1); + auto result = + reinterpret_cast<LIBC_NAMESPACE::File *>(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<LIBC_NAMESPACE::File *>(f)->ungetc_unlocked(c); } LIBC_INLINE int ferror_unlocked(FILE *f) { - return reinterpret_cast<__llvm_libc::File *>(f)->error_unlocked(); + return reinterpret_cast<LIBC_NAMESPACE::File *>(f)->error_unlocked(); } #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 cb30fe3..8819901 100644 --- a/libc/src/stdio/setbuf.cpp +++ b/libc/src/stdio/setbuf.cpp @@ -12,17 +12,17 @@ #include "src/errno/libc_errno.h" #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, setbuf, (::FILE *__restrict stream, char *__restrict buf)) { int mode = _IOFBF; if (buf == nullptr) mode = _IONBF; - int err = reinterpret_cast<__llvm_libc::File *>(stream)->set_buffer( + int err = reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->set_buffer( buf, BUFSIZ, mode); if (err != 0) libc_errno = err; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/setbuf.h b/libc/src/stdio/setbuf.h index 7a158ac..9c7aab9 100644 --- a/libc/src/stdio/setbuf.h +++ b/libc/src/stdio/setbuf.h @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void setbuf(::FILE *__restrict stream, char *__restrict buf); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_SETBUF_H diff --git a/libc/src/stdio/setvbuf.cpp b/libc/src/stdio/setvbuf.cpp index 9080c55..5fdaebc 100644 --- a/libc/src/stdio/setvbuf.cpp +++ b/libc/src/stdio/setvbuf.cpp @@ -12,16 +12,16 @@ #include "src/errno/libc_errno.h" #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, setvbuf, (::FILE *__restrict stream, char *__restrict buf, int type, size_t size)) { - int err = reinterpret_cast<__llvm_libc::File *>(stream)->set_buffer(buf, size, - type); + int err = reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->set_buffer( + buf, size, type); if (err != 0) libc_errno = err; return err; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/setvbuf.h b/libc/src/stdio/setvbuf.h index bceedd8..21d9c99 100644 --- a/libc/src/stdio/setvbuf.h +++ b/libc/src/stdio/setvbuf.h @@ -11,11 +11,11 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int setvbuf(::FILE *__restrict stream, char *__restrict buf, int type, size_t size); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_SETVBUF_H diff --git a/libc/src/stdio/snprintf.cpp b/libc/src/stdio/snprintf.cpp index 4e1973f..fbfc2b2 100644 --- a/libc/src/stdio/snprintf.cpp +++ b/libc/src/stdio/snprintf.cpp @@ -15,7 +15,7 @@ #include <stdarg.h> #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, snprintf, (char *__restrict buffer, size_t buffsz, @@ -35,4 +35,4 @@ LLVM_LIBC_FUNCTION(int, snprintf, return ret_val; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/snprintf.h b/libc/src/stdio/snprintf.h index ec223be..0e4e398 100644 --- a/libc/src/stdio/snprintf.h +++ b/libc/src/stdio/snprintf.h @@ -11,11 +11,11 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int snprintf(char *__restrict buffer, size_t buffsz, const char *__restrict format, ...); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_SNPRINTF_H diff --git a/libc/src/stdio/sprintf.cpp b/libc/src/stdio/sprintf.cpp index 3e4206b..11f2f1a 100644 --- a/libc/src/stdio/sprintf.cpp +++ b/libc/src/stdio/sprintf.cpp @@ -15,7 +15,7 @@ #include <stdarg.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sprintf, (char *__restrict buffer, const char *__restrict format, @@ -35,4 +35,4 @@ LLVM_LIBC_FUNCTION(int, sprintf, return ret_val; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/sprintf.h b/libc/src/stdio/sprintf.h index 234de6e..14bb4fa 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 1f3e5ba..9bbd813 100644 --- a/libc/src/stdio/sscanf.cpp +++ b/libc/src/stdio/sscanf.cpp @@ -16,7 +16,7 @@ #include <stdarg.h> #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sscanf, (const char *__restrict buffer, @@ -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 7f63638..9e4b28e 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 de6ce0b..ccfbfb0 100644 --- a/libc/src/stdio/ungetc.cpp +++ b/libc/src/stdio/ungetc.cpp @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, ungetc, (int c, ::FILE *stream)) { - return reinterpret_cast<__llvm_libc::File *>(stream)->ungetc(c); + return reinterpret_cast<LIBC_NAMESPACE::File *>(stream)->ungetc(c); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/ungetc.h b/libc/src/stdio/ungetc.h index b5b7acb..c24d8e5 100644 --- a/libc/src/stdio/ungetc.h +++ b/libc/src/stdio/ungetc.h @@ -11,10 +11,10 @@ #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int ungetc(int c, ::FILE *stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_UNGETC_H diff --git a/libc/src/stdio/vfprintf.cpp b/libc/src/stdio/vfprintf.cpp index aa56c26..2504ce8 100644 --- a/libc/src/stdio/vfprintf.cpp +++ b/libc/src/stdio/vfprintf.cpp @@ -15,7 +15,7 @@ #include <stdarg.h> #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, vfprintf, (::FILE *__restrict stream, const char *__restrict format, @@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(int, vfprintf, return ret_val; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/vfprintf.h b/libc/src/stdio/vfprintf.h index b4a2d5e..01827c5 100644 --- a/libc/src/stdio/vfprintf.h +++ b/libc/src/stdio/vfprintf.h @@ -12,11 +12,11 @@ #include <stdarg.h> #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int vfprintf(::FILE *__restrict stream, const char *__restrict format, va_list vlist); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_VFPRINTF_H diff --git a/libc/src/stdio/vprintf.cpp b/libc/src/stdio/vprintf.cpp index 0789ee9..eff968d 100644 --- a/libc/src/stdio/vprintf.cpp +++ b/libc/src/stdio/vprintf.cpp @@ -16,12 +16,12 @@ #include <stdio.h> #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 ffc5d39..fe4252bd 100644 --- a/libc/src/stdio/vprintf.h +++ b/libc/src/stdio/vprintf.h @@ -12,10 +12,10 @@ #include <stdarg.h> #include <stdio.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int vprintf(const char *__restrict format, va_list vlist); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_VPRINTF_H diff --git a/libc/src/stdio/vsnprintf.cpp b/libc/src/stdio/vsnprintf.cpp index 0dc34a8..9446d3b 100644 --- a/libc/src/stdio/vsnprintf.cpp +++ b/libc/src/stdio/vsnprintf.cpp @@ -15,7 +15,7 @@ #include <stdarg.h> #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, vsnprintf, (char *__restrict buffer, size_t buffsz, @@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(int, vsnprintf, return ret_val; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/vsnprintf.h b/libc/src/stdio/vsnprintf.h index caa381e..6da25fc 100644 --- a/libc/src/stdio/vsnprintf.h +++ b/libc/src/stdio/vsnprintf.h @@ -12,11 +12,11 @@ #include <stdarg.h> #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int vsnprintf(char *__restrict buffer, size_t buffsz, const char *__restrict format, va_list vlist); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_VSNPRINTF_H diff --git a/libc/src/stdio/vsprintf.cpp b/libc/src/stdio/vsprintf.cpp index cf86f92..5ebdf9a 100644 --- a/libc/src/stdio/vsprintf.cpp +++ b/libc/src/stdio/vsprintf.cpp @@ -15,7 +15,7 @@ #include <stdarg.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, vsprintf, (char *__restrict buffer, const char *__restrict format, @@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(int, vsprintf, return ret_val; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/vsprintf.h b/libc/src/stdio/vsprintf.h index a129a2a..fe8def5 100644 --- a/libc/src/stdio/vsprintf.h +++ b/libc/src/stdio/vsprintf.h @@ -11,11 +11,11 @@ #include <stdarg.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int vsprintf(char *__restrict buffer, const char *__restrict format, va_list vlist); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_VSPRINTF_H diff --git a/libc/src/stdlib/_Exit.cpp b/libc/src/stdlib/_Exit.cpp index 5aec134..85684d1 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 f4ae326..bc05faf 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 d1e4385..d3bf1e9 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 eef7937..6be63e0 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 42ef7f8..19cef14 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 118c46a..10dff42 100644 --- a/libc/src/stdlib/atexit.cpp +++ b/libc/src/stdlib/atexit.cpp @@ -12,7 +12,7 @@ #include "src/__support/fixedvector.h" #include "src/__support/threads/mutex.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace { @@ -83,4 +83,4 @@ LLVM_LIBC_FUNCTION(int, atexit, (StdCAtExitCallback * callback)) { {&stdc_at_exit_func, reinterpret_cast<void *>(callback)}); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdlib/atexit.h b/libc/src/stdlib/atexit.h index 920d1eb..7cf9d7c 100644 --- a/libc/src/stdlib/atexit.h +++ b/libc/src/stdlib/atexit.h @@ -11,12 +11,12 @@ #include <stddef.h> // For size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { constexpr size_t CALLBACK_LIST_SIZE_FOR_TESTS = 1024; int atexit(void (*function)()); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDLIB_ATEXIT_H diff --git a/libc/src/stdlib/atof.cpp b/libc/src/stdlib/atof.cpp index 2359ce7..61eb7db 100644 --- a/libc/src/stdlib/atof.cpp +++ b/libc/src/stdlib/atof.cpp @@ -11,7 +11,7 @@ #include "src/__support/str_to_float.h" #include "src/errno/libc_errno.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(double, atof, (const char *str)) { auto result = internal::strtofloatingpoint<double>(str); @@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(double, atof, (const char *str)) { return result.value; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdlib/atof.h b/libc/src/stdlib/atof.h index c897a7e..cc9ae51 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 eec15aa..d1dc320 100644 --- a/libc/src/stdlib/atoi.cpp +++ b/libc/src/stdlib/atoi.cpp @@ -11,7 +11,7 @@ #include "src/__support/str_to_integer.h" #include "src/errno/libc_errno.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, atoi, (const char *str)) { // This is done because the standard specifies that atoi is identical to @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, atoi, (const char *str)) { return static_cast<int>(result); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdlib/atoi.h b/libc/src/stdlib/atoi.h index bb6c978..fb5de31 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 78928e8..5586db7 100644 --- a/libc/src/stdlib/atol.cpp +++ b/libc/src/stdlib/atol.cpp @@ -11,7 +11,7 @@ #include "src/__support/str_to_integer.h" #include "src/errno/libc_errno.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(long, atol, (const char *str)) { auto result = internal::strtointeger<long>(str, 10); @@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(long, atol, (const char *str)) { return result; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdlib/atol.h b/libc/src/stdlib/atol.h index 8ba6337..690731f 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 5047226..921459d 100644 --- a/libc/src/stdlib/atoll.cpp +++ b/libc/src/stdlib/atoll.cpp @@ -11,7 +11,7 @@ #include "src/__support/str_to_integer.h" #include "src/errno/libc_errno.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(long long, atoll, (const char *str)) { auto result = internal::strtointeger<long long>(str, 10); @@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(long long, atoll, (const char *str)) { return result; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdlib/atoll.h b/libc/src/stdlib/atoll.h index d99184f..4746eb1 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 f3164ce..4dd8536 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 a298e51..4292d6b 100644 --- a/libc/src/stdlib/bsearch.cpp +++ b/libc/src/stdlib/bsearch.cpp @@ -11,7 +11,7 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void *, bsearch, (const void *key, const void *array, size_t array_size, @@ -44,4 +44,4 @@ LLVM_LIBC_FUNCTION(void *, bsearch, return nullptr; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdlib/bsearch.h b/libc/src/stdlib/bsearch.h index aab86dc..1de7e05 100644 --- a/libc/src/stdlib/bsearch.h +++ b/libc/src/stdlib/bsearch.h @@ -11,11 +11,11 @@ #include <stdlib.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void *bsearch(const void *key, const void *array, size_t array_size, size_t elem_size, int (*compare)(const void *, const void *)); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif //LLVM_LIBC_SRC_STDLIB_BSEARCH_H diff --git a/libc/src/stdlib/div.cpp b/libc/src/stdlib/div.cpp index 44f1d9f..ee7c335 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 46d5948..3a6853f 100644 --- a/libc/src/stdlib/div.h +++ b/libc/src/stdlib/div.h @@ -11,10 +11,10 @@ #include <stdlib.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { div_t div(int x, int y); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDLIB_DIV_H diff --git a/libc/src/stdlib/exit.cpp b/libc/src/stdlib/exit.cpp index 6e2f104..cc5ae66 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 cbd9f97..b135735 100644 --- a/libc/src/stdlib/exit.h +++ b/libc/src/stdlib/exit.h @@ -11,10 +11,10 @@ #include <stdlib.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { [[noreturn]] void exit(int status); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDLIB_EXIT_H diff --git a/libc/src/stdlib/free.h b/libc/src/stdlib/free.h index 8129937..f802f1d 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 bb29e2c..08397e0 100644 --- a/libc/src/stdlib/getenv.cpp +++ b/libc/src/stdlib/getenv.cpp @@ -13,19 +13,19 @@ #include <stddef.h> // For size_t. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(char *, getenv, (const char *name)) { - char **env_ptr = reinterpret_cast<char **>(__llvm_libc::app.envPtr); + char **env_ptr = reinterpret_cast<char **>(LIBC_NAMESPACE::app.envPtr); if (name == nullptr || env_ptr == nullptr) return nullptr; - __llvm_libc::cpp::string_view env_var_name(name); + LIBC_NAMESPACE::cpp::string_view env_var_name(name); if (env_var_name.size() == 0) return nullptr; for (char **env = env_ptr; *env != nullptr; env++) { - __llvm_libc::cpp::string_view cur(*env); + LIBC_NAMESPACE::cpp::string_view cur(*env); if (!cur.starts_with(env_var_name)) continue; @@ -41,4 +41,4 @@ LLVM_LIBC_FUNCTION(char *, getenv, (const char *name)) { return nullptr; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdlib/getenv.h b/libc/src/stdlib/getenv.h index a7eac31..adb386b 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 441e776..f3b052b 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 64b60384..3a41e5f 100644 --- a/libc/src/stdlib/gpu/free.cpp +++ b/libc/src/stdlib/gpu/free.cpp @@ -10,7 +10,7 @@ #include "src/__support/RPC/rpc_client.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, free, (void *ptr)) { rpc::Client::Port port = rpc::client.open<RPC_FREE>(); @@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(void, free, (void *ptr)) { port.close(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdlib/gpu/malloc.cpp b/libc/src/stdlib/gpu/malloc.cpp index c63b838..a219690 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 a32f305..d9237fa 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 0f0ea99..b7af538 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 b08dc65..57e2250 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 ab2fe096..0f0fafa 100644 --- a/libc/src/stdlib/ldiv.h +++ b/libc/src/stdlib/ldiv.h @@ -11,10 +11,10 @@ #include <stdlib.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { ldiv_t ldiv(long x, long y); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDLIB_LDIV_H diff --git a/libc/src/stdlib/linux/abort.cpp b/libc/src/stdlib/linux/abort.cpp index 1da8161..59feec3 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 a72f362..f42c2b8 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 f173431..953fe17 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 ef3d037..ff2fdf8 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 b361e4e..ee7f4d3 100644 --- a/libc/src/stdlib/lldiv.h +++ b/libc/src/stdlib/lldiv.h @@ -10,10 +10,10 @@ #include <stdlib.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { lldiv_t lldiv(long long x, long long y); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDLIB_LLDIV_H diff --git a/libc/src/stdlib/malloc.h b/libc/src/stdlib/malloc.h index ecdf9c0..514e2b1 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 73cf5f8..f040f37 100644 --- a/libc/src/stdlib/qsort.cpp +++ b/libc/src/stdlib/qsort.cpp @@ -12,7 +12,7 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, qsort, (void *array, size_t array_size, size_t elem_size, @@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(void, qsort, array_size, elem_size, c)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdlib/qsort.h b/libc/src/stdlib/qsort.h index d716089..5c78481 100644 --- a/libc/src/stdlib/qsort.h +++ b/libc/src/stdlib/qsort.h @@ -11,11 +11,11 @@ #include <stdlib.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void qsort(void *array, size_t array_size, size_t elem_size, int (*compare)(const void *, const void *)); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDLIB_QSORT_H diff --git a/libc/src/stdlib/qsort_r.cpp b/libc/src/stdlib/qsort_r.cpp index add0308..7589918 100644 --- a/libc/src/stdlib/qsort_r.cpp +++ b/libc/src/stdlib/qsort_r.cpp @@ -12,7 +12,7 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, qsort_r, (void *array, size_t array_size, size_t elem_size, @@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(void, qsort_r, array_size, elem_size, c)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdlib/qsort_r.h b/libc/src/stdlib/qsort_r.h index a998b05..fab0576 100644 --- a/libc/src/stdlib/qsort_r.h +++ b/libc/src/stdlib/qsort_r.h @@ -11,7 +11,7 @@ #include <stdlib.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // This qsort_r uses the glibc argument ordering instead of the BSD argument // ordering (which puts arg before the function pointer). Putting arg after the @@ -21,6 +21,6 @@ namespace __llvm_libc { void qsort_r(void *array, size_t array_size, size_t elem_size, int (*compare)(const void *, const void *, void *), void *arg); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDLIB_QSORT_R_H diff --git a/libc/src/stdlib/qsort_util.h b/libc/src/stdlib/qsort_util.h index e9aefe4..f4b8094 100644 --- a/libc/src/stdlib/qsort_util.h +++ b/libc/src/stdlib/qsort_util.h @@ -13,7 +13,7 @@ #include <stdint.h> #include <stdlib.h> -namespace __llvm_libc::internal { +namespace LIBC_NAMESPACE::internal { // A simple quicksort implementation using the Hoare partition scheme. @@ -147,6 +147,6 @@ LIBC_INLINE void quicksort(const Array &array) { quicksort(array.make_array(split_index, array.size() - split_index)); } -} // namespace __llvm_libc::internal +} // namespace LIBC_NAMESPACE::internal #endif // LLVM_LIBC_SRC_STDLIB_QSORT_UTIL_H diff --git a/libc/src/stdlib/rand.cpp b/libc/src/stdlib/rand.cpp index 771944f..c5737a8 100644 --- a/libc/src/stdlib/rand.cpp +++ b/libc/src/stdlib/rand.cpp @@ -10,7 +10,7 @@ #include "src/__support/common.h" #include "src/stdlib/rand_util.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // An implementation of the xorshift64star pseudo random number generator. This // is a good general purpose generator for most non-cryptographics applications. @@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(int, rand, (void)) { return static_cast<int>((rand_next * 0x2545F4914F6CDD1Dul) >> 32) & RAND_MAX; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdlib/rand.h b/libc/src/stdlib/rand.h index b421161..72bb147 100644 --- a/libc/src/stdlib/rand.h +++ b/libc/src/stdlib/rand.h @@ -11,10 +11,10 @@ #include <stdlib.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int rand(void); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDLIB_RAND_H diff --git a/libc/src/stdlib/rand_util.cpp b/libc/src/stdlib/rand_util.cpp index dac8dca..fc2cd30 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 4cbfa14..55c36a4 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 d93d867..008c7a9 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 ff2f138..1bcf8de 100644 --- a/libc/src/stdlib/srand.h +++ b/libc/src/stdlib/srand.h @@ -11,10 +11,10 @@ #include <stdlib.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void srand(unsigned int seed); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDLIB_SRAND_H diff --git a/libc/src/stdlib/strtod.cpp b/libc/src/stdlib/strtod.cpp index eb3f2904..db5e0ede 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 1a8b9dc..5efad84 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 f4b90e8..2cc8829 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 3ebbd11..d800b22 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 fb02353..e9bedf2 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 741c4e8..c46c650 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 01cbb7f..7378963 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 47e8732..6a0b5d4 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 f4f9754f..99e8205 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 63d7335..d699785 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 c3b1b93..f50ed7e 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 6aee32f..af83992 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 9bf3d0b..de3a0d0 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 b64c7be..47ed101 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 c373868..4112b79 100644 --- a/libc/src/string/allocating_string_utils.h +++ b/libc/src/string/allocating_string_utils.h @@ -17,7 +17,7 @@ #include <stddef.h> // For size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { LIBC_INLINE cpp::optional<char *> strdup(const char *src) { @@ -33,6 +33,6 @@ LIBC_INLINE cpp::optional<char *> strdup(const char *src) { } } // namespace internal -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_ALLOCATING_STRING_UTILS_H diff --git a/libc/src/string/bcmp.cpp b/libc/src/string/bcmp.cpp index 26ae302..f18fa0c 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 6503240..711aecf0 100644 --- a/libc/src/string/bcmp.h +++ b/libc/src/string/bcmp.h @@ -11,10 +11,10 @@ #include <stddef.h> // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int bcmp(const void *lhs, const void *rhs, size_t count); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_BCMP_H diff --git a/libc/src/string/bcopy.cpp b/libc/src/string/bcopy.cpp index 758f01a..9399d33 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 12de749..ec4d8cde 100644 --- a/libc/src/string/bcopy.h +++ b/libc/src/string/bcopy.h @@ -11,10 +11,10 @@ #include <stddef.h> // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void bcopy(const void *src, void *dest, size_t count); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_BCOPY_H diff --git a/libc/src/string/bzero.cpp b/libc/src/string/bzero.cpp index cb6da56..c833cd8 100644 --- a/libc/src/string/bzero.cpp +++ b/libc/src/string/bzero.cpp @@ -10,10 +10,10 @@ #include "src/__support/common.h" #include "src/string/memory_utils/inline_bzero.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, bzero, (void *ptr, size_t count)) { inline_bzero(reinterpret_cast<char *>(ptr), count); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/bzero.h b/libc/src/string/bzero.h index 064800b..3f52fe2 100644 --- a/libc/src/string/bzero.h +++ b/libc/src/string/bzero.h @@ -11,10 +11,10 @@ #include <stddef.h> // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void bzero(void *ptr, size_t count); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_BZERO_H diff --git a/libc/src/string/index.cpp b/libc/src/string/index.cpp index 0ea2f75..4b2a352 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 7b24610..993f060 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 989a24d..200384e 100644 --- a/libc/src/string/memccpy.cpp +++ b/libc/src/string/memccpy.cpp @@ -11,7 +11,7 @@ #include "src/__support/common.h" #include <stddef.h> // For size_t. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void *, memccpy, (void *__restrict dest, const void *__restrict src, int c, @@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(void *, memccpy, return nullptr; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/memccpy.h b/libc/src/string/memccpy.h index 38a80b1d..ce12dfb 100644 --- a/libc/src/string/memccpy.h +++ b/libc/src/string/memccpy.h @@ -11,11 +11,11 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void *memccpy(void *__restrict dest, const void *__restrict src, int c, size_t count); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMCCPY_H diff --git a/libc/src/string/memchr.cpp b/libc/src/string/memchr.cpp index a2a5376..918bdd9 100644 --- a/libc/src/string/memchr.cpp +++ b/libc/src/string/memchr.cpp @@ -12,7 +12,7 @@ #include "src/__support/common.h" #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO: Look at performance benefits of comparing words. LLVM_LIBC_FUNCTION(void *, memchr, (const void *src, int c, size_t n)) { @@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(void *, memchr, (const void *src, int c, size_t n)) { static_cast<unsigned char>(c), n); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/memchr.h b/libc/src/string/memchr.h index 3694753..b84c831 100644 --- a/libc/src/string/memchr.h +++ b/libc/src/string/memchr.h @@ -11,10 +11,10 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void *memchr(const void *src, int c, size_t n); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMCHR_H diff --git a/libc/src/string/memcmp.cpp b/libc/src/string/memcmp.cpp index dca2ee8..adfbc1e 100644 --- a/libc/src/string/memcmp.cpp +++ b/libc/src/string/memcmp.cpp @@ -11,11 +11,11 @@ #include <stddef.h> // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, memcmp, (const void *lhs, const void *rhs, size_t count)) { return inline_memcmp(lhs, rhs, count); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/memcmp.h b/libc/src/string/memcmp.h index 1d79df5..f2c1dd3 100644 --- a/libc/src/string/memcmp.h +++ b/libc/src/string/memcmp.h @@ -11,10 +11,10 @@ #include <stddef.h> // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int memcmp(const void *lhs, const void *rhs, size_t count); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMCMP_H diff --git a/libc/src/string/memcpy.cpp b/libc/src/string/memcpy.cpp index 5ec6176..e6cf978 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 f643f1d..ea34a2d 100644 --- a/libc/src/string/memcpy.h +++ b/libc/src/string/memcpy.h @@ -11,10 +11,10 @@ #include <stddef.h> // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void *memcpy(void *__restrict, const void *__restrict, size_t); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMCPY_H diff --git a/libc/src/string/memmem.cpp b/libc/src/string/memmem.cpp index af86498..067ea2e 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 2809fd5..b1f84c8 100644 --- a/libc/src/string/memmem.h +++ b/libc/src/string/memmem.h @@ -11,11 +11,11 @@ #include <stddef.h> // For size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void *memmem(const void *haystack, size_t haystack_len, const void *needle, size_t needle_len); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMMEM_H diff --git a/libc/src/string/memmove.cpp b/libc/src/string/memmove.cpp index 9e75ef7..7d473af 100644 --- a/libc/src/string/memmove.cpp +++ b/libc/src/string/memmove.cpp @@ -11,7 +11,7 @@ #include "src/string/memory_utils/inline_memmove.h" #include <stddef.h> // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void *, memmove, (void *dst, const void *src, size_t count)) { @@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(void *, memmove, return dst; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/memmove.h b/libc/src/string/memmove.h index 2f03a12..4d78aad 100644 --- a/libc/src/string/memmove.h +++ b/libc/src/string/memmove.h @@ -11,10 +11,10 @@ #include <stddef.h> // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void *memmove(void *dst, const void *src, size_t count); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMMOVE_H diff --git a/libc/src/string/memory_utils/aarch64/inline_bcmp.h b/libc/src/string/memory_utils/aarch64/inline_bcmp.h index e2e8cb1..8e0827f 100644 --- a/libc/src/string/memory_utils/aarch64/inline_bcmp.h +++ b/libc/src/string/memory_utils/aarch64/inline_bcmp.h @@ -16,7 +16,7 @@ #include <stddef.h> // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { [[maybe_unused]] LIBC_INLINE BcmpReturnType inline_bcmp_aarch64(CPtr p1, CPtr p2, @@ -65,6 +65,6 @@ namespace __llvm_libc { return aarch64::Bcmp<32>::loop_and_tail(p1, p2, count); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_INLINE_BCMP_H diff --git a/libc/src/string/memory_utils/aarch64/inline_memcmp.h b/libc/src/string/memory_utils/aarch64/inline_memcmp.h index 174e812c..839c8ec 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 6ee2c2b..0a159f4 100644 --- a/libc/src/string/memory_utils/aarch64/inline_memcpy.h +++ b/libc/src/string/memory_utils/aarch64/inline_memcpy.h @@ -14,7 +14,7 @@ #include <stddef.h> // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { [[maybe_unused]] LIBC_INLINE void inline_memcpy_aarch64(Ptr __restrict dst, CPtr __restrict src, size_t count) { @@ -43,6 +43,6 @@ inline_memcpy_aarch64(Ptr __restrict dst, CPtr __restrict src, size_t count) { return builtin::Memcpy<64>::loop_and_tail(dst, src, count); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_INLINE_MEMCPY_H diff --git a/libc/src/string/memory_utils/aarch64/inline_memmove.h b/libc/src/string/memory_utils/aarch64/inline_memmove.h index 7c9fa41..ca28655 100644 --- a/libc/src/string/memory_utils/aarch64/inline_memmove.h +++ b/libc/src/string/memory_utils/aarch64/inline_memmove.h @@ -16,7 +16,7 @@ #include <stddef.h> // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE void inline_memmove_aarch64(Ptr dst, CPtr src, size_t count) { static_assert(aarch64::kNeon, "aarch64 supports vector types"); @@ -48,6 +48,6 @@ LIBC_INLINE void inline_memmove_aarch64(Ptr dst, CPtr src, size_t count) { } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_INLINE_MEMMOVE_H diff --git a/libc/src/string/memory_utils/aarch64/inline_memset.h b/libc/src/string/memory_utils/aarch64/inline_memset.h index 6b73e5f..91512ac 100644 --- a/libc/src/string/memory_utils/aarch64/inline_memset.h +++ b/libc/src/string/memory_utils/aarch64/inline_memset.h @@ -15,7 +15,7 @@ #include <stddef.h> // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { [[maybe_unused]] LIBC_INLINE static void inline_memset_aarch64(Ptr dst, uint8_t value, size_t count) { @@ -56,6 +56,6 @@ inline_memset_aarch64(Ptr dst, uint8_t value, size_t count) { } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_INLINE_MEMSET_H diff --git a/libc/src/string/memory_utils/generic/aligned_access.h b/libc/src/string/memory_utils/generic/aligned_access.h index 0a333d1..4238167 100644 --- a/libc/src/string/memory_utils/generic/aligned_access.h +++ b/libc/src/string/memory_utils/generic/aligned_access.h @@ -20,7 +20,7 @@ #include <stddef.h> // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { [[maybe_unused]] LIBC_INLINE uint32_t load32_aligned(CPtr ptr, size_t offset, size_t alignment) { @@ -200,6 +200,6 @@ inline_memcmp_aligned_access_64bit(CPtr p1, CPtr p2, size_t count) { return inline_memcmp_byte_per_byte(p1, p2, count, offset); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_GENERIC_ALIGNED_ACCESS_H diff --git a/libc/src/string/memory_utils/generic/byte_per_byte.h b/libc/src/string/memory_utils/generic/byte_per_byte.h index 0232911..a666c5d 100644 --- a/libc/src/string/memory_utils/generic/byte_per_byte.h +++ b/libc/src/string/memory_utils/generic/byte_per_byte.h @@ -18,7 +18,7 @@ #include <stddef.h> // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { [[maybe_unused]] LIBC_INLINE void inline_memcpy_byte_per_byte(Ptr dst, CPtr src, size_t count, @@ -73,6 +73,6 @@ inline_memcmp_byte_per_byte(CPtr p1, CPtr p2, size_t count, size_t offset = 0) { return MemcmpReturnType::ZERO(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_GENERIC_BYTE_PER_BYTE_H diff --git a/libc/src/string/memory_utils/inline_bcmp.h b/libc/src/string/memory_utils/inline_bcmp.h index d931b41..b1c981d 100644 --- a/libc/src/string/memory_utils/inline_bcmp.h +++ b/libc/src/string/memory_utils/inline_bcmp.h @@ -30,14 +30,14 @@ #error "Unsupported architecture" #endif -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE int inline_bcmp(const void *p1, const void *p2, size_t count) { return static_cast<int>(LIBC_SRC_STRING_MEMORY_UTILS_BCMP( reinterpret_cast<CPtr>(p1), reinterpret_cast<CPtr>(p2), count)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #undef LIBC_SRC_STRING_MEMORY_UTILS_BCMP diff --git a/libc/src/string/memory_utils/inline_bzero.h b/libc/src/string/memory_utils/inline_bzero.h index af90aed..ed83cab 100644 --- a/libc/src/string/memory_utils/inline_bzero.h +++ b/libc/src/string/memory_utils/inline_bzero.h @@ -14,7 +14,7 @@ #include <stddef.h> // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE static void inline_bzero(Ptr dst, size_t count) { inline_memset(dst, 0, count); @@ -24,6 +24,6 @@ LIBC_INLINE static void inline_bzero(void *dst, size_t count) { inline_bzero(reinterpret_cast<Ptr>(dst), count); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_BZERO_H diff --git a/libc/src/string/memory_utils/inline_memcmp.h b/libc/src/string/memory_utils/inline_memcmp.h index 4182fbb..d88d436 100644 --- a/libc/src/string/memory_utils/inline_memcmp.h +++ b/libc/src/string/memory_utils/inline_memcmp.h @@ -31,14 +31,14 @@ #error "Unsupported architecture" #endif -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE int inline_memcmp(const void *p1, const void *p2, size_t count) { return static_cast<int>(LIBC_SRC_STRING_MEMORY_UTILS_MEMCMP( reinterpret_cast<CPtr>(p1), reinterpret_cast<CPtr>(p2), count)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #undef LIBC_SRC_STRING_MEMORY_UTILS_MEMCMP diff --git a/libc/src/string/memory_utils/inline_memcpy.h b/libc/src/string/memory_utils/inline_memcpy.h index 55f861a..0b8a784 100644 --- a/libc/src/string/memory_utils/inline_memcpy.h +++ b/libc/src/string/memory_utils/inline_memcpy.h @@ -35,7 +35,7 @@ #error "Unsupported architecture" #endif -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE void inline_memcpy(void *__restrict dst, const void *__restrict src, size_t count) { @@ -43,6 +43,6 @@ LIBC_INLINE void inline_memcpy(void *__restrict dst, const void *__restrict src, reinterpret_cast<CPtr>(src), count); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_MEMCPY_H diff --git a/libc/src/string/memory_utils/inline_memmem.h b/libc/src/string/memory_utils/inline_memmem.h index 9c09f94..eaddee5 100644 --- a/libc/src/string/memory_utils/inline_memmem.h +++ b/libc/src/string/memory_utils/inline_memmem.h @@ -13,7 +13,7 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { template <typename Comp> LIBC_INLINE constexpr static void * @@ -39,6 +39,6 @@ inline_memmem(const void *haystack, size_t haystack_len, const void *needle, return nullptr; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_MEMMEM_H diff --git a/libc/src/string/memory_utils/inline_memmove.h b/libc/src/string/memory_utils/inline_memmove.h index c520b6f..0d31e10 100644 --- a/libc/src/string/memory_utils/inline_memmove.h +++ b/libc/src/string/memory_utils/inline_memmove.h @@ -27,13 +27,13 @@ #error "Unsupported architecture" #endif -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE void inline_memmove(void *dst, const void *src, size_t count) { LIBC_SRC_STRING_MEMORY_UTILS_MEMMOVE(reinterpret_cast<Ptr>(dst), reinterpret_cast<CPtr>(src), count); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif /* LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_MEMMOVE_H */ diff --git a/libc/src/string/memory_utils/inline_memset.h b/libc/src/string/memory_utils/inline_memset.h index 524224c..f20ae45 100644 --- a/libc/src/string/memory_utils/inline_memset.h +++ b/libc/src/string/memory_utils/inline_memset.h @@ -31,13 +31,13 @@ #error "Unsupported architecture" #endif -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE static void inline_memset(void *dst, uint8_t value, size_t count) { LIBC_SRC_STRING_MEMORY_UTILS_MEMSET(reinterpret_cast<Ptr>(dst), value, count); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #undef LIBC_SRC_STRING_MEMORY_UTILS_MEMSET diff --git a/libc/src/string/memory_utils/inline_strcmp.h b/libc/src/string/memory_utils/inline_strcmp.h index ccb315d..2bcd56a 100644 --- a/libc/src/string/memory_utils/inline_strcmp.h +++ b/libc/src/string/memory_utils/inline_strcmp.h @@ -11,7 +11,7 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { template <typename Comp> LIBC_INLINE constexpr int inline_strcmp(const char *left, const char *right, @@ -39,6 +39,6 @@ LIBC_INLINE constexpr int inline_strncmp(const char *left, const char *right, *reinterpret_cast<const unsigned char *>(right)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_STRCMP_H diff --git a/libc/src/string/memory_utils/inline_strstr.h b/libc/src/string/memory_utils/inline_strstr.h index f9bc6b5..f0f8e2b 100644 --- a/libc/src/string/memory_utils/inline_strstr.h +++ b/libc/src/string/memory_utils/inline_strstr.h @@ -13,7 +13,7 @@ #include "src/string/string_utils.h" #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { template <typename Comp> LIBC_INLINE constexpr char *inline_strstr(const char *haystack, @@ -24,6 +24,6 @@ LIBC_INLINE constexpr char *inline_strstr(const char *haystack, return static_cast<char *>(result); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_STRSTR_H diff --git a/libc/src/string/memory_utils/op_aarch64.h b/libc/src/string/memory_utils/op_aarch64.h index 29d3b82..10de5bc 100644 --- a/libc/src/string/memory_utils/op_aarch64.h +++ b/libc/src/string/memory_utils/op_aarch64.h @@ -24,7 +24,7 @@ #include <arm_neon.h> #endif //__ARM_NEON -namespace __llvm_libc::aarch64 { +namespace LIBC_NAMESPACE::aarch64 { LIBC_INLINE_VAR constexpr bool kNeon = LLVM_LIBC_IS_DEFINED(__ARM_NEON); @@ -169,9 +169,9 @@ template <size_t Size> struct Bcmp { } }; -} // namespace __llvm_libc::aarch64 +} // namespace LIBC_NAMESPACE::aarch64 -namespace __llvm_libc::generic { +namespace LIBC_NAMESPACE::generic { /////////////////////////////////////////////////////////////////////////////// // Specializations for uint16_t @@ -263,7 +263,7 @@ LIBC_INLINE MemcmpReturnType cmp<uint8x16x2_t>(CPtr p1, CPtr p2, } return MemcmpReturnType::ZERO(); } -} // namespace __llvm_libc::generic +} // namespace LIBC_NAMESPACE::generic #endif // LIBC_TARGET_ARCH_IS_AARCH64 diff --git a/libc/src/string/memory_utils/op_builtin.h b/libc/src/string/memory_utils/op_builtin.h index 210ba60..cfa58e4 100644 --- a/libc/src/string/memory_utils/op_builtin.h +++ b/libc/src/string/memory_utils/op_builtin.h @@ -17,7 +17,7 @@ #include "src/string/memory_utils/utils.h" -namespace __llvm_libc::builtin { +namespace LIBC_NAMESPACE::builtin { /////////////////////////////////////////////////////////////////////////////// // Memcpy @@ -153,6 +153,6 @@ template <size_t Size> struct Memcmp { } }; -} // namespace __llvm_libc::builtin +} // namespace LIBC_NAMESPACE::builtin #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_OP_BUILTIN_H diff --git a/libc/src/string/memory_utils/op_generic.h b/libc/src/string/memory_utils/op_generic.h index 999b7a6..fd71ca3 100644 --- a/libc/src/string/memory_utils/op_generic.h +++ b/libc/src/string/memory_utils/op_generic.h @@ -41,14 +41,14 @@ static_assert((UINTPTR_MAX == 4294967295U) || #define LLVM_LIBC_HAS_UINT64 #endif -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Compiler types using the vector attributes. using generic_v128 = uint8_t __attribute__((__vector_size__(16))); using generic_v256 = uint8_t __attribute__((__vector_size__(32))); using generic_v512 = uint8_t __attribute__((__vector_size__(64))); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE -namespace __llvm_libc::generic { +namespace LIBC_NAMESPACE::generic { // We accept three types of values as elements for generic operations: // - scalar : unsigned integral types, @@ -92,7 +92,7 @@ template <typename T> constexpr size_t array_size_v = array_size<T>::value; template <typename T> T load(CPtr src) { static_assert(is_element_type_v<T>); if constexpr (is_scalar_v<T> || is_vector_v<T>) { - return ::__llvm_libc::load<T>(src); + return ::LIBC_NAMESPACE::load<T>(src); } else if constexpr (is_array_v<T>) { using value_type = typename T::value_type; T Value; @@ -105,7 +105,7 @@ template <typename T> T load(CPtr src) { template <typename T> void store(Ptr dst, T value) { static_assert(is_element_type_v<T>); if constexpr (is_scalar_v<T> || is_vector_v<T>) { - ::__llvm_libc::store<T>(dst, value); + ::LIBC_NAMESPACE::store<T>(dst, value); } else if constexpr (is_array_v<T>) { using value_type = typename T::value_type; for (size_t I = 0; I < array_size_v<T>; ++I) @@ -319,7 +319,7 @@ template <typename T> struct Memmove { // Making the offset explicit hints the compiler to use relevant addressing mode // consistently. template <typename T> LIBC_INLINE T load(CPtr ptr, size_t offset) { - return ::__llvm_libc::load<T>(ptr + offset); + return ::LIBC_NAMESPACE::load<T>(ptr + offset); } // Same as above but also makes sure the loaded value is in big endian format. @@ -564,6 +564,6 @@ LIBC_INLINE MemcmpReturnType cmp<uint8_t>(CPtr p1, CPtr p2, size_t offset) { template <> LIBC_INLINE MemcmpReturnType cmp_neq<uint8_t>(CPtr p1, CPtr p2, size_t offset); -} // namespace __llvm_libc::generic +} // namespace LIBC_NAMESPACE::generic #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_OP_GENERIC_H diff --git a/libc/src/string/memory_utils/op_riscv.h b/libc/src/string/memory_utils/op_riscv.h index e164dfa..313d55e 100644 --- a/libc/src/string/memory_utils/op_riscv.h +++ b/libc/src/string/memory_utils/op_riscv.h @@ -19,7 +19,7 @@ #include "src/__support/common.h" #include "src/string/memory_utils/op_generic.h" -namespace __llvm_libc::generic { +namespace LIBC_NAMESPACE::generic { /////////////////////////////////////////////////////////////////////////////// // Specializations for uint16_t @@ -78,7 +78,7 @@ LIBC_INLINE MemcmpReturnType cmp_neq<uint64_t>(CPtr p1, CPtr p2, return cmp_neq_uint64_t(a, b); } -} // namespace __llvm_libc::generic +} // namespace LIBC_NAMESPACE::generic #endif // LIBC_TARGET_ARCH_IS_ANY_RISCV #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_OP_RISCV_H diff --git a/libc/src/string/memory_utils/op_x86.h b/libc/src/string/memory_utils/op_x86.h index 4c526da..1a20659 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 7d14b33..d66f0a7 100644 --- a/libc/src/string/memory_utils/riscv/inline_bcmp.h +++ b/libc/src/string/memory_utils/riscv/inline_bcmp.h @@ -15,7 +15,7 @@ #include <stddef.h> // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { [[maybe_unused]] LIBC_INLINE BcmpReturnType inline_bcmp_riscv(CPtr p1, CPtr p2, size_t count) { @@ -28,6 +28,6 @@ namespace __llvm_libc { #endif } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LIBC_SRC_STRING_MEMORY_UTILS_RISCV_INLINE_BCMP_H diff --git a/libc/src/string/memory_utils/riscv/inline_memcmp.h b/libc/src/string/memory_utils/riscv/inline_memcmp.h index 437a6b4..0b28ad9 100644 --- a/libc/src/string/memory_utils/riscv/inline_memcmp.h +++ b/libc/src/string/memory_utils/riscv/inline_memcmp.h @@ -15,7 +15,7 @@ #include <stddef.h> // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { [[maybe_unused]] LIBC_INLINE MemcmpReturnType inline_memcmp_riscv(CPtr p1, CPtr p2, size_t count) { @@ -28,6 +28,6 @@ inline_memcmp_riscv(CPtr p1, CPtr p2, size_t count) { #endif } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LIBC_SRC_STRING_MEMORY_UTILS_RISCV_INLINE_MEMCMP_H diff --git a/libc/src/string/memory_utils/riscv/inline_memcpy.h b/libc/src/string/memory_utils/riscv/inline_memcpy.h index c80277a..05531c8 100644 --- a/libc/src/string/memory_utils/riscv/inline_memcpy.h +++ b/libc/src/string/memory_utils/riscv/inline_memcpy.h @@ -15,7 +15,7 @@ #include <stddef.h> // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { [[maybe_unused]] LIBC_INLINE void inline_memcpy_riscv(Ptr __restrict dst, CPtr __restrict src, size_t count) { @@ -28,6 +28,6 @@ inline_memcpy_riscv(Ptr __restrict dst, CPtr __restrict src, size_t count) { #endif } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LIBC_SRC_STRING_MEMORY_UTILS_RISCV_INLINE_MEMCPY_H diff --git a/libc/src/string/memory_utils/riscv/inline_memmove.h b/libc/src/string/memory_utils/riscv/inline_memmove.h index 9704157..1c26917 100644 --- a/libc/src/string/memory_utils/riscv/inline_memmove.h +++ b/libc/src/string/memory_utils/riscv/inline_memmove.h @@ -15,13 +15,13 @@ #include <stddef.h> // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { [[maybe_unused]] LIBC_INLINE void inline_memmove_riscv(Ptr __restrict dst, CPtr __restrict src, size_t count) { return inline_memmove_byte_per_byte(dst, src, count); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LIBC_SRC_STRING_MEMORY_UTILS_RISCV_INLINE_MEMMOVE_H diff --git a/libc/src/string/memory_utils/riscv/inline_memset.h b/libc/src/string/memory_utils/riscv/inline_memset.h index c64a70a99..b9b8a18 100644 --- a/libc/src/string/memory_utils/riscv/inline_memset.h +++ b/libc/src/string/memory_utils/riscv/inline_memset.h @@ -15,7 +15,7 @@ #include <stddef.h> // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE static void inline_memset_riscv(Ptr dst, uint8_t value, size_t count) { @@ -28,6 +28,6 @@ LIBC_INLINE static void inline_memset_riscv(Ptr dst, uint8_t value, #endif } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LIBC_SRC_STRING_MEMORY_UTILS_RISCV_INLINE_MEMSET_H diff --git a/libc/src/string/memory_utils/utils.h b/libc/src/string/memory_utils/utils.h index 6674946..c467ae7 100644 --- a/libc/src/string/memory_utils/utils.h +++ b/libc/src/string/memory_utils/utils.h @@ -20,7 +20,7 @@ #include <stddef.h> // size_t #include <stdint.h> // intptr_t / uintptr_t / INT32_MAX / INT32_MIN -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Allows compile time error reporting in `if constexpr` branches. template <bool flag = false> @@ -372,6 +372,6 @@ private: 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 96a22f7..31aff86 100644 --- a/libc/src/string/memory_utils/x86_64/inline_bcmp.h +++ b/libc/src/string/memory_utils/x86_64/inline_bcmp.h @@ -15,7 +15,7 @@ #include <stddef.h> // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { [[maybe_unused]] LIBC_INLINE BcmpReturnType inline_bcmp_generic_gt16(CPtr p1, CPtr p2, size_t count) { @@ -88,6 +88,6 @@ inline_bcmp_x86_avx512bw_gt16(CPtr p1, CPtr p2, size_t count) { #endif } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_X86_64_INLINE_BCMP_H diff --git a/libc/src/string/memory_utils/x86_64/inline_memcmp.h b/libc/src/string/memory_utils/x86_64/inline_memcmp.h index 2569b4d..d5fa77c 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 7d70a55..f43230f 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 22a0888..95ad07f 100644 --- a/libc/src/string/memory_utils/x86_64/inline_memmove.h +++ b/libc/src/string/memory_utils/x86_64/inline_memmove.h @@ -16,7 +16,7 @@ #include <stddef.h> // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE void inline_memmove_x86(Ptr dst, CPtr src, size_t count) { #if defined(__AVX512F__) @@ -61,6 +61,6 @@ LIBC_INLINE void inline_memmove_x86(Ptr dst, CPtr src, size_t count) { } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_X86_64_INLINE_MEMMOVE_H diff --git a/libc/src/string/memory_utils/x86_64/inline_memset.h b/libc/src/string/memory_utils/x86_64/inline_memset.h index 54ef33a..6436594 100644 --- a/libc/src/string/memory_utils/x86_64/inline_memset.h +++ b/libc/src/string/memory_utils/x86_64/inline_memset.h @@ -15,7 +15,7 @@ #include <stddef.h> // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { [[maybe_unused]] LIBC_INLINE static void inline_memset_x86(Ptr dst, uint8_t value, size_t count) { @@ -60,6 +60,6 @@ inline_memset_x86(Ptr dst, uint8_t value, size_t count) { align_to_next_boundary<32>(dst, count); return generic::Memset<uint256_t>::loop_and_tail(dst, value, count); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_X86_64_INLINE_MEMSET_H diff --git a/libc/src/string/mempcpy.cpp b/libc/src/string/mempcpy.cpp index 535e029..47cc3d6 100644 --- a/libc/src/string/mempcpy.cpp +++ b/libc/src/string/mempcpy.cpp @@ -12,7 +12,7 @@ #include "src/__support/common.h" #include <stddef.h> // For size_t. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void *, mempcpy, (void *__restrict dst, const void *__restrict src, @@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(void *, mempcpy, return reinterpret_cast<char *>(dst) + count; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/mempcpy.h b/libc/src/string/mempcpy.h index 6000761..317e0fc 100644 --- a/libc/src/string/mempcpy.h +++ b/libc/src/string/mempcpy.h @@ -11,10 +11,10 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void *mempcpy(void *__restrict dest, const void *__restrict src, size_t count); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMPCPY_H diff --git a/libc/src/string/memrchr.cpp b/libc/src/string/memrchr.cpp index 7efac04..fad0868 100644 --- a/libc/src/string/memrchr.cpp +++ b/libc/src/string/memrchr.cpp @@ -10,7 +10,7 @@ #include "src/__support/common.h" #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void *, memrchr, (const void *src, int c, size_t n)) { const unsigned char *str = reinterpret_cast<const unsigned char *>(src); @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(void *, memrchr, (const void *src, int c, size_t n)) { return nullptr; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/memrchr.h b/libc/src/string/memrchr.h index 8f43577..5c32d6a 100644 --- a/libc/src/string/memrchr.h +++ b/libc/src/string/memrchr.h @@ -11,10 +11,10 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void *memrchr(const void *src, int c, size_t n); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMRCHR_H diff --git a/libc/src/string/memset.cpp b/libc/src/string/memset.cpp index 3a339ec..a94e353 100644 --- a/libc/src/string/memset.cpp +++ b/libc/src/string/memset.cpp @@ -10,11 +10,11 @@ #include "src/__support/common.h" #include "src/string/memory_utils/inline_memset.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void *, memset, (void *dst, int value, size_t count)) { inline_memset(dst, static_cast<uint8_t>(value), count); return dst; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/memset.h b/libc/src/string/memset.h index e38eb7d..4c1ef9d 100644 --- a/libc/src/string/memset.h +++ b/libc/src/string/memset.h @@ -11,10 +11,10 @@ #include <stddef.h> // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void *memset(void *ptr, int value, size_t count); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMSET_H diff --git a/libc/src/string/rindex.cpp b/libc/src/string/rindex.cpp index 520a4db..2c7f8dc 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 976d6ba..a2aad85 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 22de619..bdaa689 100644 --- a/libc/src/string/stpcpy.cpp +++ b/libc/src/string/stpcpy.cpp @@ -12,17 +12,17 @@ #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(char *, stpcpy, (char *__restrict dest, const char *__restrict src)) { size_t size = internal::string_length(src) + 1; char *result = - reinterpret_cast<char *>(__llvm_libc::mempcpy(dest, src, size)); + reinterpret_cast<char *>(LIBC_NAMESPACE::mempcpy(dest, src, size)); if (result != nullptr) return result - 1; return nullptr; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/stpcpy.h b/libc/src/string/stpcpy.h index 84d5738..4352f5b 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 e03d560..436e131 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 6320a29..5ecf65b 100644 --- a/libc/src/string/stpncpy.h +++ b/libc/src/string/stpncpy.h @@ -11,10 +11,10 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { char *stpncpy(char *__restrict dest, const char *__restrict src, size_t n); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STPNCPY_H diff --git a/libc/src/string/strcasecmp.cpp b/libc/src/string/strcasecmp.cpp index ceb81ce..87636ee 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 ce0a4e5..97b1f93 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 61aca70..3119ed49 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 b691654..9c8ad0f 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 6af5e514..6e1baa6 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 20e966c..3cf2e19 100644 --- a/libc/src/string/strcat.h +++ b/libc/src/string/strcat.h @@ -11,10 +11,10 @@ #include <string.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { char *strcat(char *__restrict dest, const char *__restrict src); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRCAT_H diff --git a/libc/src/string/strchr.cpp b/libc/src/string/strchr.cpp index 3b804e9..553197b 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 6f106af..bb6a9c0 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 d8dce65..9b492a6 100644 --- a/libc/src/string/strchrnul.cpp +++ b/libc/src/string/strchrnul.cpp @@ -11,10 +11,10 @@ #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(char *, strchrnul, (const char *src, int c)) { return internal::strchr_implementation<false>(src, c); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strchrnul.h b/libc/src/string/strchrnul.h index 2ba07ac..b847b0b 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 aca8874..0b515b7 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 a45f2d5..9fc6fdb 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 d60a7a5..7280688 100644 --- a/libc/src/string/strcoll.cpp +++ b/libc/src/string/strcoll.cpp @@ -10,7 +10,7 @@ #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO: Add support for locales. LLVM_LIBC_FUNCTION(int, strcoll, (const char *left, const char *right)) { @@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(int, strcoll, (const char *left, const char *right)) { return static_cast<int>(*left) - static_cast<int>(*right); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strcoll.h b/libc/src/string/strcoll.h index 5949ede..d69b48a 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 cac4f6e..4fbd1a3 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 2d2af21..11a26a6 100644 --- a/libc/src/string/strcpy.h +++ b/libc/src/string/strcpy.h @@ -11,10 +11,10 @@ #include <string.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { char *strcpy(char *__restrict dest, const char *__restrict src); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRCPY_H diff --git a/libc/src/string/strcspn.cpp b/libc/src/string/strcspn.cpp index d4929c5..ed057c3 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 9674f4b..21098fe 100644 --- a/libc/src/string/strcspn.h +++ b/libc/src/string/strcspn.h @@ -11,10 +11,10 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { size_t strcspn(const char *src, const char *segment); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRCSPN_H diff --git a/libc/src/string/strdup.cpp b/libc/src/string/strdup.cpp index cafa0cb..3530a70 100644 --- a/libc/src/string/strdup.cpp +++ b/libc/src/string/strdup.cpp @@ -15,7 +15,7 @@ #include <stdlib.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(char *, strdup, (const char *src)) { auto dup = internal::strdup(src); @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(char *, strdup, (const char *src)) { return nullptr; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strdup.h b/libc/src/string/strdup.h index 8f83558..e33a246 100644 --- a/libc/src/string/strdup.h +++ b/libc/src/string/strdup.h @@ -11,10 +11,10 @@ #include <string.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { char *strdup(const char *src); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRDUP_H diff --git a/libc/src/string/strerror.cpp b/libc/src/string/strerror.cpp index 014a51a..01cbbeb 100644 --- a/libc/src/string/strerror.cpp +++ b/libc/src/string/strerror.cpp @@ -10,10 +10,10 @@ #include "src/__support/StringUtil/error_to_string.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(char *, strerror, (int err_num)) { return const_cast<char *>(get_error_string(err_num).data()); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strerror.h b/libc/src/string/strerror.h index ce3366d..36a1348 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 efdc8d3..c514dbd 100644 --- a/libc/src/string/strerror_r.cpp +++ b/libc/src/string/strerror_r.cpp @@ -12,7 +12,7 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // This is the gnu version of strerror_r. The XSI version may be added later. LLVM_LIBC_FUNCTION(char *, strerror_r, @@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(char *, strerror_r, return const_cast<char *>(get_error_string(err_num, {buf, buflen}).data()); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strerror_r.h b/libc/src/string/strerror_r.h index 18b3617..63f59586 100644 --- a/libc/src/string/strerror_r.h +++ b/libc/src/string/strerror_r.h @@ -11,10 +11,10 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { char *strerror_r(int err_num, char *buf, size_t buflen); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRERROR_R_H diff --git a/libc/src/string/string_utils.h b/libc/src/string/string_utils.h index e874e5f..17efc12 100644 --- a/libc/src/string/string_utils.h +++ b/libc/src/string/string_utils.h @@ -20,7 +20,7 @@ #include "src/string/memory_utils/inline_memcpy.h" #include <stddef.h> // For size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { template <typename Word> LIBC_INLINE constexpr Word repeat_byte(Word byte) { @@ -246,6 +246,6 @@ LIBC_INLINE constexpr static char *strrchr_implementation(const char *src, } } // namespace internal -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRING_UTILS_H diff --git a/libc/src/string/strlcat.cpp b/libc/src/string/strlcat.cpp index a718de7..2943f4f 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 7b073c6..47f27e3 100644 --- a/libc/src/string/strlcat.h +++ b/libc/src/string/strlcat.h @@ -11,10 +11,10 @@ #include <string.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { size_t strlcat(char *__restrict dst, const char *__restrict src, size_t size); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRLCAT_H diff --git a/libc/src/string/strlcpy.cpp b/libc/src/string/strlcpy.cpp index fa1f102..9b296f2 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 f1c8e91..0c18d85 100644 --- a/libc/src/string/strlcpy.h +++ b/libc/src/string/strlcpy.h @@ -11,10 +11,10 @@ #include <string.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { size_t strlcpy(char *__restrict dst, const char *__restrict src, size_t size); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRLCPY_H diff --git a/libc/src/string/strlen.cpp b/libc/src/string/strlen.cpp index c7b192b..b903928 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 b3ad03f..4dfaf8e 100644 --- a/libc/src/string/strlen.h +++ b/libc/src/string/strlen.h @@ -11,10 +11,10 @@ #include <string.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { size_t strlen(const char *src); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRLEN_H diff --git a/libc/src/string/strncasecmp.cpp b/libc/src/string/strncasecmp.cpp index 48445cc..994fb25 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 c596a7a..eb115507 100644 --- a/libc/src/string/strncasecmp.h +++ b/libc/src/string/strncasecmp.h @@ -11,10 +11,10 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int strncasecmp(const char *left, const char *right, size_t n); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRNCASECMP_H diff --git a/libc/src/string/strncat.cpp b/libc/src/string/strncat.cpp index 06e69ea..ca86d9c 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 9b2c70f..f3d9706 100644 --- a/libc/src/string/strncat.h +++ b/libc/src/string/strncat.h @@ -11,10 +11,10 @@ #include <string.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { char *strncat(char *__restrict dest, const char *__restrict src, size_t count); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRNCAT_H diff --git a/libc/src/string/strncmp.cpp b/libc/src/string/strncmp.cpp index 098f9e1..0d2a668 100644 --- a/libc/src/string/strncmp.cpp +++ b/libc/src/string/strncmp.cpp @@ -13,7 +13,7 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, strncmp, (const char *left, const char *right, size_t n)) { @@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(int, strncmp, return inline_strncmp(left, right, n, comp); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strncmp.h b/libc/src/string/strncmp.h index 056fe78..adb270f 100644 --- a/libc/src/string/strncmp.h +++ b/libc/src/string/strncmp.h @@ -11,10 +11,10 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int strncmp(const char *left, const char *right, size_t n); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRNCMP_H diff --git a/libc/src/string/strncpy.cpp b/libc/src/string/strncpy.cpp index 2749502..1408e7f 100644 --- a/libc/src/string/strncpy.cpp +++ b/libc/src/string/strncpy.cpp @@ -11,7 +11,7 @@ #include "src/__support/common.h" #include <stddef.h> // For size_t. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(char *, strncpy, (char *__restrict dest, const char *__restrict src, @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(char *, strncpy, return dest; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strncpy.h b/libc/src/string/strncpy.h index c419df99..3152fef 100644 --- a/libc/src/string/strncpy.h +++ b/libc/src/string/strncpy.h @@ -11,10 +11,10 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { char *strncpy(char *__restrict dest, const char *__restrict src, size_t n); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRNCPY_H diff --git a/libc/src/string/strndup.cpp b/libc/src/string/strndup.cpp index ca1c6ec..6648e22 100644 --- a/libc/src/string/strndup.cpp +++ b/libc/src/string/strndup.cpp @@ -15,7 +15,7 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(char *, strndup, (const char *src, size_t size)) { if (src == nullptr) @@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(char *, strndup, (const char *src, size_t size)) { return dest; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strndup.h b/libc/src/string/strndup.h index 0a593a7..3e5c951 100644 --- a/libc/src/string/strndup.h +++ b/libc/src/string/strndup.h @@ -11,10 +11,10 @@ #include <string.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { char *strndup(const char *src, size_t size); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRNDUP_H diff --git a/libc/src/string/strnlen.cpp b/libc/src/string/strnlen.cpp index dc208b0..8849fa0 100644 --- a/libc/src/string/strnlen.cpp +++ b/libc/src/string/strnlen.cpp @@ -12,7 +12,7 @@ #include "src/__support/common.h" #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(size_t, strnlen, (const char *src, size_t n)) { const void *temp = internal::find_first_character( @@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(size_t, strnlen, (const char *src, size_t n)) { return temp ? reinterpret_cast<const char *>(temp) - src : n; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strnlen.h b/libc/src/string/strnlen.h index 2d2ee97..e18d217 100644 --- a/libc/src/string/strnlen.h +++ b/libc/src/string/strnlen.h @@ -11,10 +11,10 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { size_t strnlen(const char *src, size_t n); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRNLEN_H diff --git a/libc/src/string/strpbrk.cpp b/libc/src/string/strpbrk.cpp index fc2cadc..8bccda0 100644 --- a/libc/src/string/strpbrk.cpp +++ b/libc/src/string/strpbrk.cpp @@ -11,11 +11,11 @@ #include "src/__support/common.h" #include "src/string/string_utils.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(char *, strpbrk, (const char *src, const char *breakset)) { src += internal::complementary_span(src, breakset); return *src ? const_cast<char *>(src) : nullptr; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strpbrk.h b/libc/src/string/strpbrk.h index 823cd35..c744d09 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 d821327..d51808b 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 7b85929..d4280d85 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 5e6aef7..edd2cf0 100644 --- a/libc/src/string/strsep.cpp +++ b/libc/src/string/strsep.cpp @@ -10,7 +10,7 @@ #include "src/string/string_utils.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(char *, strsep, (char **stringp, const char *delim)) { if (!*stringp) @@ -18,4 +18,4 @@ LLVM_LIBC_FUNCTION(char *, strsep, (char **stringp, const char *delim)) { return internal::string_token<false>(*stringp, delim, stringp); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strsep.h b/libc/src/string/strsep.h index 1b1f28f..48f55a8 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 bad69b6..f6ca0bc 100644 --- a/libc/src/string/strsignal.cpp +++ b/libc/src/string/strsignal.cpp @@ -11,10 +11,10 @@ #include "src/__support/StringUtil/signal_to_string.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(char *, strsignal, (int sig_num)) { return const_cast<char *>(get_signal_string(sig_num).data()); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strsignal.h b/libc/src/string/strsignal.h index 346f396..bd3f87a 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 9580d1b..b957f8e 100644 --- a/libc/src/string/strspn.cpp +++ b/libc/src/string/strspn.cpp @@ -12,7 +12,7 @@ #include "src/__support/common.h" #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(size_t, strspn, (const char *src, const char *segment)) { const char *initial = src; @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(size_t, strspn, (const char *src, const char *segment)) { return src - initial; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strspn.h b/libc/src/string/strspn.h index 92321d1..ddb6f38 100644 --- a/libc/src/string/strspn.h +++ b/libc/src/string/strspn.h @@ -11,10 +11,10 @@ #include <stddef.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { size_t strspn(const char *src, const char *segment); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRSPN_H diff --git a/libc/src/string/strstr.cpp b/libc/src/string/strstr.cpp index 3a82678..bfda75b 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 463ffb7..2501b00 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 281197e..e7d3034 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 33ac681..8788f33 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 d1cc675..e8847b6 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 f1aff3e..b3c7b3d 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 a37c220..b5eb764 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 1ca1e73..8178931 100644 --- a/libc/src/string/strxfrm.h +++ b/libc/src/string/strxfrm.h @@ -10,10 +10,10 @@ #define LLVM_LIBC_SRC_STRING_STRXFRM_H #include <stddef.h> // For size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { size_t strxfrm(char *__restrict dest, const char *__restrict src, size_t n); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRXFRM_H diff --git a/libc/src/sys/mman/linux/madvise.cpp b/libc/src/sys/mman/linux/madvise.cpp index af98e0b..ff461c1 100644 --- a/libc/src/sys/mman/linux/madvise.cpp +++ b/libc/src/sys/mman/linux/madvise.cpp @@ -14,12 +14,12 @@ #include "src/errno/libc_errno.h" #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // This function is currently linux only. It has to be refactored suitably if // madvise is to be supported on non-linux operating systems also. LLVM_LIBC_FUNCTION(int, madvise, (void *addr, size_t size, int advice)) { - int ret = __llvm_libc::syscall_impl<int>( + int ret = LIBC_NAMESPACE::syscall_impl<int>( SYS_madvise, reinterpret_cast<long>(addr), size, advice); // A negative return value indicates an error with the magnitude of the @@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(int, madvise, (void *addr, size_t size, int advice)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/mman/linux/mmap.cpp b/libc/src/sys/mman/linux/mmap.cpp index dde1105..16111c6 100644 --- a/libc/src/sys/mman/linux/mmap.cpp +++ b/libc/src/sys/mman/linux/mmap.cpp @@ -15,7 +15,7 @@ #include <linux/param.h> // For EXEC_PAGESIZE. #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // This function is currently linux only. It has to be refactored suitably if // mmap is to be supported on non-linux operating systems also. @@ -40,8 +40,8 @@ LLVM_LIBC_FUNCTION(void *, mmap, #endif long ret = - __llvm_libc::syscall_impl(syscall_number, reinterpret_cast<long>(addr), - size, prot, flags, fd, offset); + LIBC_NAMESPACE::syscall_impl(syscall_number, reinterpret_cast<long>(addr), + size, prot, flags, fd, offset); // The mmap/mmap2 syscalls return negative values on error. These negative // values are actually the negative values of the error codes. So, fix them @@ -60,4 +60,4 @@ LLVM_LIBC_FUNCTION(void *, mmap, return reinterpret_cast<void *>(ret); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/mman/linux/mprotect.cpp b/libc/src/sys/mman/linux/mprotect.cpp index 360c1933..2e6f2a3 100644 --- a/libc/src/sys/mman/linux/mprotect.cpp +++ b/libc/src/sys/mman/linux/mprotect.cpp @@ -14,12 +14,12 @@ #include "src/errno/libc_errno.h" #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // This function is currently linux only. It has to be refactored suitably if // mprotect is to be supported on non-linux operating systems also. LLVM_LIBC_FUNCTION(int, mprotect, (void *addr, size_t size, int prot)) { - int ret = __llvm_libc::syscall_impl<int>( + int ret = LIBC_NAMESPACE::syscall_impl<int>( SYS_mprotect, reinterpret_cast<long>(addr), size, prot); // A negative return value indicates an error with the magnitude of the @@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(int, mprotect, (void *addr, size_t size, int prot)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/mman/linux/munmap.cpp b/libc/src/sys/mman/linux/munmap.cpp index cbc4868..6412b41 100644 --- a/libc/src/sys/mman/linux/munmap.cpp +++ b/libc/src/sys/mman/linux/munmap.cpp @@ -14,13 +14,13 @@ #include "src/errno/libc_errno.h" #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // This function is currently linux only. It has to be refactored suitably if // mmap is to be supported on non-linux operating systems also. LLVM_LIBC_FUNCTION(int, munmap, (void *addr, size_t size)) { - int ret = __llvm_libc::syscall_impl<int>(SYS_munmap, - reinterpret_cast<long>(addr), size); + int ret = LIBC_NAMESPACE::syscall_impl<int>( + SYS_munmap, reinterpret_cast<long>(addr), size); // A negative return value indicates an error with the magnitude of the // value being the error code. @@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(int, munmap, (void *addr, size_t size)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/mman/linux/posix_madvise.cpp b/libc/src/sys/mman/linux/posix_madvise.cpp index 2f6a555..b7b4d35 100644 --- a/libc/src/sys/mman/linux/posix_madvise.cpp +++ b/libc/src/sys/mman/linux/posix_madvise.cpp @@ -13,7 +13,7 @@ #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // This function is currently linux only. It has to be refactored suitably if // posix_madvise is to be supported on non-linux operating systems also. @@ -23,9 +23,9 @@ LLVM_LIBC_FUNCTION(int, posix_madvise, (void *addr, size_t size, int advice)) { if (advice == POSIX_MADV_DONTNEED) { return 0; } - int ret = __llvm_libc::syscall_impl<int>( + int ret = LIBC_NAMESPACE::syscall_impl<int>( SYS_madvise, reinterpret_cast<long>(addr), size, advice); return ret < 0 ? -ret : 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/mman/madvise.h b/libc/src/sys/mman/madvise.h index 01470c5..59a03af 100644 --- a/libc/src/sys/mman/madvise.h +++ b/libc/src/sys/mman/madvise.h @@ -11,10 +11,10 @@ #include <sys/mman.h> // For size_t and off_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int madvise(void *addr, size_t size, int advice); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_MMAN_MADVISE_H diff --git a/libc/src/sys/mman/mmap.h b/libc/src/sys/mman/mmap.h index 9f7fd8b..4425019 100644 --- a/libc/src/sys/mman/mmap.h +++ b/libc/src/sys/mman/mmap.h @@ -11,10 +11,10 @@ #include <sys/mman.h> // For size_t and off_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void *mmap(void *addr, size_t size, int prot, int flags, int fd, off_t offset); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_MMAN_MMAP_H diff --git a/libc/src/sys/mman/mprotect.h b/libc/src/sys/mman/mprotect.h index a8bca843..2e59c75 100644 --- a/libc/src/sys/mman/mprotect.h +++ b/libc/src/sys/mman/mprotect.h @@ -11,10 +11,10 @@ #include <sys/mman.h> // For size_t and off_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int mprotect(void *addr, size_t size, int prot); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_MMAN_MPROTECT_H diff --git a/libc/src/sys/mman/munmap.h b/libc/src/sys/mman/munmap.h index fa11d67..5d7c569 100644 --- a/libc/src/sys/mman/munmap.h +++ b/libc/src/sys/mman/munmap.h @@ -11,10 +11,10 @@ #include <sys/mman.h> // For size_t. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int munmap(void *addr, size_t size); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_MMAN_MUNMAP_H diff --git a/libc/src/sys/mman/posix_madvise.h b/libc/src/sys/mman/posix_madvise.h index c13937b..b8a423b 100644 --- a/libc/src/sys/mman/posix_madvise.h +++ b/libc/src/sys/mman/posix_madvise.h @@ -11,10 +11,10 @@ #include <sys/mman.h> // For size_t and off_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int posix_madvise(void *addr, size_t size, int advice); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_MMAN_POSIX_MADVISE_H diff --git a/libc/src/sys/random/getrandom.h b/libc/src/sys/random/getrandom.h index 32a2a64..e1577d9 100644 --- a/libc/src/sys/random/getrandom.h +++ b/libc/src/sys/random/getrandom.h @@ -11,10 +11,10 @@ #include <sys/random.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { ssize_t getrandom(void *buf, size_t buflen, unsigned int flags); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_RANDOM_GETRANDOM_H diff --git a/libc/src/sys/random/linux/getrandom.cpp b/libc/src/sys/random/linux/getrandom.cpp index 54fbc28..63038ad 100644 --- a/libc/src/sys/random/linux/getrandom.cpp +++ b/libc/src/sys/random/linux/getrandom.cpp @@ -14,12 +14,12 @@ #include "src/errno/libc_errno.h" #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(ssize_t, getrandom, (void *buf, size_t buflen, unsigned int flags)) { ssize_t ret = - __llvm_libc::syscall_impl<ssize_t>(SYS_getrandom, buf, buflen, flags); + LIBC_NAMESPACE::syscall_impl<ssize_t>(SYS_getrandom, buf, buflen, flags); if (ret < 0) { libc_errno = static_cast<int>(-ret); return -1; @@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(ssize_t, getrandom, return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/resource/getrlimit.h b/libc/src/sys/resource/getrlimit.h index 84c056e..f473e82 100644 --- a/libc/src/sys/resource/getrlimit.h +++ b/libc/src/sys/resource/getrlimit.h @@ -11,10 +11,10 @@ #include <sys/resource.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int getrlimit(int resource, struct rlimit *lim); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_RESOURCE_GETRLIMIT_H diff --git a/libc/src/sys/resource/linux/getrlimit.cpp b/libc/src/sys/resource/linux/getrlimit.cpp index 62b154b..4067beb 100644 --- a/libc/src/sys/resource/linux/getrlimit.cpp +++ b/libc/src/sys/resource/linux/getrlimit.cpp @@ -15,11 +15,11 @@ #include <sys/resource.h> // For struct rlimit #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, getrlimit, (int res, struct rlimit *limits)) { int ret = - __llvm_libc::syscall_impl<int>(SYS_prlimit64, 0, res, nullptr, limits); + LIBC_NAMESPACE::syscall_impl<int>(SYS_prlimit64, 0, res, nullptr, limits); if (ret < 0) { libc_errno = -ret; return -1; @@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(int, getrlimit, (int res, struct rlimit *limits)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/resource/linux/setrlimit.cpp b/libc/src/sys/resource/linux/setrlimit.cpp index 6bbe50a..0692763 100644 --- a/libc/src/sys/resource/linux/setrlimit.cpp +++ b/libc/src/sys/resource/linux/setrlimit.cpp @@ -15,11 +15,11 @@ #include <sys/resource.h> // For struct rlimit #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, setrlimit, (int res, const struct rlimit *limits)) { int ret = - __llvm_libc::syscall_impl<int>(SYS_prlimit64, 0, res, limits, nullptr); + LIBC_NAMESPACE::syscall_impl<int>(SYS_prlimit64, 0, res, limits, nullptr); if (ret < 0) { libc_errno = -ret; return -1; @@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(int, setrlimit, (int res, const struct rlimit *limits)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/resource/setrlimit.h b/libc/src/sys/resource/setrlimit.h index e6dc00e..d881b59 100644 --- a/libc/src/sys/resource/setrlimit.h +++ b/libc/src/sys/resource/setrlimit.h @@ -11,10 +11,10 @@ #include <sys/resource.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int setrlimit(int resource, const struct rlimit *lim); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_RESOURCE_SETRLIMIT_H diff --git a/libc/src/sys/select/linux/select.cpp b/libc/src/sys/select/linux/select.cpp index 5850c94..3f387c1 100644 --- a/libc/src/sys/select/linux/select.cpp +++ b/libc/src/sys/select/linux/select.cpp @@ -18,7 +18,7 @@ #include <sys/select.h> #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { struct pselect6_sigset_t { sigset_t *ss; @@ -54,11 +54,11 @@ LLVM_LIBC_FUNCTION(int, select, } pselect6_sigset_t pss{nullptr, sizeof(sigset_t)}; #if SYS_pselect6 - int ret = __llvm_libc::syscall_impl<int>(SYS_pselect6, nfds, read_set, - write_set, error_set, &ts, &pss); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_pselect6, nfds, read_set, + write_set, error_set, &ts, &pss); #elif defined(SYS_pselect6_time64) - int ret = __llvm_libc::syscall_impl<int>(SYS_pselect6_time64, nfds, read_set, - write_set, error_set, &ts, &pss); + int ret = LIBC_NAMESPACE::syscall_impl<int>( + SYS_pselect6_time64, nfds, read_set, write_set, error_set, &ts, &pss); #else #error "SYS_pselect6 and SYS_pselect6_time64 syscalls not available." #endif @@ -69,4 +69,4 @@ LLVM_LIBC_FUNCTION(int, select, return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/select/select.h b/libc/src/sys/select/select.h index ca81c0b..65cd15c 100644 --- a/libc/src/sys/select/select.h +++ b/libc/src/sys/select/select.h @@ -11,11 +11,11 @@ #include <sys/select.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int select(int nfds, fd_set *__restrict read_set, fd_set *__restrict write_set, fd_set *__restrict error_set, struct timeval *__restrict timeout); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_SELECT_SELECT_H diff --git a/libc/src/sys/sendfile/linux/sendfile.cpp b/libc/src/sys/sendfile/linux/sendfile.cpp index 43ddf81..5a7c012 100644 --- a/libc/src/sys/sendfile/linux/sendfile.cpp +++ b/libc/src/sys/sendfile/linux/sendfile.cpp @@ -15,18 +15,18 @@ #include <sys/sendfile.h> #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(ssize_t, sendfile, (int out_fd, int in_fd, off_t *offset, size_t count)) { #ifdef SYS_sendfile - ssize_t ret = __llvm_libc::syscall_impl<ssize_t>(SYS_sendfile, in_fd, out_fd, - offset, count); + ssize_t ret = LIBC_NAMESPACE::syscall_impl<ssize_t>(SYS_sendfile, in_fd, + out_fd, offset, count); #elif defined(SYS_sendfile64) // Same as sendfile but can handle large offsets static_assert(sizeof(off_t) == 8); - ssize_t ret = __llvm_libc::syscall_impl<ssize_t>(SYS_sendfile64, in_fd, - out_fd, offset, count); + ssize_t ret = LIBC_NAMESPACE::syscall_impl<ssize_t>(SYS_sendfile64, in_fd, + out_fd, offset, count); #else #error "sendfile and sendfile64 syscalls not available." #endif @@ -37,4 +37,4 @@ LLVM_LIBC_FUNCTION(ssize_t, sendfile, return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/sendfile/sendfile.h b/libc/src/sys/sendfile/sendfile.h index ba9bf97..14673bb 100644 --- a/libc/src/sys/sendfile/sendfile.h +++ b/libc/src/sys/sendfile/sendfile.h @@ -11,10 +11,10 @@ #include <sys/sendfile.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { ssize_t sendfile(int, int, off_t *, size_t); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_SENDFILE_SENDFILE_H diff --git a/libc/src/sys/socket/linux/socket.cpp b/libc/src/sys/socket/linux/socket.cpp index 7f87450..6429fd12 100644 --- a/libc/src/sys/socket/linux/socket.cpp +++ b/libc/src/sys/socket/linux/socket.cpp @@ -16,15 +16,16 @@ #include <linux/net.h> // For SYS_SOCKET socketcall number. #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, socket, (int domain, int type, int protocol)) { #ifdef SYS_socket - int ret = __llvm_libc::syscall_impl<int>(SYS_socket, domain, type, protocol); + int ret = + LIBC_NAMESPACE::syscall_impl<int>(SYS_socket, domain, type, protocol); #elif defined(SYS_socketcall) unsigned long sockcall_args[3] = {domain, type, protocol}; - int ret = - __llvm_libc::syscall_impl<int>(SYS_socketcall, SYS_SOCKET, sockcall_args); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_socketcall, SYS_SOCKET, + sockcall_args); #else #error "socket and socketcall syscalls unavailable for this platform." #endif @@ -35,4 +36,4 @@ LLVM_LIBC_FUNCTION(int, socket, (int domain, int type, int protocol)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/socket/socket.h b/libc/src/sys/socket/socket.h index b18aa7f..a657898 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 bfeaa9d..decb442 100644 --- a/libc/src/sys/stat/chmod.h +++ b/libc/src/sys/stat/chmod.h @@ -11,10 +11,10 @@ #include <sys/stat.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int chmod(const char *path, mode_t mode); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_STAT_CHMOD_H diff --git a/libc/src/sys/stat/fchmod.h b/libc/src/sys/stat/fchmod.h index 34c1670..611bba1 100644 --- a/libc/src/sys/stat/fchmod.h +++ b/libc/src/sys/stat/fchmod.h @@ -11,10 +11,10 @@ #include <sys/stat.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fchmod(int fd, mode_t mode); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_STAT_FCHMOD_H diff --git a/libc/src/sys/stat/fchmodat.h b/libc/src/sys/stat/fchmodat.h index 3ad9af1..e7b1269 100644 --- a/libc/src/sys/stat/fchmodat.h +++ b/libc/src/sys/stat/fchmodat.h @@ -11,10 +11,10 @@ #include <sys/stat.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fchmodat(int dirfd, const char *path, mode_t mode, int flags); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_STAT_FCHMODAT_H diff --git a/libc/src/sys/stat/fstat.h b/libc/src/sys/stat/fstat.h index ec559a6..7633ee6 100644 --- a/libc/src/sys/stat/fstat.h +++ b/libc/src/sys/stat/fstat.h @@ -11,10 +11,10 @@ #include <sys/stat.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fstat(int fd, struct stat *statbuf); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_STAT_FSTAT_H diff --git a/libc/src/sys/stat/linux/chmod.cpp b/libc/src/sys/stat/linux/chmod.cpp index 9123ea5..085b916 100644 --- a/libc/src/sys/stat/linux/chmod.cpp +++ b/libc/src/sys/stat/linux/chmod.cpp @@ -16,13 +16,14 @@ #include <sys/stat.h> #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, chmod, (const char *path, mode_t mode)) { #ifdef SYS_chmod - int ret = __llvm_libc::syscall_impl<int>(SYS_chmod, path, mode); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_chmod, path, mode); #elif defined(SYS_fchmodat) - int ret = __llvm_libc::syscall_impl<int>(SYS_fchmodat, AT_FDCWD, path, mode); + int ret = + LIBC_NAMESPACE::syscall_impl<int>(SYS_fchmodat, AT_FDCWD, path, mode); #else #error "chmod and fchmodat syscalls not available." #endif @@ -34,4 +35,4 @@ LLVM_LIBC_FUNCTION(int, chmod, (const char *path, mode_t mode)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/stat/linux/fchmod.cpp b/libc/src/sys/stat/linux/fchmod.cpp index fa9d857..cdc9cbf 100644 --- a/libc/src/sys/stat/linux/fchmod.cpp +++ b/libc/src/sys/stat/linux/fchmod.cpp @@ -16,10 +16,10 @@ #include <sys/stat.h> #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fchmod, (int fd, mode_t mode)) { - int ret = __llvm_libc::syscall_impl<int>(SYS_fchmod, fd, mode); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_fchmod, fd, mode); if (ret < 0) { libc_errno = -ret; return -1; @@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(int, fchmod, (int fd, mode_t mode)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/stat/linux/fchmodat.cpp b/libc/src/sys/stat/linux/fchmodat.cpp index 9abb3de..43b4cf0 100644 --- a/libc/src/sys/stat/linux/fchmodat.cpp +++ b/libc/src/sys/stat/linux/fchmodat.cpp @@ -15,12 +15,12 @@ #include <sys/stat.h> #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fchmodat, (int dirfd, const char *path, mode_t mode, int flags)) { int ret = - __llvm_libc::syscall_impl<int>(SYS_fchmodat, dirfd, path, mode, flags); + LIBC_NAMESPACE::syscall_impl<int>(SYS_fchmodat, dirfd, path, mode, flags); if (ret < 0) { libc_errno = -ret; return -1; @@ -28,4 +28,4 @@ LLVM_LIBC_FUNCTION(int, fchmodat, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/stat/linux/fstat.cpp b/libc/src/sys/stat/linux/fstat.cpp index e187e5c..5164178 100644 --- a/libc/src/sys/stat/linux/fstat.cpp +++ b/libc/src/sys/stat/linux/fstat.cpp @@ -15,7 +15,7 @@ #include <fcntl.h> #include <sys/stat.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fstat, (int fd, struct stat *statbuf)) { int err = statx(fd, "", AT_EMPTY_PATH, statbuf); @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, fstat, (int fd, struct stat *statbuf)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/stat/linux/kernel_statx.h b/libc/src/sys/stat/linux/kernel_statx.h index 48b2306..6096916 100644 --- a/libc/src/sys/stat/linux/kernel_statx.h +++ b/libc/src/sys/stat/linux/kernel_statx.h @@ -67,14 +67,14 @@ constexpr unsigned int STATX_BASIC_STATS_MASK = 0x7FF; } // Anonymous namespace -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE int statx(int dirfd, const char *__restrict path, int flags, struct stat *__restrict statbuf) { // We make a statx syscall and copy out the result into the |statbuf|. ::statx_buf xbuf; - int ret = __llvm_libc::syscall_impl<int>(SYS_statx, dirfd, path, flags, - ::STATX_BASIC_STATS_MASK, &xbuf); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_statx, dirfd, path, flags, + ::STATX_BASIC_STATS_MASK, &xbuf); if (ret < 0) return -ret; @@ -98,6 +98,6 @@ LIBC_INLINE int statx(int dirfd, const char *__restrict path, int flags, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_STAT_LINUX_KERNEL_STATX_H diff --git a/libc/src/sys/stat/linux/lstat.cpp b/libc/src/sys/stat/linux/lstat.cpp index 15a721b..b269814 100644 --- a/libc/src/sys/stat/linux/lstat.cpp +++ b/libc/src/sys/stat/linux/lstat.cpp @@ -16,7 +16,7 @@ #include <fcntl.h> #include <sys/stat.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, lstat, (const char *__restrict path, @@ -29,4 +29,4 @@ LLVM_LIBC_FUNCTION(int, lstat, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/stat/linux/mkdir.cpp b/libc/src/sys/stat/linux/mkdir.cpp index 1f5974c..63b64ac 100644 --- a/libc/src/sys/stat/linux/mkdir.cpp +++ b/libc/src/sys/stat/linux/mkdir.cpp @@ -16,13 +16,14 @@ #include <sys/stat.h> #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, mkdir, (const char *path, mode_t mode)) { #ifdef SYS_mkdir - int ret = __llvm_libc::syscall_impl<int>(SYS_mkdir, path, mode); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_mkdir, path, mode); #elif defined(SYS_mkdirat) - int ret = __llvm_libc::syscall_impl<int>(SYS_mkdirat, AT_FDCWD, path, mode); + int ret = + LIBC_NAMESPACE::syscall_impl<int>(SYS_mkdirat, AT_FDCWD, path, mode); #else #error "mkdir and mkdirat syscalls not available." #endif @@ -34,4 +35,4 @@ LLVM_LIBC_FUNCTION(int, mkdir, (const char *path, mode_t mode)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/stat/linux/mkdirat.cpp b/libc/src/sys/stat/linux/mkdirat.cpp index ff266b1..0128d7c 100644 --- a/libc/src/sys/stat/linux/mkdirat.cpp +++ b/libc/src/sys/stat/linux/mkdirat.cpp @@ -15,11 +15,11 @@ #include <sys/stat.h> #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, mkdirat, (int dfd, const char *path, mode_t mode)) { #ifdef SYS_mkdirat - int ret = __llvm_libc::syscall_impl<int>(SYS_mkdirat, dfd, path, mode); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_mkdirat, dfd, path, mode); #else #error "mkdirat syscall not available." #endif @@ -31,4 +31,4 @@ LLVM_LIBC_FUNCTION(int, mkdirat, (int dfd, const char *path, mode_t mode)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/stat/linux/stat.cpp b/libc/src/sys/stat/linux/stat.cpp index 9c3b56b..c30c8b6 100644 --- a/libc/src/sys/stat/linux/stat.cpp +++ b/libc/src/sys/stat/linux/stat.cpp @@ -15,7 +15,7 @@ #include <fcntl.h> #include <sys/stat.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, stat, (const char *__restrict path, @@ -28,4 +28,4 @@ LLVM_LIBC_FUNCTION(int, stat, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/stat/lstat.h b/libc/src/sys/stat/lstat.h index 7d5ffa2..42bd8e9 100644 --- a/libc/src/sys/stat/lstat.h +++ b/libc/src/sys/stat/lstat.h @@ -11,10 +11,10 @@ #include <sys/stat.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int lstat(const char *__restrict path, struct stat *__restrict statbuf); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_STAT_LSTAT_H diff --git a/libc/src/sys/stat/mkdir.h b/libc/src/sys/stat/mkdir.h index 535423a..9f2991d 100644 --- a/libc/src/sys/stat/mkdir.h +++ b/libc/src/sys/stat/mkdir.h @@ -11,10 +11,10 @@ #include <sys/stat.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int mkdir(const char *path, mode_t mode); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_STAT_MKDIR_H diff --git a/libc/src/sys/stat/mkdirat.h b/libc/src/sys/stat/mkdirat.h index 883709c..3222097 100644 --- a/libc/src/sys/stat/mkdirat.h +++ b/libc/src/sys/stat/mkdirat.h @@ -11,10 +11,10 @@ #include <sys/stat.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int mkdirat(int dfd, const char *path, mode_t mode); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_STAT_MKDIRAT_H diff --git a/libc/src/sys/stat/stat.h b/libc/src/sys/stat/stat.h index a272aa4..5d2eba5 100644 --- a/libc/src/sys/stat/stat.h +++ b/libc/src/sys/stat/stat.h @@ -11,10 +11,10 @@ #include <sys/stat.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int stat(const char *__restrict path, struct stat *__restrict statbuf); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_STAT_STAT_H diff --git a/libc/src/sys/utsname/linux/uname.cpp b/libc/src/sys/utsname/linux/uname.cpp index a73e477..f0796b6 100644 --- a/libc/src/sys/utsname/linux/uname.cpp +++ b/libc/src/sys/utsname/linux/uname.cpp @@ -15,10 +15,10 @@ #include <sys/syscall.h> // For syscall numbers. #include <sys/utsname.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, uname, (struct utsname * name)) { - int ret = __llvm_libc::syscall_impl<int>(SYS_uname, name); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_uname, name); if (ret >= 0) return 1; @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, uname, (struct utsname * name)) { return -1; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/utsname/uname.h b/libc/src/sys/utsname/uname.h index 80c748a..b347cf0 100644 --- a/libc/src/sys/utsname/uname.h +++ b/libc/src/sys/utsname/uname.h @@ -11,10 +11,10 @@ #include <sys/utsname.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int uname(struct utsname *name); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_UTSNAME_UNAME_H diff --git a/libc/src/sys/wait/linux/wait.cpp b/libc/src/sys/wait/linux/wait.cpp index 855d452..02e6a34 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 f73f57b..84036ca 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 0ad83ae..b2e8229 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 d49fb21..abe5249 100644 --- a/libc/src/sys/wait/wait.h +++ b/libc/src/sys/wait/wait.h @@ -11,10 +11,10 @@ #include <sys/wait.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { pid_t wait(int *waitstatus); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_WAIT_WAIT_H diff --git a/libc/src/sys/wait/wait4.h b/libc/src/sys/wait/wait4.h index 91c0174..3205b28 100644 --- a/libc/src/sys/wait/wait4.h +++ b/libc/src/sys/wait/wait4.h @@ -11,10 +11,10 @@ #include <sys/wait.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { pid_t wait4(pid_t pid, int *waitstatus, int options, struct rusage *usage); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_WAIT_WAIT4_H diff --git a/libc/src/sys/wait/wait4Impl.h b/libc/src/sys/wait/wait4Impl.h index 059b2ca..956ad0f 100644 --- a/libc/src/sys/wait/wait4Impl.h +++ b/libc/src/sys/wait/wait4Impl.h @@ -18,7 +18,7 @@ #include <sys/syscall.h> // For syscall numbers. #include <sys/wait.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { // The implementation of wait here is very minimal. We will add more @@ -27,8 +27,8 @@ namespace internal { LIBC_INLINE ErrorOr<pid_t> wait4impl(pid_t pid, int *wait_status, int options, struct rusage *usage) { #if SYS_wait4 - pid = __llvm_libc::syscall_impl<pid_t>(SYS_wait4, pid, wait_status, options, - usage); + pid = LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_wait4, pid, wait_status, + options, usage); #elif defined(SYS_waitid) int idtype = P_PID; if (pid == -1) { @@ -43,8 +43,8 @@ LIBC_INLINE ErrorOr<pid_t> wait4impl(pid_t pid, int *wait_status, int options, options |= WEXITED; siginfo_t info; - pid = __llvm_libc::syscall_impl<pid_t>(SYS_waitid, idtype, pid, &info, - options, usage); + pid = LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_waitid, idtype, pid, &info, + options, usage); if (pid >= 0) pid = info.si_pid; @@ -80,6 +80,6 @@ LIBC_INLINE ErrorOr<pid_t> wait4impl(pid_t pid, int *wait_status, int options, } } // namespace internal -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_WAIT_WAIT4IMPL_H diff --git a/libc/src/sys/wait/waitpid.h b/libc/src/sys/wait/waitpid.h index 1407c7f9..37ebf28 100644 --- a/libc/src/sys/wait/waitpid.h +++ b/libc/src/sys/wait/waitpid.h @@ -11,10 +11,10 @@ #include <sys/wait.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { pid_t waitpid(pid_t pid, int *waitstatus, int options); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_WAIT_WAITPID_H diff --git a/libc/src/termios/cfgetispeed.h b/libc/src/termios/cfgetispeed.h index 9cd3a4b..7ea280f 100644 --- a/libc/src/termios/cfgetispeed.h +++ b/libc/src/termios/cfgetispeed.h @@ -11,10 +11,10 @@ #include <termios.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { speed_t cfgetispeed(const struct termios *t); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TERMIOS_CFGETISPEED_H diff --git a/libc/src/termios/cfgetospeed.h b/libc/src/termios/cfgetospeed.h index 14ff9d0..95e3edb 100644 --- a/libc/src/termios/cfgetospeed.h +++ b/libc/src/termios/cfgetospeed.h @@ -11,10 +11,10 @@ #include <termios.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { speed_t cfgetospeed(const struct termios *t); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TERMIOS_CFGETOSPEED_H diff --git a/libc/src/termios/cfsetispeed.h b/libc/src/termios/cfsetispeed.h index 8d1648f..e03a2d1 100644 --- a/libc/src/termios/cfsetispeed.h +++ b/libc/src/termios/cfsetispeed.h @@ -11,10 +11,10 @@ #include <termios.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int cfsetispeed(struct termios *t, speed_t speed); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TERMIOS_CFSETISPEED_H diff --git a/libc/src/termios/cfsetospeed.h b/libc/src/termios/cfsetospeed.h index e7bb21b..74d41ab 100644 --- a/libc/src/termios/cfsetospeed.h +++ b/libc/src/termios/cfsetospeed.h @@ -11,10 +11,10 @@ #include <termios.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int cfsetospeed(struct termios *t, speed_t speed); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TERMIOS_CFSETOSPEED_H diff --git a/libc/src/termios/linux/cfgetispeed.cpp b/libc/src/termios/linux/cfgetispeed.cpp index d4877e8..18e34b2 100644 --- a/libc/src/termios/linux/cfgetispeed.cpp +++ b/libc/src/termios/linux/cfgetispeed.cpp @@ -12,10 +12,10 @@ #include <termios.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(speed_t, cfgetispeed, (const struct termios *t)) { return t->c_cflag & CBAUD; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/termios/linux/cfgetospeed.cpp b/libc/src/termios/linux/cfgetospeed.cpp index 5fbe73d..1989b3f 100644 --- a/libc/src/termios/linux/cfgetospeed.cpp +++ b/libc/src/termios/linux/cfgetospeed.cpp @@ -12,10 +12,10 @@ #include <termios.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(speed_t, cfgetospeed, (const struct termios *t)) { return t->c_cflag & CBAUD; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/termios/linux/cfsetispeed.cpp b/libc/src/termios/linux/cfsetispeed.cpp index 7beb117..0e8ac55 100644 --- a/libc/src/termios/linux/cfsetispeed.cpp +++ b/libc/src/termios/linux/cfsetispeed.cpp @@ -13,7 +13,7 @@ #include <termios.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, cfsetispeed, (struct termios * t, speed_t speed)) { constexpr speed_t NOT_SPEED_MASK = ~speed_t(CBAUD); @@ -28,4 +28,4 @@ LLVM_LIBC_FUNCTION(int, cfsetispeed, (struct termios * t, speed_t speed)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/termios/linux/cfsetospeed.cpp b/libc/src/termios/linux/cfsetospeed.cpp index 327cc56..d21f629 100644 --- a/libc/src/termios/linux/cfsetospeed.cpp +++ b/libc/src/termios/linux/cfsetospeed.cpp @@ -13,7 +13,7 @@ #include <termios.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, cfsetospeed, (struct termios * t, speed_t speed)) { constexpr speed_t NOT_SPEED_MASK = ~speed_t(CBAUD); @@ -28,4 +28,4 @@ LLVM_LIBC_FUNCTION(int, cfsetospeed, (struct termios * t, speed_t speed)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/termios/linux/kernel_termios.h b/libc/src/termios/linux/kernel_termios.h index 252f63d..d96de72 100644 --- a/libc/src/termios/linux/kernel_termios.h +++ b/libc/src/termios/linux/kernel_termios.h @@ -12,7 +12,7 @@ #include <stddef.h> #include <termios.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // The kernel's struct termios is different from the libc's struct termios. The // kernel's syscalls expect the size and layout of its definition of struct @@ -36,6 +36,6 @@ struct kernel_termios { cc_t c_cc[KERNEL_NCCS]; }; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TERMIOS_LINUX_KERNEL_TERMIOS_H diff --git a/libc/src/termios/linux/tcdrain.cpp b/libc/src/termios/linux/tcdrain.cpp index a45a00a..c3826ff9 100644 --- a/libc/src/termios/linux/tcdrain.cpp +++ b/libc/src/termios/linux/tcdrain.cpp @@ -16,10 +16,10 @@ #include <sys/syscall.h> // For syscall numbers #include <termios.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, tcdrain, (int fd)) { - int ret = __llvm_libc::syscall_impl<int>(SYS_ioctl, fd, TCSBRK, 1); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_ioctl, fd, TCSBRK, 1); if (ret < 0) { libc_errno = -ret; return -1; @@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(int, tcdrain, (int fd)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/termios/linux/tcflow.cpp b/libc/src/termios/linux/tcflow.cpp index a959cf7..9753ef7 100644 --- a/libc/src/termios/linux/tcflow.cpp +++ b/libc/src/termios/linux/tcflow.cpp @@ -16,10 +16,10 @@ #include <sys/syscall.h> // For syscall numbers #include <termios.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, tcflow, (int fd, int action)) { - int ret = __llvm_libc::syscall_impl<int>(SYS_ioctl, fd, TCXONC, action); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_ioctl, fd, TCXONC, action); if (ret < 0) { libc_errno = -ret; return -1; @@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(int, tcflow, (int fd, int action)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/termios/linux/tcflush.cpp b/libc/src/termios/linux/tcflush.cpp index 2618329..9c7e8f0 100644 --- a/libc/src/termios/linux/tcflush.cpp +++ b/libc/src/termios/linux/tcflush.cpp @@ -16,11 +16,11 @@ #include <sys/syscall.h> // For syscall numbers #include <termios.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, tcflush, (int fd, int queue_selector)) { int ret = - __llvm_libc::syscall_impl<int>(SYS_ioctl, fd, TCFLSH, queue_selector); + LIBC_NAMESPACE::syscall_impl<int>(SYS_ioctl, fd, TCFLSH, queue_selector); if (ret < 0) { libc_errno = -ret; return -1; @@ -28,4 +28,4 @@ LLVM_LIBC_FUNCTION(int, tcflush, (int fd, int queue_selector)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/termios/linux/tcgetattr.cpp b/libc/src/termios/linux/tcgetattr.cpp index 931591c..254c485 100644 --- a/libc/src/termios/linux/tcgetattr.cpp +++ b/libc/src/termios/linux/tcgetattr.cpp @@ -17,11 +17,11 @@ #include <sys/syscall.h> // For syscall numbers #include <termios.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, tcgetattr, (int fd, struct termios *t)) { - __llvm_libc::kernel_termios kt; - int ret = __llvm_libc::syscall_impl<int>(SYS_ioctl, fd, TCGETS, &kt); + LIBC_NAMESPACE::kernel_termios kt; + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_ioctl, fd, TCGETS, &kt); if (ret < 0) { libc_errno = -ret; return -1; @@ -43,4 +43,4 @@ LLVM_LIBC_FUNCTION(int, tcgetattr, (int fd, struct termios *t)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/termios/linux/tcgetsid.cpp b/libc/src/termios/linux/tcgetsid.cpp index 9afbc91..7b2abf8 100644 --- a/libc/src/termios/linux/tcgetsid.cpp +++ b/libc/src/termios/linux/tcgetsid.cpp @@ -16,11 +16,11 @@ #include <sys/syscall.h> // For syscall numbers #include <termios.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(pid_t, tcgetsid, (int fd)) { pid_t sid; - int ret = __llvm_libc::syscall_impl<int>(SYS_ioctl, fd, TIOCGSID, &sid); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_ioctl, fd, TIOCGSID, &sid); if (ret < 0) { libc_errno = -ret; return -1; @@ -28,4 +28,4 @@ LLVM_LIBC_FUNCTION(pid_t, tcgetsid, (int fd)) { return sid; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/termios/linux/tcsendbreak.cpp b/libc/src/termios/linux/tcsendbreak.cpp index a2467f0..fdd3f8a 100644 --- a/libc/src/termios/linux/tcsendbreak.cpp +++ b/libc/src/termios/linux/tcsendbreak.cpp @@ -16,13 +16,13 @@ #include <sys/syscall.h> // For syscall numbers #include <termios.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(pid_t, tcsendbreak, (int fd, int /* unused duration */)) { // POSIX leaves the behavior for non-zero duration implementation dependent. // Which means that the behavior can be the same as it is when duration is // zero. So, we just pass zero to the syscall. - int ret = __llvm_libc::syscall_impl<int>(SYS_ioctl, fd, TCSBRK, 0); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_ioctl, fd, TCSBRK, 0); if (ret < 0) { libc_errno = -ret; return -1; @@ -30,4 +30,4 @@ LLVM_LIBC_FUNCTION(pid_t, tcsendbreak, (int fd, int /* unused duration */)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/termios/linux/tcsetattr.cpp b/libc/src/termios/linux/tcsetattr.cpp index d3872b1..ba500a0 100644 --- a/libc/src/termios/linux/tcsetattr.cpp +++ b/libc/src/termios/linux/tcsetattr.cpp @@ -17,7 +17,7 @@ #include <sys/syscall.h> // For syscall numbers #include <termios.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, tcsetattr, (int fd, int actions, const struct termios *t)) { @@ -51,7 +51,7 @@ LLVM_LIBC_FUNCTION(int, tcsetattr, kt.c_cc[i] = 0; } - int ret = __llvm_libc::syscall_impl<int>(SYS_ioctl, fd, cmd, &kt); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_ioctl, fd, cmd, &kt); if (ret < 0) { libc_errno = -ret; return -1; @@ -59,4 +59,4 @@ LLVM_LIBC_FUNCTION(int, tcsetattr, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/termios/tcdrain.h b/libc/src/termios/tcdrain.h index 1bde86d..5204206 100644 --- a/libc/src/termios/tcdrain.h +++ b/libc/src/termios/tcdrain.h @@ -11,10 +11,10 @@ #include <termios.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int tcdrain(int fd); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TERMIOS_TCDRAIN_H diff --git a/libc/src/termios/tcflow.h b/libc/src/termios/tcflow.h index 4040c27..267d3f6 100644 --- a/libc/src/termios/tcflow.h +++ b/libc/src/termios/tcflow.h @@ -11,10 +11,10 @@ #include <termios.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int tcflow(int fd, int action); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TERMIOS_TCFLOW_H diff --git a/libc/src/termios/tcflush.h b/libc/src/termios/tcflush.h index 61fec9b..d631ca2 100644 --- a/libc/src/termios/tcflush.h +++ b/libc/src/termios/tcflush.h @@ -11,10 +11,10 @@ #include <termios.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int tcflush(int fd, int queue_selector); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TERMIOS_TCFLUSH_H diff --git a/libc/src/termios/tcgetattr.h b/libc/src/termios/tcgetattr.h index 61fdcdb..c39aa41 100644 --- a/libc/src/termios/tcgetattr.h +++ b/libc/src/termios/tcgetattr.h @@ -11,10 +11,10 @@ #include <termios.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int tcgetattr(int fd, struct termios *t); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TERMIOS_TCGETATTR_H diff --git a/libc/src/termios/tcgetsid.h b/libc/src/termios/tcgetsid.h index 1d89347..07dbb22 100644 --- a/libc/src/termios/tcgetsid.h +++ b/libc/src/termios/tcgetsid.h @@ -11,10 +11,10 @@ #include <termios.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { pid_t tcgetsid(int fd); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TERMIOS_TCGETSID_H diff --git a/libc/src/termios/tcsendbreak.h b/libc/src/termios/tcsendbreak.h index 52d7243..487fdad 100644 --- a/libc/src/termios/tcsendbreak.h +++ b/libc/src/termios/tcsendbreak.h @@ -11,10 +11,10 @@ #include <termios.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int tcsendbreak(int fd, int duration); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TERMIOS_TCSENDBREAK_H diff --git a/libc/src/termios/tcsetattr.h b/libc/src/termios/tcsetattr.h index a7fdfd7..d514ac71 100644 --- a/libc/src/termios/tcsetattr.h +++ b/libc/src/termios/tcsetattr.h @@ -11,10 +11,10 @@ #include <termios.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int tcsetattr(int fd, int actions, const struct termios *t); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TERMIOS_TCSETATTR_H diff --git a/libc/src/threads/call_once.cpp b/libc/src/threads/call_once.cpp index 67ab345..2d91094 100644 --- a/libc/src/threads/call_once.cpp +++ b/libc/src/threads/call_once.cpp @@ -12,7 +12,7 @@ #include <threads.h> // For once_flag and __call_once_func_t definitions. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, call_once, (once_flag * flag, __call_once_func_t func)) { @@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(void, call_once, reinterpret_cast<CallOnceCallback *>(func)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/call_once.h b/libc/src/threads/call_once.h index c1e1a71..186d63c 100644 --- a/libc/src/threads/call_once.h +++ b/libc/src/threads/call_once.h @@ -11,10 +11,10 @@ #include <threads.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void call_once(once_flag *flag, __call_once_func_t func); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_CALL_ONCE_H diff --git a/libc/src/threads/cnd_broadcast.h b/libc/src/threads/cnd_broadcast.h index fd02195..4e996f2 100644 --- a/libc/src/threads/cnd_broadcast.h +++ b/libc/src/threads/cnd_broadcast.h @@ -11,10 +11,10 @@ #include <threads.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int cnd_broadcast(cnd_t *cond); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_CND_BROADCAST_H diff --git a/libc/src/threads/cnd_destroy.h b/libc/src/threads/cnd_destroy.h index 3400257..d102e7b8 100644 --- a/libc/src/threads/cnd_destroy.h +++ b/libc/src/threads/cnd_destroy.h @@ -11,10 +11,10 @@ #include <threads.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void cnd_destroy(cnd_t *cond); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_CND_DESTROY_H diff --git a/libc/src/threads/cnd_init.h b/libc/src/threads/cnd_init.h index 826564b..c4fc02f 100644 --- a/libc/src/threads/cnd_init.h +++ b/libc/src/threads/cnd_init.h @@ -11,10 +11,10 @@ #include <threads.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int cnd_init(cnd_t *cond); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_CND_INIT_H diff --git a/libc/src/threads/cnd_signal.h b/libc/src/threads/cnd_signal.h index ec2a977..4c60a92 100644 --- a/libc/src/threads/cnd_signal.h +++ b/libc/src/threads/cnd_signal.h @@ -11,10 +11,10 @@ #include <threads.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int cnd_signal(cnd_t *cond); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_CND_SIGNAL_H diff --git a/libc/src/threads/cnd_wait.h b/libc/src/threads/cnd_wait.h index 812e704..5d2cdbb 100644 --- a/libc/src/threads/cnd_wait.h +++ b/libc/src/threads/cnd_wait.h @@ -11,10 +11,10 @@ #include <threads.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int cnd_wait(cnd_t *cond, mtx_t *mutex); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_CND_WAIT_H diff --git a/libc/src/threads/linux/CndVar.h b/libc/src/threads/linux/CndVar.h index 535f729..b4afdef 100644 --- a/libc/src/threads/linux/CndVar.h +++ b/libc/src/threads/linux/CndVar.h @@ -19,7 +19,7 @@ #include <sys/syscall.h> // For syscall numbers. #include <threads.h> // For values like thrd_success etc. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { struct CndVar { enum CndWaiterStatus : uint32_t { @@ -84,8 +84,8 @@ struct CndVar { } } - __llvm_libc::syscall_impl<long>(FUTEX_SYSCALL_ID, &waiter.futex_word.val, - FUTEX_WAIT, WS_Waiting, 0, 0, 0); + LIBC_NAMESPACE::syscall_impl<long>(FUTEX_SYSCALL_ID, &waiter.futex_word.val, + FUTEX_WAIT, WS_Waiting, 0, 0, 0); // At this point, if locking |m| fails, we can simply return as the // queued up waiter would have been removed from the queue. @@ -109,7 +109,7 @@ struct CndVar { qmtx.futex_word = FutexWordType(Mutex::LockState::Free); - __llvm_libc::syscall_impl<long>( + LIBC_NAMESPACE::syscall_impl<long>( FUTEX_SYSCALL_ID, &qmtx.futex_word.val, FUTEX_WAKE_OP, 1, 1, &first->futex_word.val, FUTEX_OP(FUTEX_OP_SET, WS_Signalled, FUTEX_OP_CMP_EQ, WS_Waiting)); @@ -126,7 +126,7 @@ struct CndVar { // atomically update the waiter status to WS_Signalled before waking // up the waiter. A dummy location is used for the other futex of // FUTEX_WAKE_OP. - __llvm_libc::syscall_impl<long>( + LIBC_NAMESPACE::syscall_impl<long>( FUTEX_SYSCALL_ID, &dummy_futex_word, FUTEX_WAKE_OP, 1, 1, &waiter->futex_word.val, FUTEX_OP(FUTEX_OP_SET, WS_Signalled, FUTEX_OP_CMP_EQ, WS_Waiting)); @@ -141,6 +141,6 @@ static_assert(sizeof(CndVar) == sizeof(cnd_t), "internal representation of condition variable and the public " "cnd_t type."); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_LINUX_CNDVAR_H diff --git a/libc/src/threads/linux/Futex.h b/libc/src/threads/linux/Futex.h index 53e2858..4b426ac 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 a3c0131..5cdd8eb 100644 --- a/libc/src/threads/linux/call_once.cpp +++ b/libc/src/threads/linux/call_once.cpp @@ -19,7 +19,7 @@ #include <sys/syscall.h> // For syscall numbers. #include <threads.h> // For call_once related type definition. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { static constexpr FutexWordType START = 0x11; static constexpr FutexWordType WAITING = 0x22; @@ -46,10 +46,10 @@ LLVM_LIBC_FUNCTION(void, call_once, func(); auto status = futex_word->exchange(FINISH); if (status == WAITING) { - __llvm_libc::syscall_impl(FUTEX_SYSCALL_ID, &futex_word->val, - FUTEX_WAKE_PRIVATE, - INT_MAX, // Wake all waiters. - 0, 0, 0); + LIBC_NAMESPACE::syscall_impl(FUTEX_SYSCALL_ID, &futex_word->val, + FUTEX_WAKE_PRIVATE, + INT_MAX, // Wake all waiters. + 0, 0, 0); } return; } @@ -57,11 +57,11 @@ LLVM_LIBC_FUNCTION(void, call_once, FutexWordType status = START; if (futex_word->compare_exchange_strong(status, WAITING) || status == WAITING) { - __llvm_libc::syscall_impl( + LIBC_NAMESPACE::syscall_impl( FUTEX_SYSCALL_ID, &futex_word->val, FUTEX_WAIT_PRIVATE, WAITING, // Block only if status is still |WAITING|. 0, 0, 0); } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/linux/cnd_broadcast.cpp b/libc/src/threads/linux/cnd_broadcast.cpp index 7b7c8f3..180ac6d 100644 --- a/libc/src/threads/linux/cnd_broadcast.cpp +++ b/libc/src/threads/linux/cnd_broadcast.cpp @@ -11,11 +11,11 @@ #include "src/threads/cnd_broadcast.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, cnd_broadcast, (cnd_t * cond)) { CndVar *cndvar = reinterpret_cast<CndVar *>(cond); return cndvar->broadcast(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/linux/cnd_destroy.cpp b/libc/src/threads/linux/cnd_destroy.cpp index 947c5be..08eb3a1 100644 --- a/libc/src/threads/linux/cnd_destroy.cpp +++ b/libc/src/threads/linux/cnd_destroy.cpp @@ -11,11 +11,11 @@ #include "src/threads/cnd_destroy.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, cnd_destroy, (cnd_t * cond)) { CndVar *cndvar = reinterpret_cast<CndVar *>(cond); CndVar::destroy(cndvar); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/linux/cnd_init.cpp b/libc/src/threads/linux/cnd_init.cpp index 5e3156d..5e3f360 100644 --- a/libc/src/threads/linux/cnd_init.cpp +++ b/libc/src/threads/linux/cnd_init.cpp @@ -11,11 +11,11 @@ #include "src/threads/cnd_init.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, cnd_init, (cnd_t * cond)) { CndVar *cndvar = reinterpret_cast<CndVar *>(cond); return CndVar::init(cndvar); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/linux/cnd_signal.cpp b/libc/src/threads/linux/cnd_signal.cpp index 6099b13..dba01ab 100644 --- a/libc/src/threads/linux/cnd_signal.cpp +++ b/libc/src/threads/linux/cnd_signal.cpp @@ -11,11 +11,11 @@ #include "src/threads/cnd_signal.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, cnd_signal, (cnd_t * cond)) { CndVar *cndvar = reinterpret_cast<CndVar *>(cond); return cndvar->notify_one(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/linux/cnd_wait.cpp b/libc/src/threads/linux/cnd_wait.cpp index 5c0aed7..db3d7f1 100644 --- a/libc/src/threads/linux/cnd_wait.cpp +++ b/libc/src/threads/linux/cnd_wait.cpp @@ -12,7 +12,7 @@ #include "src/__support/threads/mutex.h" #include "src/threads/cnd_wait.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, cnd_wait, (cnd_t * cond, mtx_t *mtx)) { CndVar *cndvar = reinterpret_cast<CndVar *>(cond); @@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(int, cnd_wait, (cnd_t * cond, mtx_t *mtx)) { return cndvar->wait(mutex); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/mtx_destroy.cpp b/libc/src/threads/mtx_destroy.cpp index 6432700..5ee4777 100644 --- a/libc/src/threads/mtx_destroy.cpp +++ b/libc/src/threads/mtx_destroy.cpp @@ -12,8 +12,8 @@ #include <threads.h> // For mtx_t definition. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, mtx_destroy, (mtx_t *)) {} -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/mtx_destroy.h b/libc/src/threads/mtx_destroy.h index 353bc27..1abf5d5 100644 --- a/libc/src/threads/mtx_destroy.h +++ b/libc/src/threads/mtx_destroy.h @@ -11,10 +11,10 @@ #include <threads.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void mtx_destroy(mtx_t *mutex); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_MTX_DESTROY_H diff --git a/libc/src/threads/mtx_init.cpp b/libc/src/threads/mtx_init.cpp index 188209c..74d08d3 100644 --- a/libc/src/threads/mtx_init.cpp +++ b/libc/src/threads/mtx_init.cpp @@ -12,7 +12,7 @@ #include <threads.h> // For mtx_t definition. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { static_assert(sizeof(Mutex) <= sizeof(mtx_t), "The public mtx_t type cannot accommodate the internal mutex " @@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, mtx_init, (mtx_t * m, int type)) { return err == MutexError::NONE ? thrd_success : thrd_error; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/mtx_init.h b/libc/src/threads/mtx_init.h index 8fcaa42..69294d7 100644 --- a/libc/src/threads/mtx_init.h +++ b/libc/src/threads/mtx_init.h @@ -11,10 +11,10 @@ #include <threads.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int mtx_init(mtx_t *mutex, int type); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_MTX_INIT_H diff --git a/libc/src/threads/mtx_lock.cpp b/libc/src/threads/mtx_lock.cpp index 58379f6..013a88a 100644 --- a/libc/src/threads/mtx_lock.cpp +++ b/libc/src/threads/mtx_lock.cpp @@ -12,7 +12,7 @@ #include <threads.h> // For mtx_t definition. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // The implementation currently handles only plain mutexes. LLVM_LIBC_FUNCTION(int, mtx_lock, (mtx_t * mutex)) { @@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(int, mtx_lock, (mtx_t * mutex)) { return err == MutexError::NONE ? thrd_success : thrd_error; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/mtx_lock.h b/libc/src/threads/mtx_lock.h index df3ec0d..15c9e1a 100644 --- a/libc/src/threads/mtx_lock.h +++ b/libc/src/threads/mtx_lock.h @@ -11,10 +11,10 @@ #include <threads.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int mtx_lock(mtx_t *mutex); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_MTX_LOCK_H diff --git a/libc/src/threads/mtx_unlock.cpp b/libc/src/threads/mtx_unlock.cpp index f5c6a13..a72ee44 100644 --- a/libc/src/threads/mtx_unlock.cpp +++ b/libc/src/threads/mtx_unlock.cpp @@ -12,7 +12,7 @@ #include <threads.h> // For mtx_t definition. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // The implementation currently handles only plain mutexes. LLVM_LIBC_FUNCTION(int, mtx_unlock, (mtx_t * mutex)) { @@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(int, mtx_unlock, (mtx_t * mutex)) { return err == MutexError::NONE ? thrd_success : thrd_error; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/mtx_unlock.h b/libc/src/threads/mtx_unlock.h index b58df63..54fb034 100644 --- a/libc/src/threads/mtx_unlock.h +++ b/libc/src/threads/mtx_unlock.h @@ -11,10 +11,10 @@ #include <threads.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int mtx_unlock(mtx_t *mutex); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_MTX_UNLOCK_H diff --git a/libc/src/threads/thrd_create.cpp b/libc/src/threads/thrd_create.cpp index 8ec3cf1..06cba84 100644 --- a/libc/src/threads/thrd_create.cpp +++ b/libc/src/threads/thrd_create.cpp @@ -13,14 +13,14 @@ #include <errno.h> #include <threads.h> // For thrd_* type definitions. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -static_assert(sizeof(thrd_t) == sizeof(__llvm_libc::Thread), +static_assert(sizeof(thrd_t) == sizeof(LIBC_NAMESPACE::Thread), "Mismatch between thrd_t and internal Thread."); LLVM_LIBC_FUNCTION(int, thrd_create, (thrd_t * th, thrd_start_t func, void *arg)) { - auto *thread = reinterpret_cast<__llvm_libc::Thread *>(th); + auto *thread = reinterpret_cast<LIBC_NAMESPACE::Thread *>(th); int result = thread->run(func, arg); if (result == 0) return thrd_success; @@ -30,4 +30,4 @@ LLVM_LIBC_FUNCTION(int, thrd_create, return thrd_error; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/thrd_create.h b/libc/src/threads/thrd_create.h index 9ed19c4..0efa6f5 100644 --- a/libc/src/threads/thrd_create.h +++ b/libc/src/threads/thrd_create.h @@ -11,10 +11,10 @@ #include <threads.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int thrd_create(thrd_t *thread, thrd_start_t func, void *arg); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_THRD_CREATE_H diff --git a/libc/src/threads/thrd_current.cpp b/libc/src/threads/thrd_current.cpp index e8afd7b..b5ea043 100644 --- a/libc/src/threads/thrd_current.cpp +++ b/libc/src/threads/thrd_current.cpp @@ -12,9 +12,9 @@ #include <threads.h> // For thrd_* type definitions. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -static_assert(sizeof(thrd_t) == sizeof(__llvm_libc::Thread), +static_assert(sizeof(thrd_t) == sizeof(LIBC_NAMESPACE::Thread), "Mismatch between thrd_t and internal Thread."); LLVM_LIBC_FUNCTION(thrd_t, thrd_current, ()) { @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(thrd_t, thrd_current, ()) { return th; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/thrd_current.h b/libc/src/threads/thrd_current.h index 338a16d..2125729 100644 --- a/libc/src/threads/thrd_current.h +++ b/libc/src/threads/thrd_current.h @@ -11,10 +11,10 @@ #include <threads.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { thrd_t thrd_current(); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_THRD_CURRENT_H diff --git a/libc/src/threads/thrd_detach.cpp b/libc/src/threads/thrd_detach.cpp index 20c6540..17731c6 100644 --- a/libc/src/threads/thrd_detach.cpp +++ b/libc/src/threads/thrd_detach.cpp @@ -12,9 +12,9 @@ #include <threads.h> // For thrd_* type definitions. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -static_assert(sizeof(thrd_t) == sizeof(__llvm_libc::Thread), +static_assert(sizeof(thrd_t) == sizeof(LIBC_NAMESPACE::Thread), "Mismatch between thrd_t and internal Thread."); LLVM_LIBC_FUNCTION(int, thrd_detach, (thrd_t th)) { @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, thrd_detach, (thrd_t th)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/thrd_detach.h b/libc/src/threads/thrd_detach.h index 58d36e8..64f2094 100644 --- a/libc/src/threads/thrd_detach.h +++ b/libc/src/threads/thrd_detach.h @@ -11,10 +11,10 @@ #include <threads.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int thrd_detach(thrd_t thread); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_THRD_DETACH_H diff --git a/libc/src/threads/thrd_equal.cpp b/libc/src/threads/thrd_equal.cpp index aac220ec..b9717cf 100644 --- a/libc/src/threads/thrd_equal.cpp +++ b/libc/src/threads/thrd_equal.cpp @@ -12,9 +12,9 @@ #include <threads.h> // For thrd_* type definitions. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -static_assert(sizeof(thrd_t) == sizeof(__llvm_libc::Thread), +static_assert(sizeof(thrd_t) == sizeof(LIBC_NAMESPACE::Thread), "Mismatch between thrd_t and internal Thread."); LLVM_LIBC_FUNCTION(int, thrd_equal, (thrd_t lhs, thrd_t rhs)) { @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, thrd_equal, (thrd_t lhs, thrd_t rhs)) { return *lhs_internal == *rhs_internal; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/thrd_equal.h b/libc/src/threads/thrd_equal.h index 9e1bebc0..5878ea4 100644 --- a/libc/src/threads/thrd_equal.h +++ b/libc/src/threads/thrd_equal.h @@ -11,10 +11,10 @@ #include <threads.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int thrd_equal(thrd_t lhs, thrd_t rhs); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_THRD_EQUAL_H diff --git a/libc/src/threads/thrd_exit.cpp b/libc/src/threads/thrd_exit.cpp index 9935c23b..67a7a41 100644 --- a/libc/src/threads/thrd_exit.cpp +++ b/libc/src/threads/thrd_exit.cpp @@ -12,13 +12,13 @@ #include <threads.h> // For thrd_* type definitions. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -static_assert(sizeof(thrd_t) == sizeof(__llvm_libc::Thread), +static_assert(sizeof(thrd_t) == sizeof(LIBC_NAMESPACE::Thread), "Mismatch between thrd_t and internal Thread."); LLVM_LIBC_FUNCTION(void, thrd_exit, (int retval)) { thread_exit(ThreadReturnValue(retval), ThreadStyle::STDC); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/thrd_exit.h b/libc/src/threads/thrd_exit.h index 4cc8351..19eb027 100644 --- a/libc/src/threads/thrd_exit.h +++ b/libc/src/threads/thrd_exit.h @@ -11,10 +11,10 @@ #include <threads.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void thrd_exit(int retval); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_THRD_EXIT_H diff --git a/libc/src/threads/thrd_join.cpp b/libc/src/threads/thrd_join.cpp index e4cf552..cc8ba4b 100644 --- a/libc/src/threads/thrd_join.cpp +++ b/libc/src/threads/thrd_join.cpp @@ -12,9 +12,9 @@ #include <threads.h> // For thrd_* type definitions. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -static_assert(sizeof(thrd_t) == sizeof(__llvm_libc::Thread), +static_assert(sizeof(thrd_t) == sizeof(LIBC_NAMESPACE::Thread), "Mismatch between thrd_t and internal Thread."); LLVM_LIBC_FUNCTION(int, thrd_join, (thrd_t th, int *retval)) { @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, thrd_join, (thrd_t th, int *retval)) { return result == 0 ? thrd_success : thrd_error; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/thrd_join.h b/libc/src/threads/thrd_join.h index d86529c..21a398c 100644 --- a/libc/src/threads/thrd_join.h +++ b/libc/src/threads/thrd_join.h @@ -11,10 +11,10 @@ #include <threads.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int thrd_join(thrd_t thread, int *retval); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_THRD_JOIN_H diff --git a/libc/src/threads/tss_create.cpp b/libc/src/threads/tss_create.cpp index f384565..ddea44d 100644 --- a/libc/src/threads/tss_create.cpp +++ b/libc/src/threads/tss_create.cpp @@ -13,14 +13,14 @@ #include <threads.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, tss_create, (tss_t * key, tss_dtor_t dtor)) { - auto k = __llvm_libc::new_tss_key(dtor); + auto k = LIBC_NAMESPACE::new_tss_key(dtor); if (!k) return thrd_error; *key = *k; return thrd_success; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/tss_create.h b/libc/src/threads/tss_create.h index 967bdca..def903e 100644 --- a/libc/src/threads/tss_create.h +++ b/libc/src/threads/tss_create.h @@ -11,10 +11,10 @@ #include <threads.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int tss_create(tss_t *key, tss_dtor_t dtor); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_TSS_CREATE_H diff --git a/libc/src/threads/tss_delete.cpp b/libc/src/threads/tss_delete.cpp index 6bdd4aa..a2a4e9a 100644 --- a/libc/src/threads/tss_delete.cpp +++ b/libc/src/threads/tss_delete.cpp @@ -13,10 +13,10 @@ #include <threads.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, tss_delete, (tss_t key)) { - __llvm_libc::tss_key_delete(key); + LIBC_NAMESPACE::tss_key_delete(key); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/tss_delete.h b/libc/src/threads/tss_delete.h index 1f55d3b..3efc0d7 100644 --- a/libc/src/threads/tss_delete.h +++ b/libc/src/threads/tss_delete.h @@ -11,10 +11,10 @@ #include <threads.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void tss_delete(tss_t key); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_TSS_DELETE_H diff --git a/libc/src/threads/tss_get.cpp b/libc/src/threads/tss_get.cpp index 4596a93..9b8c94f 100644 --- a/libc/src/threads/tss_get.cpp +++ b/libc/src/threads/tss_get.cpp @@ -13,8 +13,8 @@ #include <threads.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void *, tss_get, (tss_t key)) { return get_tss_value(key); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/tss_get.h b/libc/src/threads/tss_get.h index 4cedce9..dfdb79c 100644 --- a/libc/src/threads/tss_get.h +++ b/libc/src/threads/tss_get.h @@ -11,10 +11,10 @@ #include <threads.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void *tss_get(tss_t); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_TSS_GET_H diff --git a/libc/src/threads/tss_set.cpp b/libc/src/threads/tss_set.cpp index 977168a..640896d 100644 --- a/libc/src/threads/tss_set.cpp +++ b/libc/src/threads/tss_set.cpp @@ -13,7 +13,7 @@ #include <threads.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, tss_set, (tss_t key, void *data)) { if (set_tss_value(key, data)) @@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(int, tss_set, (tss_t key, void *data)) { return thrd_error; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/tss_set.h b/libc/src/threads/tss_set.h index 49d69ef..249607f 100644 --- a/libc/src/threads/tss_set.h +++ b/libc/src/threads/tss_set.h @@ -11,10 +11,10 @@ #include <threads.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int tss_set(tss_t, void *); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_TSS_SET_H diff --git a/libc/src/time/asctime.cpp b/libc/src/time/asctime.cpp index 3ccfb04..9958903 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 f053ad2..941cd70 100644 --- a/libc/src/time/asctime.h +++ b/libc/src/time/asctime.h @@ -11,10 +11,10 @@ #include <time.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { char *asctime(const struct tm *timeptr); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TIME_ASCTIME_H diff --git a/libc/src/time/asctime_r.cpp b/libc/src/time/asctime_r.cpp index f957dac..19a212418 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 21bba7e..04d3c01d 100644 --- a/libc/src/time/asctime_r.h +++ b/libc/src/time/asctime_r.h @@ -11,10 +11,10 @@ #include <time.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { char *asctime_r(const struct tm *timeptr, char *buffer); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TIME_ASCTIME_R_H diff --git a/libc/src/time/clock.h b/libc/src/time/clock.h index 7a259e6..d4af765 100644 --- a/libc/src/time/clock.h +++ b/libc/src/time/clock.h @@ -11,10 +11,10 @@ #include <time.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { clock_t clock(); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TIME_CLOCK_H diff --git a/libc/src/time/clock_gettime.h b/libc/src/time/clock_gettime.h index a131251..72e2e194 100644 --- a/libc/src/time/clock_gettime.h +++ b/libc/src/time/clock_gettime.h @@ -11,10 +11,10 @@ #include <time.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int clock_gettime(clockid_t clockid, struct timespec *tp); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TIME_CLOCK_GETTIME_H diff --git a/libc/src/time/difftime.cpp b/libc/src/time/difftime.cpp index 7b45267..95aa1be 100644 --- a/libc/src/time/difftime.cpp +++ b/libc/src/time/difftime.cpp @@ -9,10 +9,10 @@ #include "src/time/difftime.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(double, difftime, (time_t end, time_t beginning)) { return static_cast<double>(end - beginning); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/time/difftime.h b/libc/src/time/difftime.h index 249dfed..6498b8b 100644 --- a/libc/src/time/difftime.h +++ b/libc/src/time/difftime.h @@ -11,10 +11,10 @@ #include <time.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { double difftime(time_t end, time_t beginning); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TIME_DIFFTIME_H diff --git a/libc/src/time/gettimeofday.h b/libc/src/time/gettimeofday.h index ee08efb..880b94c 100644 --- a/libc/src/time/gettimeofday.h +++ b/libc/src/time/gettimeofday.h @@ -11,10 +11,10 @@ #include <time.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int gettimeofday(struct timeval *tv, void *tz); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TIME_GETTIMEOFDAY_H diff --git a/libc/src/time/gmtime.cpp b/libc/src/time/gmtime.cpp index 75ce859..8597f22 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 950ba4f..d361eb2 100644 --- a/libc/src/time/gmtime.h +++ b/libc/src/time/gmtime.h @@ -11,10 +11,10 @@ #include <time.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { struct tm *gmtime(const time_t *timer); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TIME_GMTIME_H diff --git a/libc/src/time/gmtime_r.cpp b/libc/src/time/gmtime_r.cpp index 67bf126..15a0c06 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 619af60..f7aac28 100644 --- a/libc/src/time/gmtime_r.h +++ b/libc/src/time/gmtime_r.h @@ -11,10 +11,10 @@ #include <time.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { struct tm *gmtime_r(const time_t *timer, struct tm *result); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TIME_GMTIME_R_H diff --git a/libc/src/time/gpu/clock.cpp b/libc/src/time/gpu/clock.cpp index 146addd..86cc97e 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 52cfecb..a0c7355 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 ef5e72f..935a539 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 da9cd3e..075fcb6 100644 --- a/libc/src/time/gpu/time_utils.h +++ b/libc/src/time/gpu/time_utils.h @@ -11,7 +11,7 @@ #include "src/__support/GPU/utils.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { #if defined(LIBC_TARGET_ARCH_IS_AMDGPU) // AMDGPU does not have a single set frequency. Different architectures and @@ -39,8 +39,8 @@ constexpr uint64_t clock_freq = 0; // We provide an externally visible symbol such that the runtime can set this to // the correct value. If it is not set we try to default to the known values. extern "C" [[gnu::visibility("protected")]] uint64_t - [[clang::address_space(4)]] __llvm_libc_clock_freq; -#define GPU_CLOCKS_PER_SEC static_cast<clock_t>(__llvm_libc_clock_freq) + [[clang::address_space(4)]] LIBC_NAMESPACE_clock_freq; +#define GPU_CLOCKS_PER_SEC static_cast<clock_t>(LIBC_NAMESPACE_clock_freq) #elif defined(LIBC_TARGET_ARCH_IS_NVPTX) // NPVTX uses a single 1 GHz fixed frequency clock for all target architectures. @@ -49,6 +49,6 @@ extern "C" [[gnu::visibility("protected")]] uint64_t #error "Unsupported target" #endif -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TIME_GPU_TIME_UTILS_H diff --git a/libc/src/time/linux/clock.cpp b/libc/src/time/linux/clock.cpp index cf27f5c..1e95f05 100644 --- a/libc/src/time/linux/clock.cpp +++ b/libc/src/time/linux/clock.cpp @@ -17,7 +17,7 @@ #include <sys/syscall.h> // For syscall numbers. #include <time.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(clock_t, clock, ()) { struct timespec ts; @@ -45,4 +45,4 @@ LLVM_LIBC_FUNCTION(clock_t, clock, ()) { ts.tv_nsec / (1000000000 / CLOCKS_PER_SEC)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/time/linux/clockGetTimeImpl.h b/libc/src/time/linux/clockGetTimeImpl.h index e519ebcd..8c8c9fc 100644 --- a/libc/src/time/linux/clockGetTimeImpl.h +++ b/libc/src/time/linux/clockGetTimeImpl.h @@ -18,22 +18,22 @@ #include <sys/syscall.h> // For syscall numbers. #include <time.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { LIBC_INLINE ErrorOr<int> clock_gettimeimpl(clockid_t clockid, struct timespec *ts) { #if SYS_clock_gettime - int ret = __llvm_libc::syscall_impl<int>(SYS_clock_gettime, - static_cast<long>(clockid), - reinterpret_cast<long>(ts)); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_clock_gettime, + static_cast<long>(clockid), + reinterpret_cast<long>(ts)); #elif defined(SYS_clock_gettime64) static_assert( sizeof(time_t) == sizeof(int64_t), "SYS_clock_gettime64 requires struct timespec with 64-bit members."); - int ret = __llvm_libc::syscall_impl<int>(SYS_clock_gettime64, - static_cast<long>(clockid), - reinterpret_cast<long>(ts)); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_clock_gettime64, + static_cast<long>(clockid), + reinterpret_cast<long>(ts)); #else #error "SYS_clock_gettime and SYS_clock_gettime64 syscalls not available." #endif @@ -43,6 +43,6 @@ LIBC_INLINE ErrorOr<int> clock_gettimeimpl(clockid_t clockid, } } // namespace internal -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TIME_LINUX_CLOCKGETTIMEIMPL_H diff --git a/libc/src/time/linux/clock_gettime.cpp b/libc/src/time/linux/clock_gettime.cpp index 33ec04e..47e974a 100644 --- a/libc/src/time/linux/clock_gettime.cpp +++ b/libc/src/time/linux/clock_gettime.cpp @@ -16,7 +16,7 @@ #include <sys/syscall.h> // For syscall numbers. #include <time.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO(michaelrj): Move this into time/linux with the other syscalls. LLVM_LIBC_FUNCTION(int, clock_gettime, @@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(int, clock_gettime, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/time/linux/gettimeofday.cpp b/libc/src/time/linux/gettimeofday.cpp index 2df6429..07ab4d5 100644 --- a/libc/src/time/linux/gettimeofday.cpp +++ b/libc/src/time/linux/gettimeofday.cpp @@ -15,7 +15,7 @@ #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO(michaelrj): Move this into time/linux with the other syscalls. LLVM_LIBC_FUNCTION(int, gettimeofday, @@ -38,4 +38,4 @@ LLVM_LIBC_FUNCTION(int, gettimeofday, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/time/linux/nanosleep.cpp b/libc/src/time/linux/nanosleep.cpp index 8c76dac..bcfe567 100644 --- a/libc/src/time/linux/nanosleep.cpp +++ b/libc/src/time/linux/nanosleep.cpp @@ -15,18 +15,18 @@ #include <stdint.h> // For int64_t. #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, nanosleep, (const struct timespec *req, struct timespec *rem)) { #if SYS_nanosleep - int ret = __llvm_libc::syscall_impl<int>(SYS_nanosleep, req, rem); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_nanosleep, req, rem); #elif defined(SYS_clock_nanosleep_time64) static_assert( sizeof(time_t) == sizeof(int64_t), "SYS_clock_gettime64 requires struct timespec with 64-bit members."); - int ret = __llvm_libc::syscall_impl<int>(SYS_clock_nanosleep_time64, - CLOCK_REALTIME, 0, req, rem); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_clock_nanosleep_time64, + CLOCK_REALTIME, 0, req, rem); #else #error "SYS_nanosleep and SYS_clock_nanosleep_time64 syscalls not available." #endif @@ -38,4 +38,4 @@ LLVM_LIBC_FUNCTION(int, nanosleep, return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/time/linux/time.cpp b/libc/src/time/linux/time.cpp index 4dbcabc..e286fae 100644 --- a/libc/src/time/linux/time.cpp +++ b/libc/src/time/linux/time.cpp @@ -16,7 +16,7 @@ #include <sys/syscall.h> // For syscall numbers. #include <time.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(time_t, time, (time_t * tp)) { // TODO: Use the Linux VDSO to fetch the time and avoid the syscall. @@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(time_t, time, (time_t * tp)) { return time_t(ts.tv_sec); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/time/mktime.cpp b/libc/src/time/mktime.cpp index 3b3ea33..e57565f 100644 --- a/libc/src/time/mktime.cpp +++ b/libc/src/time/mktime.cpp @@ -12,9 +12,9 @@ #include <limits.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -using __llvm_libc::time_utils::TimeConstants; +using LIBC_NAMESPACE::time_utils::TimeConstants; static constexpr int NON_LEAP_YEAR_DAYS_IN_MONTH[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; @@ -114,4 +114,4 @@ LLVM_LIBC_FUNCTION(time_t, mktime, (struct tm * tm_out)) { return static_cast<time_t>(seconds); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/time/mktime.h b/libc/src/time/mktime.h index efe9cf4..a50e97c 100644 --- a/libc/src/time/mktime.h +++ b/libc/src/time/mktime.h @@ -11,10 +11,10 @@ #include <time.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { time_t mktime(struct tm *t1); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TIME_MKTIME_H diff --git a/libc/src/time/nanosleep.h b/libc/src/time/nanosleep.h index d8ecfb7..7573942 100644 --- a/libc/src/time/nanosleep.h +++ b/libc/src/time/nanosleep.h @@ -11,10 +11,10 @@ #include <time.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int nanosleep(const struct timespec *req, struct timespec *rem); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TIME_NANOSLEEP_H diff --git a/libc/src/time/time_func.h b/libc/src/time/time_func.h index a24834c..beb0202 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 fadd26f..199a74c 100644 --- a/libc/src/time/time_utils.cpp +++ b/libc/src/time/time_utils.cpp @@ -11,10 +11,10 @@ #include <limits.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace time_utils { -using __llvm_libc::time_utils::TimeConstants; +using LIBC_NAMESPACE::time_utils::TimeConstants; static int64_t computeRemainingYears(int64_t daysPerYears, int64_t quotientYears, @@ -151,4 +151,4 @@ int64_t update_from_seconds(int64_t total_seconds, struct tm *tm) { } } // namespace time_utils -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/time/time_utils.h b/libc/src/time/time_utils.h index 424e752..a5da3ad 100644 --- a/libc/src/time/time_utils.h +++ b/libc/src/time/time_utils.h @@ -17,7 +17,7 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace time_utils { enum Month : int { @@ -151,6 +151,6 @@ LIBC_INLINE struct tm *gmtime_internal(const time_t *timer, struct tm *result) { } } // namespace time_utils -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TIME_TIME_UTILS_H diff --git a/libc/src/unistd/access.h b/libc/src/unistd/access.h index 2454e80..7623c853 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 228b78f..ca1dd35 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 56fce11..02e01c2 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 21b3582..d6daa5a 100644 --- a/libc/src/unistd/dup.h +++ b/libc/src/unistd/dup.h @@ -11,10 +11,10 @@ #include <unistd.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int dup(int fd); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_DUP_H diff --git a/libc/src/unistd/dup2.h b/libc/src/unistd/dup2.h index 39e4da8..ba8c5f4 100644 --- a/libc/src/unistd/dup2.h +++ b/libc/src/unistd/dup2.h @@ -11,10 +11,10 @@ #include <unistd.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int dup2(int oldfd, int newfd); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_DUP2_H diff --git a/libc/src/unistd/dup3.h b/libc/src/unistd/dup3.h index c7e1070..2b10824 100644 --- a/libc/src/unistd/dup3.h +++ b/libc/src/unistd/dup3.h @@ -11,10 +11,10 @@ #include <unistd.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int dup3(int oldfd, int newfd, int flags); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_DUP3_H diff --git a/libc/src/unistd/environ.cpp b/libc/src/unistd/environ.cpp index 2a554fd..2266c72 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 eb80841..c09a04f 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 f26a583..7ff3664 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 48ac78d..0054a47 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 3d402e6..267785c 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 8d591dd..6b1b72a 100644 --- a/libc/src/unistd/fork.h +++ b/libc/src/unistd/fork.h @@ -11,10 +11,10 @@ #include <unistd.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { pid_t fork(); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_FORK_H diff --git a/libc/src/unistd/fsync.h b/libc/src/unistd/fsync.h index 12e5d74..b5742de 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 1971dc5..5508ef0 100644 --- a/libc/src/unistd/ftruncate.h +++ b/libc/src/unistd/ftruncate.h @@ -11,10 +11,10 @@ #include <unistd.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int ftruncate(int, off_t); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_FTRUNCATE_H diff --git a/libc/src/unistd/getcwd.h b/libc/src/unistd/getcwd.h index 8a6947f..ab7038e 100644 --- a/libc/src/unistd/getcwd.h +++ b/libc/src/unistd/getcwd.h @@ -11,10 +11,10 @@ #include <unistd.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { char *getcwd(char *buf, size_t size); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_GETCWD_H diff --git a/libc/src/unistd/geteuid.h b/libc/src/unistd/geteuid.h index 0df98fb..f19cbae 100644 --- a/libc/src/unistd/geteuid.h +++ b/libc/src/unistd/geteuid.h @@ -11,10 +11,10 @@ #include <unistd.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { uid_t geteuid(); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_GETEUID_H diff --git a/libc/src/unistd/getopt.cpp b/libc/src/unistd/getopt.cpp index d063a43..ccdfdc6 100644 --- a/libc/src/unistd/getopt.cpp +++ b/libc/src/unistd/getopt.cpp @@ -19,7 +19,7 @@ // just the re-ordering of argv elements such that unknown arguments can be // easily iterated over. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { template <typename T> struct RefWrapper { RefWrapper() = delete; @@ -45,8 +45,9 @@ struct GetoptContext { template <typename... Ts> void report_error(const char *fmt, Ts... ts) { if (opterr) - __llvm_libc::fprintf( - errstream ? errstream : reinterpret_cast<FILE *>(__llvm_libc::stderr), + LIBC_NAMESPACE::fprintf( + errstream ? errstream + : reinterpret_cast<FILE *>(LIBC_NAMESPACE::stderr), fmt, ts...); } }; @@ -201,4 +202,4 @@ LLVM_LIBC_FUNCTION(int, getopt, return getopt_r(argc, argv, optstring, impl::ctx); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/getopt.h b/libc/src/unistd/getopt.h index 0bc7ed6..ae27958 100644 --- a/libc/src/unistd/getopt.h +++ b/libc/src/unistd/getopt.h @@ -12,7 +12,7 @@ #include <stdio.h> #include <unistd.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace impl { void set_getopt_state(char **, int *, int *, unsigned *, int *, FILE *); @@ -20,6 +20,6 @@ void set_getopt_state(char **, int *, int *, unsigned *, int *, FILE *); int getopt(int argc, char *const argv[], const char *optstring); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_GETOPT_H diff --git a/libc/src/unistd/getpid.h b/libc/src/unistd/getpid.h index 7b6b9b1..5890dbf 100644 --- a/libc/src/unistd/getpid.h +++ b/libc/src/unistd/getpid.h @@ -11,10 +11,10 @@ #include <unistd.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { pid_t getpid(); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_GETPID_H diff --git a/libc/src/unistd/getppid.h b/libc/src/unistd/getppid.h index c574477..a09c7ca 100644 --- a/libc/src/unistd/getppid.h +++ b/libc/src/unistd/getppid.h @@ -11,10 +11,10 @@ #include <unistd.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { pid_t getppid(); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_GETPPID_H diff --git a/libc/src/unistd/getuid.h b/libc/src/unistd/getuid.h index e3501ca..3516378 100644 --- a/libc/src/unistd/getuid.h +++ b/libc/src/unistd/getuid.h @@ -11,10 +11,10 @@ #include <unistd.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { uid_t getuid(); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_GETUID_H diff --git a/libc/src/unistd/isatty.h b/libc/src/unistd/isatty.h index cffee57..90a1697 100644 --- a/libc/src/unistd/isatty.h +++ b/libc/src/unistd/isatty.h @@ -11,10 +11,10 @@ #include <unistd.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int isatty(int fd); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_ISATTY_H diff --git a/libc/src/unistd/link.h b/libc/src/unistd/link.h index 4922742..a95111f 100644 --- a/libc/src/unistd/link.h +++ b/libc/src/unistd/link.h @@ -11,10 +11,10 @@ #include <unistd.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int link(const char *, const char *); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_LINK_H diff --git a/libc/src/unistd/linkat.h b/libc/src/unistd/linkat.h index 7bc1619..c53b87e 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 195a1c2..f062ad4 100644 --- a/libc/src/unistd/linux/access.cpp +++ b/libc/src/unistd/linux/access.cpp @@ -15,14 +15,14 @@ #include <fcntl.h> #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, access, (const char *path, int mode)) { #ifdef SYS_access - int ret = __llvm_libc::syscall_impl<int>(SYS_access, path, mode); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_access, path, mode); #elif defined(SYS_faccessat) int ret = - __llvm_libc::syscall_impl<int>(SYS_faccessat, AT_FDCWD, path, mode, 0); + LIBC_NAMESPACE::syscall_impl<int>(SYS_faccessat, AT_FDCWD, path, mode, 0); #else #error "access and faccessat syscalls not available." #endif @@ -34,4 +34,4 @@ LLVM_LIBC_FUNCTION(int, access, (const char *path, int mode)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/chdir.cpp b/libc/src/unistd/linux/chdir.cpp index b3078d1e..61d44ff 100644 --- a/libc/src/unistd/linux/chdir.cpp +++ b/libc/src/unistd/linux/chdir.cpp @@ -14,10 +14,10 @@ #include "src/errno/libc_errno.h" #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, chdir, (const char *path)) { - int ret = __llvm_libc::syscall_impl<int>(SYS_chdir, path); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_chdir, path); if (ret < 0) { libc_errno = -ret; return -1; @@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, chdir, (const char *path)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/close.cpp b/libc/src/unistd/linux/close.cpp index 49cac10..0843348 100644 --- a/libc/src/unistd/linux/close.cpp +++ b/libc/src/unistd/linux/close.cpp @@ -14,10 +14,10 @@ #include "src/errno/libc_errno.h" #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, close, (int fd)) { - int ret = __llvm_libc::syscall_impl<int>(SYS_close, fd); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_close, fd); if (ret < 0) { libc_errno = -ret; return -1; @@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, close, (int fd)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/dup.cpp b/libc/src/unistd/linux/dup.cpp index 423d1db..a2e7d3f 100644 --- a/libc/src/unistd/linux/dup.cpp +++ b/libc/src/unistd/linux/dup.cpp @@ -14,10 +14,10 @@ #include "src/errno/libc_errno.h" #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, dup, (int fd)) { - int ret = __llvm_libc::syscall_impl<int>(SYS_dup, fd); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_dup, fd); if (ret < 0) { libc_errno = -ret; return -1; @@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, dup, (int fd)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/dup2.cpp b/libc/src/unistd/linux/dup2.cpp index 4a537fe..f6804e2 100644 --- a/libc/src/unistd/linux/dup2.cpp +++ b/libc/src/unistd/linux/dup2.cpp @@ -15,12 +15,12 @@ #include <fcntl.h> #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, dup2, (int oldfd, int newfd)) { #ifdef SYS_dup2 // If dup2 syscall is available, we make use of directly. - int ret = __llvm_libc::syscall_impl<int>(SYS_dup2, oldfd, newfd); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_dup2, oldfd, newfd); #elif defined(SYS_dup3) // If dup2 syscall is not available, we try using the dup3 syscall. However, // dup3 fails if oldfd is the same as newfd. So, we handle that case @@ -28,11 +28,11 @@ LLVM_LIBC_FUNCTION(int, dup2, (int oldfd, int newfd)) { if (oldfd == newfd) { // Check if oldfd is actually a valid file descriptor. #if SYS_fcntl - int ret = __llvm_libc::syscall_impl<int>(SYS_fcntl, oldfd, F_GETFD); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_fcntl, oldfd, F_GETFD); #elif defined(SYS_fcntl64) // Same as fcntl but can handle large offsets static_assert(sizeof(off_t) == 8); - int ret = __llvm_libc::syscall_impl<int>(SYS_fcntl64, oldfd, F_GETFD); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_fcntl64, oldfd, F_GETFD); #else #error "SYS_fcntl and SYS_fcntl64 syscalls not available." #endif @@ -41,7 +41,7 @@ LLVM_LIBC_FUNCTION(int, dup2, (int oldfd, int newfd)) { libc_errno = -ret; return -1; } - int ret = __llvm_libc::syscall_impl<int>(SYS_dup3, oldfd, newfd, 0); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_dup3, oldfd, newfd, 0); #else #error "dup2 and dup3 syscalls not available." #endif @@ -52,4 +52,4 @@ LLVM_LIBC_FUNCTION(int, dup2, (int oldfd, int newfd)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/dup3.cpp b/libc/src/unistd/linux/dup3.cpp index bb0d18c..bf2c257 100644 --- a/libc/src/unistd/linux/dup3.cpp +++ b/libc/src/unistd/linux/dup3.cpp @@ -14,15 +14,15 @@ #include "src/errno/libc_errno.h" #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, dup3, (int oldfd, int newfd, int flags)) { // If dup2 syscall is available, we make use of directly. - int ret = __llvm_libc::syscall_impl<int>(SYS_dup3, oldfd, newfd, flags); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_dup3, oldfd, newfd, flags); if (ret >= 0) return ret; libc_errno = -ret; return -1; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/execv.cpp b/libc/src/unistd/linux/execv.cpp index c57ee8e..bd134ca 100644 --- a/libc/src/unistd/linux/execv.cpp +++ b/libc/src/unistd/linux/execv.cpp @@ -15,11 +15,11 @@ #include "src/errno/libc_errno.h" #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, execv, (const char *path, char *const argv[])) { - int ret = __llvm_libc::syscall_impl<int>(SYS_execve, path, argv, - __llvm_libc::environ); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_execve, path, argv, + LIBC_NAMESPACE::environ); if (ret < 0) { libc_errno = -ret; return -1; @@ -30,4 +30,4 @@ LLVM_LIBC_FUNCTION(int, execv, (const char *path, char *const argv[])) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/execve.cpp b/libc/src/unistd/linux/execve.cpp index 5eb875d..b6de0a4 100644 --- a/libc/src/unistd/linux/execve.cpp +++ b/libc/src/unistd/linux/execve.cpp @@ -15,11 +15,11 @@ #include "src/errno/libc_errno.h" #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, execve, (const char *path, char *const argv[], char *const envp[])) { - int ret = __llvm_libc::syscall_impl<int>(SYS_execve, path, argv, envp); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_execve, path, argv, envp); if (ret < 0) { libc_errno = -ret; return -1; @@ -30,4 +30,4 @@ LLVM_LIBC_FUNCTION(int, execve, return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/fchdir.cpp b/libc/src/unistd/linux/fchdir.cpp index 4bfca8d..d24b9ba 100644 --- a/libc/src/unistd/linux/fchdir.cpp +++ b/libc/src/unistd/linux/fchdir.cpp @@ -14,10 +14,10 @@ #include "src/errno/libc_errno.h" #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fchdir, (int fd)) { - int ret = __llvm_libc::syscall_impl<int>(SYS_fchdir, fd); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_fchdir, fd); if (ret < 0) { libc_errno = -ret; return -1; @@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, fchdir, (int fd)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/fork.cpp b/libc/src/unistd/linux/fork.cpp index 0cc37e7..6fa2b99 100644 --- a/libc/src/unistd/linux/fork.cpp +++ b/libc/src/unistd/linux/fork.cpp @@ -17,7 +17,7 @@ #include <signal.h> // For SIGCHLD #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // The implementation of fork here is very minimal. We will add more // functionality and standard compliance in future. @@ -25,9 +25,9 @@ namespace __llvm_libc { LLVM_LIBC_FUNCTION(pid_t, fork, (void)) { invoke_prepare_callbacks(); #ifdef SYS_fork - pid_t ret = __llvm_libc::syscall_impl<pid_t>(SYS_fork); + pid_t ret = LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_fork); #elif defined(SYS_clone) - pid_t ret = __llvm_libc::syscall_impl<pid_t>(SYS_clone, SIGCHLD, 0); + pid_t ret = LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_clone, SIGCHLD, 0); #else #error "fork and clone syscalls not available." #endif @@ -36,7 +36,7 @@ LLVM_LIBC_FUNCTION(pid_t, fork, (void)) { // The child is created with a single thread whose self object will be a // copy of parent process' thread which called fork. So, we have to fix up // the child process' self object with the new process' tid. - self.attrib->tid = __llvm_libc::syscall_impl<pid_t>(SYS_gettid); + self.attrib->tid = LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_gettid); invoke_child_callbacks(); return 0; } @@ -51,4 +51,4 @@ LLVM_LIBC_FUNCTION(pid_t, fork, (void)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/fsync.cpp b/libc/src/unistd/linux/fsync.cpp index 199378f..44d504e 100644 --- a/libc/src/unistd/linux/fsync.cpp +++ b/libc/src/unistd/linux/fsync.cpp @@ -14,10 +14,10 @@ #include "src/errno/libc_errno.h" #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fsync, (int fd)) { - int ret = __llvm_libc::syscall_impl<int>(SYS_fsync, fd); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_fsync, fd); if (ret < 0) { libc_errno = -ret; return -1; @@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, fsync, (int fd)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/ftruncate.cpp b/libc/src/unistd/linux/ftruncate.cpp index aebdfb6..795bb98 100644 --- a/libc/src/unistd/linux/ftruncate.cpp +++ b/libc/src/unistd/linux/ftruncate.cpp @@ -16,16 +16,16 @@ #include <sys/syscall.h> // For syscall numbers. #include <unistd.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, ftruncate, (int fd, off_t len)) { #ifdef SYS_ftruncate - int ret = __llvm_libc::syscall_impl<int>(SYS_ftruncate, fd, len); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_ftruncate, fd, len); #elif defined(SYS_ftruncate64) // Same as ftruncate but can handle large offsets static_assert(sizeof(off_t) == 8); - int ret = __llvm_libc::syscall_impl<int>(SYS_ftruncate64, fd, (long)len, - (long)(((uint64_t)(len)) >> 32)); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_ftruncate64, fd, (long)len, + (long)(((uint64_t)(len)) >> 32)); #else #error "ftruncate and ftruncate64 syscalls not available." #endif @@ -37,4 +37,4 @@ LLVM_LIBC_FUNCTION(int, ftruncate, (int fd, off_t len)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/getcwd.cpp b/libc/src/unistd/linux/getcwd.cpp index 3a25ea9..11c58f1 100644 --- a/libc/src/unistd/linux/getcwd.cpp +++ b/libc/src/unistd/linux/getcwd.cpp @@ -17,12 +17,12 @@ #include <stdlib.h> #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace { bool getcwd_syscall(char *buf, size_t size) { - int ret = __llvm_libc::syscall_impl<int>(SYS_getcwd, buf, size); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_getcwd, buf, size); if (ret < 0) { libc_errno = -ret; return false; @@ -63,4 +63,4 @@ LLVM_LIBC_FUNCTION(char *, getcwd, (char *buf, size_t size)) { return buf; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/geteuid.cpp b/libc/src/unistd/linux/geteuid.cpp index ac1d07b..2a7f163 100644 --- a/libc/src/unistd/linux/geteuid.cpp +++ b/libc/src/unistd/linux/geteuid.cpp @@ -13,10 +13,10 @@ #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(uid_t, geteuid, ()) { - return __llvm_libc::syscall_impl<uid_t>(SYS_geteuid); + return LIBC_NAMESPACE::syscall_impl<uid_t>(SYS_geteuid); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/getpid.cpp b/libc/src/unistd/linux/getpid.cpp index ae763d8..8573073 100644 --- a/libc/src/unistd/linux/getpid.cpp +++ b/libc/src/unistd/linux/getpid.cpp @@ -13,10 +13,10 @@ #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(pid_t, getpid, ()) { - return __llvm_libc::syscall_impl<pid_t>(SYS_getpid); + return LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_getpid); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/getppid.cpp b/libc/src/unistd/linux/getppid.cpp index e722c36..7ee11f3 100644 --- a/libc/src/unistd/linux/getppid.cpp +++ b/libc/src/unistd/linux/getppid.cpp @@ -13,10 +13,10 @@ #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(pid_t, getppid, ()) { - return __llvm_libc::syscall_impl<pid_t>(SYS_getppid); + return LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_getppid); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/getuid.cpp b/libc/src/unistd/linux/getuid.cpp index f214ffd..c813180 100644 --- a/libc/src/unistd/linux/getuid.cpp +++ b/libc/src/unistd/linux/getuid.cpp @@ -13,10 +13,10 @@ #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(uid_t, getuid, ()) { - return __llvm_libc::syscall_impl<uid_t>(SYS_getuid); + return LIBC_NAMESPACE::syscall_impl<uid_t>(SYS_getuid); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/isatty.cpp b/libc/src/unistd/linux/isatty.cpp index d81ae5aa..2050138 100644 --- a/libc/src/unistd/linux/isatty.cpp +++ b/libc/src/unistd/linux/isatty.cpp @@ -15,7 +15,7 @@ #include <sys/ioctl.h> // For ioctl numbers. #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, isatty, (int fd)) { constexpr int INIT_VAL = 0x1234abcd; @@ -23,7 +23,7 @@ LLVM_LIBC_FUNCTION(int, isatty, (int fd)) { // This gets the line dicipline of the terminal. When called on something that // isn't a terminal it doesn't change line_d_val and returns -1. int result = - __llvm_libc::syscall_impl<int>(SYS_ioctl, fd, TIOCGETD, &line_d_val); + LIBC_NAMESPACE::syscall_impl<int>(SYS_ioctl, fd, TIOCGETD, &line_d_val); if (result == 0) return 1; @@ -31,4 +31,4 @@ LLVM_LIBC_FUNCTION(int, isatty, (int fd)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/link.cpp b/libc/src/unistd/linux/link.cpp index 385756b..b5024ad 100644 --- a/libc/src/unistd/linux/link.cpp +++ b/libc/src/unistd/linux/link.cpp @@ -15,14 +15,14 @@ #include <fcntl.h> #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, link, (const char *path1, const char *path2)) { #ifdef SYS_link - int ret = __llvm_libc::syscall_impl<int>(SYS_link, path1, path2); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_link, path1, path2); #elif defined(SYS_linkat) - int ret = __llvm_libc::syscall_impl<int>(SYS_linkat, AT_FDCWD, path1, - AT_FDCWD, path2, 0); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_linkat, AT_FDCWD, path1, + AT_FDCWD, path2, 0); #else #error "link or linkat syscalls not available." #endif @@ -33,4 +33,4 @@ LLVM_LIBC_FUNCTION(int, link, (const char *path1, const char *path2)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/linkat.cpp b/libc/src/unistd/linux/linkat.cpp index ec1c2b4..c5d071e 100644 --- a/libc/src/unistd/linux/linkat.cpp +++ b/libc/src/unistd/linux/linkat.cpp @@ -15,13 +15,13 @@ #include <fcntl.h> #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, linkat, (int fd1, const char *path1, int fd2, const char *path2, int flags)) { - int ret = - __llvm_libc::syscall_impl<int>(SYS_linkat, fd1, path1, fd2, path2, flags); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_linkat, fd1, path1, fd2, + path2, flags); if (ret < 0) { libc_errno = -ret; return -1; @@ -29,4 +29,4 @@ LLVM_LIBC_FUNCTION(int, linkat, return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/lseek.cpp b/libc/src/unistd/linux/lseek.cpp index 3ab0084..6f3d993 100644 --- a/libc/src/unistd/linux/lseek.cpp +++ b/libc/src/unistd/linux/lseek.cpp @@ -16,7 +16,7 @@ #include <sys/syscall.h> // For syscall numbers. #include <unistd.h> // For off_t. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(off_t, lseek, (int fd, off_t offset, int whence)) { auto result = internal::lseekimpl(fd, offset, whence); @@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(off_t, lseek, (int fd, off_t offset, int whence)) { return result.value(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/pread.cpp b/libc/src/unistd/linux/pread.cpp index 8605925..614de97 100644 --- a/libc/src/unistd/linux/pread.cpp +++ b/libc/src/unistd/linux/pread.cpp @@ -15,18 +15,18 @@ #include <stdint.h> // For uint64_t. #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(ssize_t, pread, (int fd, void *buf, size_t count, off_t offset)) { #ifdef LIBC_TARGET_ARCH_IS_RISCV32 static_assert(sizeof(off_t) == 8); - ssize_t ret = __llvm_libc::syscall_impl<ssize_t>( + ssize_t ret = LIBC_NAMESPACE::syscall_impl<ssize_t>( SYS_pread64, fd, buf, count, (long)offset, (long)(((uint64_t)(offset)) >> 32)); #else - ssize_t ret = - __llvm_libc::syscall_impl<ssize_t>(SYS_pread64, fd, buf, count, offset); + ssize_t ret = LIBC_NAMESPACE::syscall_impl<ssize_t>(SYS_pread64, fd, buf, + count, offset); #endif if (ret < 0) { libc_errno = static_cast<int>(-ret); @@ -35,4 +35,4 @@ LLVM_LIBC_FUNCTION(ssize_t, pread, return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/pwrite.cpp b/libc/src/unistd/linux/pwrite.cpp index b4ea52a..6c6a0b5 100644 --- a/libc/src/unistd/linux/pwrite.cpp +++ b/libc/src/unistd/linux/pwrite.cpp @@ -15,18 +15,18 @@ #include <stdint.h> // For uint64_t. #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(ssize_t, pwrite, (int fd, const void *buf, size_t count, off_t offset)) { #ifdef LIBC_TARGET_ARCH_IS_RISCV32 static_assert(sizeof(off_t) == 8); - ssize_t ret = __llvm_libc::syscall_impl<ssize_t>( + ssize_t ret = LIBC_NAMESPACE::syscall_impl<ssize_t>( SYS_pwrite64, fd, buf, count, (long)offset, (long)(((uint64_t)(offset)) >> 32)); #else - ssize_t ret = - __llvm_libc::syscall_impl<ssize_t>(SYS_pwrite64, fd, buf, count, offset); + ssize_t ret = LIBC_NAMESPACE::syscall_impl<ssize_t>(SYS_pwrite64, fd, buf, + count, offset); #endif if (ret < 0) { libc_errno = static_cast<int>(-ret); @@ -35,4 +35,4 @@ LLVM_LIBC_FUNCTION(ssize_t, pwrite, return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/read.cpp b/libc/src/unistd/linux/read.cpp index 6dbff2d..691a236 100644 --- a/libc/src/unistd/linux/read.cpp +++ b/libc/src/unistd/linux/read.cpp @@ -14,10 +14,10 @@ #include "src/errno/libc_errno.h" #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(ssize_t, read, (int fd, void *buf, size_t count)) { - ssize_t ret = __llvm_libc::syscall_impl<ssize_t>(SYS_read, fd, buf, count); + ssize_t ret = LIBC_NAMESPACE::syscall_impl<ssize_t>(SYS_read, fd, buf, count); if (ret < 0) { libc_errno = static_cast<int>(-ret); return -1; @@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(ssize_t, read, (int fd, void *buf, size_t count)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/readlink.cpp b/libc/src/unistd/linux/readlink.cpp index 7989b11..8dee58c 100644 --- a/libc/src/unistd/linux/readlink.cpp +++ b/libc/src/unistd/linux/readlink.cpp @@ -15,17 +15,17 @@ #include <fcntl.h> #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(ssize_t, readlink, (const char *__restrict path, char *__restrict buf, size_t bufsize)) { #ifdef SYS_readlink ssize_t ret = - __llvm_libc::syscall_impl<ssize_t>(SYS_readlink, path, buf, bufsize); + LIBC_NAMESPACE::syscall_impl<ssize_t>(SYS_readlink, path, buf, bufsize); #elif defined(SYS_readlinkat) - ssize_t ret = __llvm_libc::syscall_impl<ssize_t>(SYS_readlinkat, AT_FDCWD, - path, buf, bufsize); + ssize_t ret = LIBC_NAMESPACE::syscall_impl<ssize_t>(SYS_readlinkat, AT_FDCWD, + path, buf, bufsize); #else #error "readlink or readlinkat syscalls not available." #endif @@ -36,4 +36,4 @@ LLVM_LIBC_FUNCTION(ssize_t, readlink, return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/readlinkat.cpp b/libc/src/unistd/linux/readlinkat.cpp index 094853f..479735d 100644 --- a/libc/src/unistd/linux/readlinkat.cpp +++ b/libc/src/unistd/linux/readlinkat.cpp @@ -15,13 +15,13 @@ #include <fcntl.h> #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(ssize_t, readlinkat, (int fd, const char *__restrict path, char *__restrict buf, size_t bufsize)) { - ssize_t ret = __llvm_libc::syscall_impl<ssize_t>(SYS_readlinkat, fd, path, - buf, bufsize); + ssize_t ret = LIBC_NAMESPACE::syscall_impl<ssize_t>(SYS_readlinkat, fd, path, + buf, bufsize); if (ret < 0) { libc_errno = static_cast<int>(-ret); return -1; @@ -29,4 +29,4 @@ LLVM_LIBC_FUNCTION(ssize_t, readlinkat, return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/rmdir.cpp b/libc/src/unistd/linux/rmdir.cpp index 70f7206..234b0c3 100644 --- a/libc/src/unistd/linux/rmdir.cpp +++ b/libc/src/unistd/linux/rmdir.cpp @@ -15,14 +15,14 @@ #include <fcntl.h> #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, rmdir, (const char *path)) { #ifdef SYS_rmdir - int ret = __llvm_libc::syscall_impl<int>(SYS_rmdir, path); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_rmdir, path); #elif defined(SYS_unlinkat) - int ret = __llvm_libc::syscall_impl<int>(SYS_unlinkat, AT_FDCWD, path, - AT_REMOVEDIR); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_unlinkat, AT_FDCWD, path, + AT_REMOVEDIR); #else #error "rmdir and unlinkat syscalls not available." #endif @@ -34,4 +34,4 @@ LLVM_LIBC_FUNCTION(int, rmdir, (const char *path)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/symlink.cpp b/libc/src/unistd/linux/symlink.cpp index a9b7de8..e8983e2 100644 --- a/libc/src/unistd/linux/symlink.cpp +++ b/libc/src/unistd/linux/symlink.cpp @@ -15,14 +15,14 @@ #include <fcntl.h> #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, symlink, (const char *path1, const char *path2)) { #ifdef SYS_symlink - int ret = __llvm_libc::syscall_impl<int>(SYS_symlink, path1, path2); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_symlink, path1, path2); #elif defined(SYS_symlinkat) int ret = - __llvm_libc::syscall_impl<int>(SYS_symlinkat, path1, AT_FDCWD, path2); + LIBC_NAMESPACE::syscall_impl<int>(SYS_symlinkat, path1, AT_FDCWD, path2); #else #error "symlink or symlinkat syscalls not available." #endif @@ -33,4 +33,4 @@ LLVM_LIBC_FUNCTION(int, symlink, (const char *path1, const char *path2)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/symlinkat.cpp b/libc/src/unistd/linux/symlinkat.cpp index f5debb8..64f02d1 100644 --- a/libc/src/unistd/linux/symlinkat.cpp +++ b/libc/src/unistd/linux/symlinkat.cpp @@ -15,11 +15,11 @@ #include <fcntl.h> #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, symlinkat, (const char *path1, int fd, const char *path2)) { - int ret = __llvm_libc::syscall_impl<int>(SYS_symlinkat, path1, fd, path2); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_symlinkat, path1, fd, path2); if (ret < 0) { libc_errno = -ret; return -1; @@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(int, symlinkat, return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/syscall.cpp b/libc/src/unistd/linux/syscall.cpp index 5c61c6d..e1b13c9 100644 --- a/libc/src/unistd/linux/syscall.cpp +++ b/libc/src/unistd/linux/syscall.cpp @@ -14,13 +14,13 @@ #include "src/errno/libc_errno.h" #include <stdarg.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -LLVM_LIBC_FUNCTION(long, __llvm_libc_syscall, +LLVM_LIBC_FUNCTION(long, LIBC_NAMESPACE_syscall, (long number, long arg1, long arg2, long arg3, long arg4, long arg5, long arg6)) { - long ret = __llvm_libc::syscall_impl<long>(number, arg1, arg2, arg3, arg4, - arg5, arg6); + long ret = LIBC_NAMESPACE::syscall_impl<long>(number, arg1, arg2, arg3, arg4, + arg5, arg6); // Syscalls may return large positive values that overflow, but will never // return values between -4096 and -1 if (static_cast<unsigned long>(ret) > -4096UL) { @@ -30,4 +30,4 @@ LLVM_LIBC_FUNCTION(long, __llvm_libc_syscall, return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/sysconf.cpp b/libc/src/unistd/linux/sysconf.cpp index 2816cb4..b16e155 100644 --- a/libc/src/unistd/linux/sysconf.cpp +++ b/libc/src/unistd/linux/sysconf.cpp @@ -14,7 +14,7 @@ #include <linux/param.h> // For EXEC_PAGESIZE. #include <unistd.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(long, sysconf, (int name)) { long ret = 0; @@ -30,4 +30,4 @@ LLVM_LIBC_FUNCTION(long, sysconf, (int name)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/truncate.cpp b/libc/src/unistd/linux/truncate.cpp index 7be355e..0120cc7 100644 --- a/libc/src/unistd/linux/truncate.cpp +++ b/libc/src/unistd/linux/truncate.cpp @@ -16,16 +16,16 @@ #include <sys/syscall.h> // For syscall numbers. #include <unistd.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, truncate, (const char *path, off_t len)) { #ifdef SYS_truncate - int ret = __llvm_libc::syscall_impl<int>(SYS_truncate, path, len); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_truncate, path, len); #elif defined(SYS_truncate64) // Same as truncate but can handle large offsets static_assert(sizeof(off_t) == 8); - int ret = __llvm_libc::syscall_impl<int>(SYS_truncate64, path, (long)len, - (long)(((uint64_t)(len)) >> 32)); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_truncate64, path, (long)len, + (long)(((uint64_t)(len)) >> 32)); #else #error "truncate and truncate64 syscalls not available." #endif @@ -36,4 +36,4 @@ LLVM_LIBC_FUNCTION(int, truncate, (const char *path, off_t len)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/unlink.cpp b/libc/src/unistd/linux/unlink.cpp index d4bbdea..e62fb8f 100644 --- a/libc/src/unistd/linux/unlink.cpp +++ b/libc/src/unistd/linux/unlink.cpp @@ -15,13 +15,13 @@ #include <fcntl.h> #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, unlink, (const char *path)) { #ifdef SYS_unlink - int ret = __llvm_libc::syscall_impl<int>(SYS_unlink, path); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_unlink, path); #elif defined(SYS_unlinkat) - int ret = __llvm_libc::syscall_impl<int>(SYS_unlinkat, AT_FDCWD, path, 0); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_unlinkat, AT_FDCWD, path, 0); #else #error "unlink and unlinkat syscalls not available." #endif @@ -33,4 +33,4 @@ LLVM_LIBC_FUNCTION(int, unlink, (const char *path)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/unlinkat.cpp b/libc/src/unistd/linux/unlinkat.cpp index eb4af39..4ec5e38 100644 --- a/libc/src/unistd/linux/unlinkat.cpp +++ b/libc/src/unistd/linux/unlinkat.cpp @@ -15,11 +15,11 @@ #include <fcntl.h> #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, unlinkat, (int dfd, const char *path, int flags)) { #ifdef SYS_unlinkat - int ret = __llvm_libc::syscall_impl<int>(SYS_unlinkat, dfd, path, flags); + int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_unlinkat, dfd, path, flags); #else #error "unlinkat syscalls not available." #endif @@ -31,4 +31,4 @@ LLVM_LIBC_FUNCTION(int, unlinkat, (int dfd, const char *path, int flags)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/write.cpp b/libc/src/unistd/linux/write.cpp index 4884ccf..bd6c911 100644 --- a/libc/src/unistd/linux/write.cpp +++ b/libc/src/unistd/linux/write.cpp @@ -14,10 +14,11 @@ #include <sys/syscall.h> // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(ssize_t, write, (int fd, const void *buf, size_t count)) { - ssize_t ret = __llvm_libc::syscall_impl<ssize_t>(SYS_write, fd, buf, count); + ssize_t ret = + LIBC_NAMESPACE::syscall_impl<ssize_t>(SYS_write, fd, buf, count); if (ret < 0) { libc_errno = static_cast<int>(-ret); return -1; @@ -25,4 +26,4 @@ LLVM_LIBC_FUNCTION(ssize_t, write, (int fd, const void *buf, size_t count)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/lseek.h b/libc/src/unistd/lseek.h index 28252e4..75e33d8 100644 --- a/libc/src/unistd/lseek.h +++ b/libc/src/unistd/lseek.h @@ -11,10 +11,10 @@ #include <unistd.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { off_t lseek(int fd, off_t offset, int whence); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_LSEEK_H diff --git a/libc/src/unistd/pread.h b/libc/src/unistd/pread.h index 5ddf32e..6ecfef4 100644 --- a/libc/src/unistd/pread.h +++ b/libc/src/unistd/pread.h @@ -11,10 +11,10 @@ #include <unistd.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { ssize_t pread(int fd, void *buf, size_t count, off_t offset); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_PREAD_H diff --git a/libc/src/unistd/pwrite.h b/libc/src/unistd/pwrite.h index 4286314..535c921 100644 --- a/libc/src/unistd/pwrite.h +++ b/libc/src/unistd/pwrite.h @@ -11,10 +11,10 @@ #include <unistd.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_PWRITE_H diff --git a/libc/src/unistd/read.h b/libc/src/unistd/read.h index 62602c8..05a56a2 100644 --- a/libc/src/unistd/read.h +++ b/libc/src/unistd/read.h @@ -11,10 +11,10 @@ #include <unistd.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { ssize_t read(int fd, void *buf, size_t count); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_READ_H diff --git a/libc/src/unistd/readlink.h b/libc/src/unistd/readlink.h index ba246bf9..c93c430 100644 --- a/libc/src/unistd/readlink.h +++ b/libc/src/unistd/readlink.h @@ -11,10 +11,10 @@ #include <unistd.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { ssize_t readlink(const char *__restrict, char *__restrict, size_t); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_READLINK_H diff --git a/libc/src/unistd/readlinkat.h b/libc/src/unistd/readlinkat.h index 54346ee..a4357ef 100644 --- a/libc/src/unistd/readlinkat.h +++ b/libc/src/unistd/readlinkat.h @@ -11,10 +11,10 @@ #include <unistd.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { ssize_t readlinkat(int, const char *__restrict, char *__restrict, size_t); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_READLINKAT_H diff --git a/libc/src/unistd/rmdir.h b/libc/src/unistd/rmdir.h index 5fe7fac..55dcbaf 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 44166a6..5c2f5074f 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 e5e02e1..0a6aa49 100644 --- a/libc/src/unistd/swab.h +++ b/libc/src/unistd/swab.h @@ -11,10 +11,10 @@ #include <unistd.h> // For ssize_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void swab(const void *__restrict from, void *__restrict to, ssize_t n); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_SWAB_H diff --git a/libc/src/unistd/symlink.h b/libc/src/unistd/symlink.h index a495db8..0a0124c 100644 --- a/libc/src/unistd/symlink.h +++ b/libc/src/unistd/symlink.h @@ -11,10 +11,10 @@ #include <unistd.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int symlink(const char *, const char *); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_SYMLINK_H diff --git a/libc/src/unistd/symlinkat.h b/libc/src/unistd/symlinkat.h index ff77f0a..ecca438 100644 --- a/libc/src/unistd/symlinkat.h +++ b/libc/src/unistd/symlinkat.h @@ -11,10 +11,10 @@ #include <unistd.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int symlinkat(const char *, int, const char *); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_SYMLINKAT_H diff --git a/libc/src/unistd/syscall.h b/libc/src/unistd/syscall.h index 81ff64e..255459c 100644 --- a/libc/src/unistd/syscall.h +++ b/libc/src/unistd/syscall.h @@ -12,11 +12,11 @@ #include <stdarg.h> #include <unistd.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -long __llvm_libc_syscall(long number, long arg1, long arg2, long arg3, - long arg4, long arg5, long arg6); +long LIBC_NAMESPACE_syscall(long number, long arg1, long arg2, long arg3, + long arg4, long arg5, long arg6); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_SYSCALL_H diff --git a/libc/src/unistd/sysconf.h b/libc/src/unistd/sysconf.h index b704edb..89c5efa 100644 --- a/libc/src/unistd/sysconf.h +++ b/libc/src/unistd/sysconf.h @@ -11,10 +11,10 @@ #include <unistd.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { long sysconf(int name); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_SYSCONF_H diff --git a/libc/src/unistd/truncate.h b/libc/src/unistd/truncate.h index a6ef921..5245b6b 100644 --- a/libc/src/unistd/truncate.h +++ b/libc/src/unistd/truncate.h @@ -11,10 +11,10 @@ #include <unistd.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int truncate(const char *, off_t); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_TRUNCATE_H diff --git a/libc/src/unistd/unlink.h b/libc/src/unistd/unlink.h index 1119bfa..d1d34fa 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 b32d7b5..81d23bd 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 821dc49..52cdff3 100644 --- a/libc/src/unistd/write.h +++ b/libc/src/unistd/write.h @@ -11,10 +11,10 @@ #include <unistd.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { ssize_t write(int fd, const void *buf, size_t count); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_WRITE_H diff --git a/libc/src/wchar/btowc.cpp b/libc/src/wchar/btowc.cpp index 6db888c..040c60e 100644 --- a/libc/src/wchar/btowc.cpp +++ b/libc/src/wchar/btowc.cpp @@ -12,7 +12,7 @@ #include <stdio.h> // for EOF. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, btowc, (wint_t c)) { auto result = internal::btowc(c); @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, btowc, (wint_t c)) { } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/wchar/btowc.h b/libc/src/wchar/btowc.h index ab37738..de67f15 100644 --- a/libc/src/wchar/btowc.h +++ b/libc/src/wchar/btowc.h @@ -11,10 +11,10 @@ #include <wchar.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { wint_t btowc(int c); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_WCHAR_BTOWC_H diff --git a/libc/src/wchar/wctob.cpp b/libc/src/wchar/wctob.cpp index 274818a..538d538 100644 --- a/libc/src/wchar/wctob.cpp +++ b/libc/src/wchar/wctob.cpp @@ -12,7 +12,7 @@ #include <stdio.h> // for EOF. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, wctob, (wint_t c)) { auto result = internal::wctob(c); @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, wctob, (wint_t c)) { } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/wchar/wctob.h b/libc/src/wchar/wctob.h index 5c0f229..1cc0c21 100644 --- a/libc/src/wchar/wctob.h +++ b/libc/src/wchar/wctob.h @@ -11,10 +11,10 @@ #include <wchar.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int wctob(wint_t c); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_WCHAR_WCTOB_H diff --git a/libc/startup/gpu/amdgpu/start.cpp b/libc/startup/gpu/amdgpu/start.cpp index e6304ab..9e642db 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<FiniCallback *>(__fini_array_start[i])(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE extern "C" [[gnu::visibility("protected"), clang::amdgpu_kernel]] void _begin(int argc, char **argv, char **env) { @@ -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 d5d3ad2..1ff187a 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<FiniCallback *>(__fini_array_start[i])(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE extern "C" [[gnu::visibility("protected"), clang::nvptx_kernel]] void _begin(int argc, char **argv, char **env) { @@ -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 7b94ae6..002af53 100644 --- a/libc/startup/linux/aarch64/start.cpp +++ b/libc/startup/linux/aarch64/start.cpp @@ -27,7 +27,7 @@ extern "C" int main(int, char **, char **); // Source documentation: // https://github.com/ARM-software/abi-aa/tree/main/sysvabi64 -namespace __llvm_libc { +namespace LIBC_NAMESPACE { #ifdef SYS_mmap2 static constexpr long MMAP_SYSCALL_NUMBER = SYS_mmap2; @@ -69,18 +69,18 @@ void init_tls(TLSDescriptor &tls_descriptor) { // We cannot call the mmap function here as the functions set errno on // failure. Since errno is implemented via a thread local variable, we cannot // use errno before TLS is setup. - long mmap_ret_val = __llvm_libc::syscall_impl<long>( + long mmap_ret_val = LIBC_NAMESPACE::syscall_impl<long>( MMAP_SYSCALL_NUMBER, nullptr, alloc_size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); // We cannot check the return value with MAP_FAILED as that is the return // of the mmap function and not the mmap syscall. if (mmap_ret_val < 0 && static_cast<uintptr_t>(mmap_ret_val) > -app.pageSize) - __llvm_libc::syscall_impl<long>(SYS_exit, 1); + LIBC_NAMESPACE::syscall_impl<long>(SYS_exit, 1); uintptr_t thread_ptr = uintptr_t(reinterpret_cast<uintptr_t *>(mmap_ret_val)); uintptr_t tls_addr = thread_ptr + size_of_pointers + padding; - __llvm_libc::inline_memcpy(reinterpret_cast<char *>(tls_addr), - reinterpret_cast<const char *>(app.tls.address), - app.tls.init_size); + LIBC_NAMESPACE::inline_memcpy(reinterpret_cast<char *>(tls_addr), + reinterpret_cast<const char *>(app.tls.address), + app.tls.init_size); tls_descriptor.size = alloc_size; tls_descriptor.addr = thread_ptr; tls_descriptor.tp = thread_ptr; @@ -89,7 +89,7 @@ void init_tls(TLSDescriptor &tls_descriptor) { void cleanup_tls(uintptr_t addr, uintptr_t size) { if (size == 0) return; - __llvm_libc::syscall_impl<long>(SYS_munmap, addr, size); + LIBC_NAMESPACE::syscall_impl<long>(SYS_munmap, addr, size); } static void set_thread_ptr(uintptr_t val) { __arm_wsr64("tpidr_el0", val); } @@ -123,9 +123,9 @@ static void call_fini_array_callbacks() { reinterpret_cast<FiniCallback *>(__fini_array_start[i - 1])(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE -using __llvm_libc::app; +using LIBC_NAMESPACE::app; // TODO: Would be nice to use the aux entry structure from elf.h when available. struct AuxEntry { @@ -134,10 +134,10 @@ struct AuxEntry { }; __attribute__((noinline)) static void do_start() { - auto tid = __llvm_libc::syscall_impl<long>(SYS_gettid); + auto tid = LIBC_NAMESPACE::syscall_impl<long>(SYS_gettid); if (tid <= 0) - __llvm_libc::syscall_impl<long>(SYS_exit, 1); - __llvm_libc::main_thread_attrib.tid = static_cast<int>(tid); + LIBC_NAMESPACE::syscall_impl<long>(SYS_exit, 1); + LIBC_NAMESPACE::main_thread_attrib.tid = static_cast<int>(tid); // After the argv array, is a 8-byte long NULL value before the array of env // values. The end of the env values is marked by another 8-byte long NULL @@ -184,22 +184,22 @@ __attribute__((noinline)) static void do_start() { app.tls.align = phdr->p_align; } - __llvm_libc::TLSDescriptor tls; - __llvm_libc::init_tls(tls); + LIBC_NAMESPACE::TLSDescriptor tls; + LIBC_NAMESPACE::init_tls(tls); if (tls.size != 0) - __llvm_libc::set_thread_ptr(tls.tp); + LIBC_NAMESPACE::set_thread_ptr(tls.tp); - __llvm_libc::self.attrib = &__llvm_libc::main_thread_attrib; - __llvm_libc::main_thread_attrib.atexit_callback_mgr = - __llvm_libc::internal::get_thread_atexit_callback_mgr(); + LIBC_NAMESPACE::self.attrib = &LIBC_NAMESPACE::main_thread_attrib; + LIBC_NAMESPACE::main_thread_attrib.atexit_callback_mgr = + LIBC_NAMESPACE::internal::get_thread_atexit_callback_mgr(); // We want the fini array callbacks to be run after other atexit // callbacks are run. So, we register them before running the init // array callbacks as they can potentially register their own atexit // callbacks. - __llvm_libc::atexit(&__llvm_libc::call_fini_array_callbacks); + LIBC_NAMESPACE::atexit(&LIBC_NAMESPACE::call_fini_array_callbacks); - __llvm_libc::call_init_array_callbacks( + LIBC_NAMESPACE::call_init_array_callbacks( static_cast<int>(app.args->argc), reinterpret_cast<char **>(app.args->argv), reinterpret_cast<char **>(env_ptr)); @@ -211,8 +211,8 @@ __attribute__((noinline)) static void do_start() { // TODO: TLS cleanup should be done after all other atexit callbacks // are run. So, register a cleanup callback for it with atexit before // everything else. - __llvm_libc::cleanup_tls(tls.addr, tls.size); - __llvm_libc::exit(retval); + LIBC_NAMESPACE::cleanup_tls(tls.addr, tls.size); + LIBC_NAMESPACE::exit(retval); } extern "C" void _start() { @@ -226,7 +226,7 @@ extern "C" void _start() { // will take us to the previous stack pointer. That is the reason why the // actual business logic of the startup code is pushed into a non-inline // function do_start so that this function is free of any stack usage. - app.args = reinterpret_cast<__llvm_libc::Args *>( + app.args = reinterpret_cast<LIBC_NAMESPACE::Args *>( reinterpret_cast<uintptr_t *>(__builtin_frame_address(0)) + 2); do_start(); } diff --git a/libc/startup/linux/riscv64/start.cpp b/libc/startup/linux/riscv64/start.cpp index 1bf05b9..ed976d2 100644 --- a/libc/startup/linux/riscv64/start.cpp +++ b/libc/startup/linux/riscv64/start.cpp @@ -22,7 +22,7 @@ extern "C" int main(int, char **, char **); -namespace __llvm_libc { +namespace LIBC_NAMESPACE { #ifdef SYS_mmap2 static constexpr long MMAP_SYSCALL_NUMBER = SYS_mmap2; @@ -56,18 +56,18 @@ void init_tls(TLSDescriptor &tls_descriptor) { // We cannot call the mmap function here as the functions set errno on // failure. Since errno is implemented via a thread local variable, we cannot // use errno before TLS is setup. - long mmap_ret_val = __llvm_libc::syscall_impl<long>( + long mmap_ret_val = LIBC_NAMESPACE::syscall_impl<long>( MMAP_SYSCALL_NUMBER, nullptr, alloc_size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); // We cannot check the return value with MAP_FAILED as that is the return // of the mmap function and not the mmap syscall. if (mmap_ret_val < 0 && static_cast<uintptr_t>(mmap_ret_val) > -app.pageSize) - __llvm_libc::syscall_impl<long>(SYS_exit, 1); + LIBC_NAMESPACE::syscall_impl<long>(SYS_exit, 1); uintptr_t thread_ptr = uintptr_t(reinterpret_cast<uintptr_t *>(mmap_ret_val)); uintptr_t tls_addr = thread_ptr + size_of_pointers + padding; - __llvm_libc::inline_memcpy(reinterpret_cast<char *>(tls_addr), - reinterpret_cast<const char *>(app.tls.address), - app.tls.init_size); + LIBC_NAMESPACE::inline_memcpy(reinterpret_cast<char *>(tls_addr), + reinterpret_cast<const char *>(app.tls.address), + app.tls.init_size); tls_descriptor.size = alloc_size; tls_descriptor.addr = thread_ptr; tls_descriptor.tp = tls_addr; @@ -76,7 +76,7 @@ void init_tls(TLSDescriptor &tls_descriptor) { void cleanup_tls(uintptr_t addr, uintptr_t size) { if (size == 0) return; - __llvm_libc::syscall_impl<long>(SYS_munmap, addr, size); + LIBC_NAMESPACE::syscall_impl<long>(SYS_munmap, addr, size); } static void set_thread_ptr(uintptr_t val) { @@ -112,14 +112,14 @@ static void call_fini_array_callbacks() { reinterpret_cast<FiniCallback *>(__fini_array_start[i - 1])(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE -using __llvm_libc::app; +using LIBC_NAMESPACE::app; // TODO: Would be nice to use the aux entry structure from elf.h when available. struct AuxEntry { - __llvm_libc::AuxEntryType type; - __llvm_libc::AuxEntryType value; + LIBC_NAMESPACE::AuxEntryType type; + LIBC_NAMESPACE::AuxEntryType value; }; #if defined(LIBC_TARGET_ARCH_IS_X86_64) || \ @@ -137,16 +137,16 @@ __attribute__((noinline)) static void do_start() { ".option norelax\n\t" "lla gp, __global_pointer$\n\t" ".option pop\n\t"); - auto tid = __llvm_libc::syscall_impl<long>(SYS_gettid); + auto tid = LIBC_NAMESPACE::syscall_impl<long>(SYS_gettid); if (tid <= 0) - __llvm_libc::syscall_impl<long>(SYS_exit, 1); - __llvm_libc::main_thread_attrib.tid = static_cast<int>(tid); + LIBC_NAMESPACE::syscall_impl<long>(SYS_exit, 1); + LIBC_NAMESPACE::main_thread_attrib.tid = static_cast<int>(tid); // After the argv array, is a 8-byte long NULL value before the array of env // values. The end of the env values is marked by another 8-byte long NULL // value. We step over it (the "+ 1" below) to get to the env values. - __llvm_libc::ArgVEntryType *env_ptr = app.args->argv + app.args->argc + 1; - __llvm_libc::ArgVEntryType *env_end_marker = env_ptr; + LIBC_NAMESPACE::ArgVEntryType *env_ptr = app.args->argv + app.args->argc + 1; + LIBC_NAMESPACE::ArgVEntryType *env_end_marker = env_ptr; app.envPtr = env_ptr; while (*env_end_marker) ++env_end_marker; @@ -187,22 +187,22 @@ __attribute__((noinline)) static void do_start() { app.tls.align = phdr->p_align; } - __llvm_libc::TLSDescriptor tls; - __llvm_libc::init_tls(tls); + LIBC_NAMESPACE::TLSDescriptor tls; + LIBC_NAMESPACE::init_tls(tls); if (tls.size != 0) - __llvm_libc::set_thread_ptr(tls.tp); + LIBC_NAMESPACE::set_thread_ptr(tls.tp); - __llvm_libc::self.attrib = &__llvm_libc::main_thread_attrib; - __llvm_libc::main_thread_attrib.atexit_callback_mgr = - __llvm_libc::internal::get_thread_atexit_callback_mgr(); + LIBC_NAMESPACE::self.attrib = &LIBC_NAMESPACE::main_thread_attrib; + LIBC_NAMESPACE::main_thread_attrib.atexit_callback_mgr = + LIBC_NAMESPACE::internal::get_thread_atexit_callback_mgr(); // We want the fini array callbacks to be run after other atexit // callbacks are run. So, we register them before running the init // array callbacks as they can potentially register their own atexit // callbacks. - __llvm_libc::atexit(&__llvm_libc::call_fini_array_callbacks); + LIBC_NAMESPACE::atexit(&LIBC_NAMESPACE::call_fini_array_callbacks); - __llvm_libc::call_init_array_callbacks( + LIBC_NAMESPACE::call_init_array_callbacks( static_cast<int>(app.args->argc), reinterpret_cast<char **>(app.args->argv), reinterpret_cast<char **>(env_ptr)); @@ -214,13 +214,13 @@ __attribute__((noinline)) static void do_start() { // TODO: TLS cleanup should be done after all other atexit callbacks // are run. So, register a cleanup callback for it with atexit before // everything else. - __llvm_libc::cleanup_tls(tls.addr, tls.size); - __llvm_libc::exit(retval); + LIBC_NAMESPACE::cleanup_tls(tls.addr, tls.size); + LIBC_NAMESPACE::exit(retval); } extern "C" void _start() { // Fetch the args using the frame pointer. - app.args = reinterpret_cast<__llvm_libc::Args *>( + app.args = reinterpret_cast<LIBC_NAMESPACE::Args *>( reinterpret_cast<uintptr_t *>(__builtin_frame_address(0))); do_start(); } diff --git a/libc/startup/linux/x86_64/start.cpp b/libc/startup/linux/x86_64/start.cpp index 2f9dbfd..4b46a4f 100644 --- a/libc/startup/linux/x86_64/start.cpp +++ b/libc/startup/linux/x86_64/start.cpp @@ -23,7 +23,7 @@ extern "C" int main(int, char **, char **); -namespace __llvm_libc { +namespace LIBC_NAMESPACE { #ifdef SYS_mmap2 static constexpr long mmapSyscallNumber = SYS_mmap2; @@ -59,13 +59,13 @@ void init_tls(TLSDescriptor &tls_descriptor) { // We cannot call the mmap function here as the functions set errno on // failure. Since errno is implemented via a thread local variable, we cannot // use errno before TLS is setup. - long mmapRetVal = __llvm_libc::syscall_impl<long>( + long mmapRetVal = LIBC_NAMESPACE::syscall_impl<long>( mmapSyscallNumber, nullptr, tlsSizeWithAddr, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); // We cannot check the return value with MAP_FAILED as that is the return // of the mmap function and not the mmap syscall. if (mmapRetVal < 0 && static_cast<uintptr_t>(mmapRetVal) > -app.pageSize) - __llvm_libc::syscall_impl<long>(SYS_exit, 1); + LIBC_NAMESPACE::syscall_impl<long>(SYS_exit, 1); uintptr_t *tlsAddr = reinterpret_cast<uintptr_t *>(mmapRetVal); // x86_64 TLS faces down from the thread pointer with the first entry @@ -73,9 +73,9 @@ void init_tls(TLSDescriptor &tls_descriptor) { uintptr_t endPtr = reinterpret_cast<uintptr_t>(tlsAddr) + tlsSize; *reinterpret_cast<uintptr_t *>(endPtr) = endPtr; - __llvm_libc::inline_memcpy(reinterpret_cast<char *>(tlsAddr), - reinterpret_cast<const char *>(app.tls.address), - app.tls.init_size); + LIBC_NAMESPACE::inline_memcpy(reinterpret_cast<char *>(tlsAddr), + reinterpret_cast<const char *>(app.tls.address), + app.tls.init_size); tls_descriptor = {tlsSizeWithAddr, uintptr_t(tlsAddr), endPtr}; return; @@ -84,12 +84,12 @@ void init_tls(TLSDescriptor &tls_descriptor) { void cleanup_tls(uintptr_t addr, uintptr_t size) { if (size == 0) return; - __llvm_libc::syscall_impl<long>(SYS_munmap, addr, size); + LIBC_NAMESPACE::syscall_impl<long>(SYS_munmap, addr, size); } // Sets the thread pointer to |val|. Returns true on success, false on failure. static bool set_thread_ptr(uintptr_t val) { - return __llvm_libc::syscall_impl(SYS_arch_prctl, ARCH_SET_FS, val) != -1; + return LIBC_NAMESPACE::syscall_impl(SYS_arch_prctl, ARCH_SET_FS, val) != -1; } using InitCallback = void(int, char **, char **); @@ -121,9 +121,9 @@ static void call_fini_array_callbacks() { reinterpret_cast<FiniCallback *>(__fini_array_start[i - 1])(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE -using __llvm_libc::app; +using LIBC_NAMESPACE::app; // TODO: Would be nice to use the aux entry structure from elf.h when available. struct AuxEntry { @@ -135,7 +135,7 @@ extern "C" void _start() { // This TU is compiled with -fno-omit-frame-pointer. Hence, the previous value // of the base pointer is pushed on to the stack. So, we step over it (the // "+ 1" below) to get to the args. - app.args = reinterpret_cast<__llvm_libc::Args *>( + app.args = reinterpret_cast<LIBC_NAMESPACE::Args *>( reinterpret_cast<uintptr_t *>(__builtin_frame_address(0)) + 1); // The x86_64 ABI requires that the stack pointer is aligned to a 16-byte @@ -152,10 +152,10 @@ extern "C" void _start() { __asm__ __volatile__("andq $0xfffffffffffffff0, %rsp\n\t"); __asm__ __volatile__("andq $0xfffffffffffffff0, %rbp\n\t"); - auto tid = __llvm_libc::syscall_impl<long>(SYS_gettid); + auto tid = LIBC_NAMESPACE::syscall_impl<long>(SYS_gettid); if (tid <= 0) - __llvm_libc::syscall_impl<long>(SYS_exit, 1); - __llvm_libc::main_thread_attrib.tid = static_cast<int>(tid); + LIBC_NAMESPACE::syscall_impl<long>(SYS_exit, 1); + LIBC_NAMESPACE::main_thread_attrib.tid = static_cast<int>(tid); // After the argv array, is a 8-byte long NULL value before the array of env // values. The end of the env values is marked by another 8-byte long NULL @@ -202,22 +202,22 @@ extern "C" void _start() { app.tls.align = phdr->p_align; } - __llvm_libc::TLSDescriptor tls; - __llvm_libc::init_tls(tls); - if (tls.size != 0 && !__llvm_libc::set_thread_ptr(tls.tp)) - __llvm_libc::syscall_impl<long>(SYS_exit, 1); + LIBC_NAMESPACE::TLSDescriptor tls; + LIBC_NAMESPACE::init_tls(tls); + if (tls.size != 0 && !LIBC_NAMESPACE::set_thread_ptr(tls.tp)) + LIBC_NAMESPACE::syscall_impl<long>(SYS_exit, 1); - __llvm_libc::self.attrib = &__llvm_libc::main_thread_attrib; - __llvm_libc::main_thread_attrib.atexit_callback_mgr = - __llvm_libc::internal::get_thread_atexit_callback_mgr(); + LIBC_NAMESPACE::self.attrib = &LIBC_NAMESPACE::main_thread_attrib; + LIBC_NAMESPACE::main_thread_attrib.atexit_callback_mgr = + LIBC_NAMESPACE::internal::get_thread_atexit_callback_mgr(); // We want the fini array callbacks to be run after other atexit // callbacks are run. So, we register them before running the init // array callbacks as they can potentially register their own atexit // callbacks. - __llvm_libc::atexit(&__llvm_libc::call_fini_array_callbacks); + LIBC_NAMESPACE::atexit(&LIBC_NAMESPACE::call_fini_array_callbacks); - __llvm_libc::call_init_array_callbacks( + LIBC_NAMESPACE::call_init_array_callbacks( static_cast<int>(app.args->argc), reinterpret_cast<char **>(app.args->argv), reinterpret_cast<char **>(env_ptr)); @@ -229,6 +229,6 @@ extern "C" void _start() { // TODO: TLS cleanup should be done after all other atexit callbacks // are run. So, register a cleanup callback for it with atexit before // everything else. - __llvm_libc::cleanup_tls(tls.addr, tls.size); - __llvm_libc::exit(retval); + LIBC_NAMESPACE::cleanup_tls(tls.addr, tls.size); + LIBC_NAMESPACE::exit(retval); } diff --git a/libc/test/IntegrationTest/test.cpp b/libc/test/IntegrationTest/test.cpp index 8e2feccd..3bdbe89 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 8dff198..1e5ad1c 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 7bee46c..7973086 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 1e89167..2a7d1c3 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 e55beb5..b748c29 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<RetT> 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 335720f..2129e63 100644 --- a/libc/test/UnitTest/ExecuteFunction.h +++ b/libc/test/UnitTest/ExecuteFunction.h @@ -11,7 +11,7 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testutils { class FunctionCaller { @@ -47,6 +47,6 @@ invoke_in_subprocess(FunctionCaller *func, const char *signal_as_string(int signum); } // namespace testutils -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_UTILS_TESTUTILS_EXECUTEFUNCTION_H diff --git a/libc/test/UnitTest/ExecuteFunctionUnix.cpp b/libc/test/UnitTest/ExecuteFunctionUnix.cpp index 1caaa24b..b244337 100644 --- a/libc/test/UnitTest/ExecuteFunctionUnix.cpp +++ b/libc/test/UnitTest/ExecuteFunctionUnix.cpp @@ -17,7 +17,7 @@ #include <sys/wait.h> #include <unistd.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testutils { bool ProcessStatus::exited_normally() { return WIFEXITED(platform_defined); } @@ -78,4 +78,4 @@ ProcessStatus invoke_in_subprocess(FunctionCaller *func, unsigned timeout_ms) { const char *signal_as_string(int signum) { return ::strsignal(signum); } } // namespace testutils -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/UnitTest/FPExceptMatcher.cpp b/libc/test/UnitTest/FPExceptMatcher.cpp index c712fec..1601b7e 100644 --- a/libc/test/UnitTest/FPExceptMatcher.cpp +++ b/libc/test/UnitTest/FPExceptMatcher.cpp @@ -13,7 +13,7 @@ #include <setjmp.h> #include <signal.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { #if defined(_WIN32) @@ -47,4 +47,4 @@ FPExceptMatcher::FPExceptMatcher(FunctionCaller *func) { } } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/UnitTest/FPExceptMatcher.h b/libc/test/UnitTest/FPExceptMatcher.h index 1563561..98c4f73 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 @@ public: }; } // 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 d8d032b..0c1f340 100644 --- a/libc/test/UnitTest/FPMatcher.h +++ b/libc/test/UnitTest/FPMatcher.h @@ -18,7 +18,7 @@ #include <math.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { template <typename T, TestCond Condition> class FPMatcher : public Matcher<T> { @@ -60,10 +60,10 @@ template <TestCond C, typename T> FPMatcher<T, C> getMatcher(T expectedValue) { } } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #define DECLARE_SPECIAL_CONSTANTS(T) \ - using FPBits = __llvm_libc::fputil::FPBits<T>; \ + using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>; \ using UIntType = typename FPBits::UIntType; \ const T zero = T(FPBits::zero()); \ const T neg_zero = T(FPBits::neg_zero()); \ @@ -72,35 +72,27 @@ template <TestCond C, typename T> FPMatcher<T, C> getMatcher(T expectedValue) { const T neg_inf = T(FPBits::neg_inf()); #define EXPECT_FP_EQ(expected, actual) \ - EXPECT_THAT( \ - actual, \ - __llvm_libc::testing::getMatcher<__llvm_libc::testing::TestCond::EQ>( \ - expected)) + EXPECT_THAT(actual, LIBC_NAMESPACE::testing::getMatcher< \ + LIBC_NAMESPACE::testing::TestCond::EQ>(expected)) #define TEST_FP_EQ(expected, actual) \ - __llvm_libc::testing::getMatcher<__llvm_libc::testing::TestCond::EQ>( \ + LIBC_NAMESPACE::testing::getMatcher<LIBC_NAMESPACE::testing::TestCond::EQ>( \ expected) \ .match(actual) #define EXPECT_FP_IS_NAN(actual) EXPECT_TRUE((actual) != (actual)) #define ASSERT_FP_EQ(expected, actual) \ - ASSERT_THAT( \ - actual, \ - __llvm_libc::testing::getMatcher<__llvm_libc::testing::TestCond::EQ>( \ - expected)) + ASSERT_THAT(actual, LIBC_NAMESPACE::testing::getMatcher< \ + LIBC_NAMESPACE::testing::TestCond::EQ>(expected)) #define EXPECT_FP_NE(expected, actual) \ - EXPECT_THAT( \ - actual, \ - __llvm_libc::testing::getMatcher<__llvm_libc::testing::TestCond::NE>( \ - expected)) + EXPECT_THAT(actual, LIBC_NAMESPACE::testing::getMatcher< \ + LIBC_NAMESPACE::testing::TestCond::NE>(expected)) #define ASSERT_FP_NE(expected, actual) \ - ASSERT_THAT( \ - actual, \ - __llvm_libc::testing::getMatcher<__llvm_libc::testing::TestCond::NE>( \ - expected)) + ASSERT_THAT(actual, LIBC_NAMESPACE::testing::getMatcher< \ + LIBC_NAMESPACE::testing::TestCond::NE>(expected)) #define EXPECT_MATH_ERRNO(expected) \ do { \ @@ -123,7 +115,7 @@ template <TestCond C, typename T> FPMatcher<T, C> getMatcher(T expectedValue) { #define EXPECT_FP_EXCEPTION(expected) \ do { \ if (math_errhandling & MATH_ERREXCEPT) { \ - EXPECT_GE(__llvm_libc::fputil::test_except(FE_ALL_EXCEPT) & expected, \ + EXPECT_GE(LIBC_NAMESPACE::fputil::test_except(FE_ALL_EXCEPT) & expected, \ expected); \ } \ } while (0) @@ -131,38 +123,38 @@ template <TestCond C, typename T> FPMatcher<T, C> getMatcher(T expectedValue) { #define ASSERT_FP_EXCEPTION(expected) \ do { \ if (math_errhandling & MATH_ERREXCEPT) { \ - ASSERT_GE(__llvm_libc::fputil::test_except(FE_ALL_EXCEPT) & expected, \ + ASSERT_GE(LIBC_NAMESPACE::fputil::test_except(FE_ALL_EXCEPT) & expected, \ expected); \ } \ } while (0) #define EXPECT_FP_EQ_WITH_EXCEPTION(expected_val, actual_val, expected_except) \ do { \ - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); \ + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); \ EXPECT_FP_EQ(expected_val, actual_val); \ if (math_errhandling & MATH_ERREXCEPT) { \ - EXPECT_GE(__llvm_libc::fputil::test_except(FE_ALL_EXCEPT) & \ + EXPECT_GE(LIBC_NAMESPACE::fputil::test_except(FE_ALL_EXCEPT) & \ expected_except, \ expected_except); \ - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); \ + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); \ } \ } while (0) #define EXPECT_FP_IS_NAN_WITH_EXCEPTION(actual_val, expected_except) \ do { \ - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); \ + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); \ EXPECT_FP_IS_NAN(actual_val); \ if (math_errhandling & MATH_ERREXCEPT) { \ - EXPECT_GE(__llvm_libc::fputil::test_except(FE_ALL_EXCEPT) & \ + EXPECT_GE(LIBC_NAMESPACE::fputil::test_except(FE_ALL_EXCEPT) & \ expected_except, \ expected_except); \ - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); \ + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); \ } \ } while (0) #define EXPECT_FP_EQ_ALL_ROUNDING(expected, actual) \ do { \ - using namespace __llvm_libc::fputil::testing; \ + using namespace LIBC_NAMESPACE::fputil::testing; \ ForceRoundingMode __r1(RoundingMode::Nearest); \ if (__r1.success) \ EXPECT_FP_EQ((expected), (actual)); \ diff --git a/libc/test/UnitTest/FuchsiaTest.h b/libc/test/UnitTest/FuchsiaTest.h index f711e83..07a6e9b 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 3d88b0e..73d54b9 100644 --- a/libc/test/UnitTest/HermeticTestUtils.cpp +++ b/libc/test/UnitTest/HermeticTestUtils.cpp @@ -9,7 +9,7 @@ #include <stddef.h> #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int bcmp(const void *lhs, const void *rhs, size_t count); void bzero(void *ptr, size_t count); @@ -19,7 +19,7 @@ void *memmove(void *dst, const void *src, size_t count); void *memset(void *ptr, int value, size_t count); int atexit(void (*func)(void)); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE namespace { @@ -43,24 +43,24 @@ extern "C" { // This is done manually as not all targets support aliases. int bcmp(const void *lhs, const void *rhs, size_t count) { - return __llvm_libc::bcmp(lhs, rhs, count); + return LIBC_NAMESPACE::bcmp(lhs, rhs, count); } -void bzero(void *ptr, size_t count) { __llvm_libc::bzero(ptr, count); } +void bzero(void *ptr, size_t count) { LIBC_NAMESPACE::bzero(ptr, count); } int memcmp(const void *lhs, const void *rhs, size_t count) { - return __llvm_libc::memcmp(lhs, rhs, count); + return LIBC_NAMESPACE::memcmp(lhs, rhs, count); } void *memcpy(void *__restrict dst, const void *__restrict src, size_t count) { - return __llvm_libc::memcpy(dst, src, count); + return LIBC_NAMESPACE::memcpy(dst, src, count); } void *memmove(void *dst, const void *src, size_t count) { - return __llvm_libc::memmove(dst, src, count); + return LIBC_NAMESPACE::memmove(dst, src, count); } void *memset(void *ptr, int value, size_t count) { - return __llvm_libc::memset(ptr, value, count); + return LIBC_NAMESPACE::memset(ptr, value, count); } // This is needed if the test was compiled with '-fno-use-cxa-atexit'. -int atexit(void (*func)(void)) { return __llvm_libc::atexit(func); } +int atexit(void (*func)(void)) { return LIBC_NAMESPACE::atexit(func); } constexpr uint64_t ALIGNMENT = alignof(uintptr_t); diff --git a/libc/test/UnitTest/LibcDeathTestExecutors.cpp b/libc/test/UnitTest/LibcDeathTestExecutors.cpp index f25c0f7..e891c4e 100644 --- a/libc/test/UnitTest/LibcDeathTestExecutors.cpp +++ b/libc/test/UnitTest/LibcDeathTestExecutors.cpp @@ -13,7 +13,7 @@ #include <cassert> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { bool Test::testProcessKilled(testutils::FunctionCaller *Func, int Signal, @@ -101,4 +101,4 @@ bool Test::testProcessExits(testutils::FunctionCaller *Func, int ExitCode, } } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/UnitTest/LibcTest.cpp b/libc/test/UnitTest/LibcTest.cpp index d9a9e50..2f18d57 100644 --- a/libc/test/UnitTest/LibcTest.cpp +++ b/libc/test/UnitTest/LibcTest.cpp @@ -17,21 +17,21 @@ #include <time.h> #elif defined(LIBC_TARGET_ARCH_IS_GPU) #include "src/__support/GPU/utils.h" -static long clock() { return __llvm_libc::gpu::fixed_frequency_clock(); } +static long clock() { return LIBC_NAMESPACE::gpu::fixed_frequency_clock(); } #if defined(LIBC_TARGET_ARCH_IS_NVPTX) #define CLOCKS_PER_SEC 1000000000UL #else // The AMDGPU loader needs to initialize this at runtime by querying the driver. extern "C" [[gnu::visibility("protected")]] uint64_t - [[clang::address_space(4)]] __llvm_libc_clock_freq; -#define CLOCKS_PER_SEC __llvm_libc_clock_freq + [[clang::address_space(4)]] LIBC_NAMESPACE_clock_freq; +#define CLOCKS_PER_SEC LIBC_NAMESPACE_clock_freq #endif #else static long clock() { return 0; } #define CLOCKS_PER_SEC 1 #endif -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { namespace internal { @@ -244,52 +244,43 @@ template bool test<__uint128_t>(RunContext *Ctx, TestCond Cond, __uint128_t LHS, const char *RHSStr, Location Loc); #endif -template bool test<__llvm_libc::cpp::Int<128>>(RunContext *Ctx, TestCond Cond, - __llvm_libc::cpp::Int<128> LHS, - __llvm_libc::cpp::Int<128> RHS, - const char *LHSStr, - const char *RHSStr, - Location Loc); +template bool test<LIBC_NAMESPACE::cpp::Int<128>>( + RunContext *Ctx, TestCond Cond, LIBC_NAMESPACE::cpp::Int<128> LHS, + LIBC_NAMESPACE::cpp::Int<128> RHS, const char *LHSStr, const char *RHSStr, + Location Loc); -template bool test<__llvm_libc::cpp::UInt<128>>(RunContext *Ctx, TestCond Cond, - __llvm_libc::cpp::UInt<128> LHS, - __llvm_libc::cpp::UInt<128> RHS, - const char *LHSStr, - const char *RHSStr, - Location Loc); +template bool test<LIBC_NAMESPACE::cpp::UInt<128>>( + RunContext *Ctx, TestCond Cond, LIBC_NAMESPACE::cpp::UInt<128> LHS, + LIBC_NAMESPACE::cpp::UInt<128> RHS, const char *LHSStr, const char *RHSStr, + Location Loc); -template bool test<__llvm_libc::cpp::UInt<192>>(RunContext *Ctx, TestCond Cond, - __llvm_libc::cpp::UInt<192> LHS, - __llvm_libc::cpp::UInt<192> RHS, - const char *LHSStr, - const char *RHSStr, - Location Loc); +template bool test<LIBC_NAMESPACE::cpp::UInt<192>>( + RunContext *Ctx, TestCond Cond, LIBC_NAMESPACE::cpp::UInt<192> LHS, + LIBC_NAMESPACE::cpp::UInt<192> RHS, const char *LHSStr, const char *RHSStr, + Location Loc); -template bool test<__llvm_libc::cpp::UInt<256>>(RunContext *Ctx, TestCond Cond, - __llvm_libc::cpp::UInt<256> LHS, - __llvm_libc::cpp::UInt<256> RHS, - const char *LHSStr, - const char *RHSStr, - Location Loc); +template bool test<LIBC_NAMESPACE::cpp::UInt<256>>( + RunContext *Ctx, TestCond Cond, LIBC_NAMESPACE::cpp::UInt<256> LHS, + LIBC_NAMESPACE::cpp::UInt<256> RHS, const char *LHSStr, const char *RHSStr, + Location Loc); + +template bool test<LIBC_NAMESPACE::cpp::UInt<320>>( + RunContext *Ctx, TestCond Cond, LIBC_NAMESPACE::cpp::UInt<320> LHS, + LIBC_NAMESPACE::cpp::UInt<320> RHS, const char *LHSStr, const char *RHSStr, + Location Loc); -template bool test<__llvm_libc::cpp::UInt<320>>(RunContext *Ctx, TestCond Cond, - __llvm_libc::cpp::UInt<320> LHS, - __llvm_libc::cpp::UInt<320> RHS, +template bool test<LIBC_NAMESPACE::cpp::string_view>( + RunContext *Ctx, TestCond Cond, LIBC_NAMESPACE::cpp::string_view LHS, + LIBC_NAMESPACE::cpp::string_view RHS, const char *LHSStr, + const char *RHSStr, Location Loc); + +template bool test<LIBC_NAMESPACE::cpp::string>(RunContext *Ctx, TestCond Cond, + LIBC_NAMESPACE::cpp::string LHS, + LIBC_NAMESPACE::cpp::string RHS, const char *LHSStr, const char *RHSStr, Location Loc); -template bool test<__llvm_libc::cpp::string_view>( - RunContext *Ctx, TestCond Cond, __llvm_libc::cpp::string_view LHS, - __llvm_libc::cpp::string_view RHS, const char *LHSStr, const char *RHSStr, - Location Loc); - -template bool test<__llvm_libc::cpp::string>(RunContext *Ctx, TestCond Cond, - __llvm_libc::cpp::string LHS, - __llvm_libc::cpp::string RHS, - const char *LHSStr, - const char *RHSStr, Location Loc); - } // namespace internal bool Test::testStrEq(const char *LHS, const char *RHS, const char *LHSStr, @@ -321,4 +312,4 @@ bool Test::testMatch(bool MatchResult, MatcherBase &Matcher, const char *LHSStr, } } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/UnitTest/LibcTest.h b/libc/test/UnitTest/LibcTest.h index d01618d..dc17c3c 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 @@ protected: template < typename ValType, - cpp::enable_if_t<cpp::is_same_v<ValType, __llvm_libc::cpp::string_view>, - int> = 0> + cpp::enable_if_t< + cpp::is_same_v<ValType, LIBC_NAMESPACE::cpp::string_view>, int> = 0> bool test(TestCond Cond, ValType LHS, ValType RHS, const char *LHSStr, const char *RHSStr, internal::Location Loc) { return internal::test(Ctx, Cond, LHS, RHS, LHSStr, RHSStr, Loc); } template <typename ValType, - cpp::enable_if_t<cpp::is_same_v<ValType, __llvm_libc::cpp::string>, - int> = 0> + cpp::enable_if_t< + cpp::is_same_v<ValType, LIBC_NAMESPACE::cpp::string>, int> = 0> bool test(TestCond Cond, ValType LHS, ValType RHS, const char *LHSStr, const char *RHSStr, internal::Location Loc) { return internal::test(Ctx, Cond, LHS, RHS, LHSStr, RHSStr, Loc); @@ -225,8 +225,9 @@ constexpr bool valid_prefix(char const *lhs) { } // 'str' is a null terminated string of the form -// "const char *__llvm_libc::testing::internal::GetTypeName() [ParamType = XXX]" -// We return the substring that start at character '[' or a default message. +// "const char *LIBC_NAMESPACE::testing::internal::GetTypeName() [ParamType = +// XXX]" We return the substring that start at character '[' or a default +// message. constexpr char const *GetPrettyFunctionParamType(char const *str) { for (const char *ptr = str; *ptr != '\0'; ++ptr) if (*ptr == '[') @@ -292,13 +293,13 @@ template <typename... Types> struct TypeList { } // namespace internal -// Make TypeList visible in __llvm_libc::testing. +// Make TypeList visible in LIBC_NAMESPACE::testing. template <typename... Types> using TypeList = internal::TypeList<Types...>; CString libc_make_test_file_path_func(const char *file_name); } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE // For TYPED_TEST and TYPED_TEST_F below we need to display which type was used // to run the test. The default will return the fully qualified canonical type @@ -306,22 +307,23 @@ CString libc_make_test_file_path_func(const char *file_name); // client to register the type name as they see it in the code. #define REGISTER_TYPE_NAME(TYPE) \ template <> \ - constexpr const char *__llvm_libc::testing::internal::GetTypeName<TYPE>() { \ + constexpr const char * \ + LIBC_NAMESPACE::testing::internal::GetTypeName<TYPE>() { \ return "[ParamType = " #TYPE "]"; \ } #define TYPED_TEST(SuiteName, TestName, TypeList) \ static_assert( \ - __llvm_libc::testing::internal::valid_prefix(#SuiteName), \ + LIBC_NAMESPACE::testing::internal::valid_prefix(#SuiteName), \ "All LLVM-libc TYPED_TEST suite names must start with 'LlvmLibc'."); \ template <typename T> \ - class SuiteName##_##TestName : public __llvm_libc::testing::Test { \ + class SuiteName##_##TestName : public LIBC_NAMESPACE::testing::Test { \ public: \ using ParamType = T; \ char name[256]; \ SuiteName##_##TestName() { \ addTest(this); \ - __llvm_libc::testing::internal::GenerateName<T>( \ + LIBC_NAMESPACE::testing::internal::GenerateName<T>( \ name, sizeof(name), #SuiteName "." #TestName); \ } \ void Run() override; \ @@ -332,7 +334,7 @@ CString libc_make_test_file_path_func(const char *file_name); template <typename T> void SuiteName##_##TestName<T>::Run() #define TYPED_TEST_F(SuiteClass, TestName, TypeList) \ - static_assert(__llvm_libc::testing::internal::valid_prefix(#SuiteClass), \ + static_assert(LIBC_NAMESPACE::testing::internal::valid_prefix(#SuiteClass), \ "All LLVM-libc TYPED_TEST_F suite class names must start " \ "with 'LlvmLibc'."); \ template <typename T> class SuiteClass##_##TestName : public SuiteClass<T> { \ @@ -341,7 +343,7 @@ CString libc_make_test_file_path_func(const char *file_name); char name[256]; \ SuiteClass##_##TestName() { \ SuiteClass<T>::addTest(this); \ - __llvm_libc::testing::internal::GenerateName<T>( \ + LIBC_NAMESPACE::testing::internal::GenerateName<T>( \ name, sizeof(name), #SuiteClass "." #TestName); \ } \ void Run() override; \ @@ -352,9 +354,9 @@ CString libc_make_test_file_path_func(const char *file_name); template <typename T> void SuiteClass##_##TestName<T>::Run() #define TEST(SuiteName, TestName) \ - static_assert(__llvm_libc::testing::internal::valid_prefix(#SuiteName), \ + static_assert(LIBC_NAMESPACE::testing::internal::valid_prefix(#SuiteName), \ "All LLVM-libc TEST suite names must start with 'LlvmLibc'."); \ - class SuiteName##_##TestName : public __llvm_libc::testing::Test { \ + class SuiteName##_##TestName : public LIBC_NAMESPACE::testing::Test { \ public: \ SuiteName##_##TestName() { addTest(this); } \ void Run() override; \ @@ -365,7 +367,7 @@ CString libc_make_test_file_path_func(const char *file_name); #define TEST_F(SuiteClass, TestName) \ static_assert( \ - __llvm_libc::testing::internal::valid_prefix(#SuiteClass), \ + LIBC_NAMESPACE::testing::internal::valid_prefix(#SuiteClass), \ "All LLVM-libc TEST_F suite class names must start with 'LlvmLibc'."); \ class SuiteClass##_##TestName : public SuiteClass { \ public: \ @@ -404,12 +406,12 @@ CString libc_make_test_file_path_func(const char *file_name); if (TEST) \ ; \ else \ - RET_OR_EMPTY __llvm_libc::testing::internal::Failure() = \ - __llvm_libc::testing::internal::Message() + RET_OR_EMPTY LIBC_NAMESPACE::testing::internal::Failure() = \ + LIBC_NAMESPACE::testing::internal::Message() #define LIBC_TEST_BINOP_(COND, LHS, RHS, RET_OR_EMPTY) \ - LIBC_TEST_SCAFFOLDING_(test(__llvm_libc::testing::TestCond::COND, LHS, RHS, \ - #LHS, #RHS, LIBC_TEST_LOC_()), \ + LIBC_TEST_SCAFFOLDING_(test(LIBC_NAMESPACE::testing::TestCond::COND, LHS, \ + RHS, #LHS, #RHS, LIBC_TEST_LOC_()), \ RET_OR_EMPTY) //////////////////////////////////////////////////////////////////////////////// @@ -462,7 +464,7 @@ CString libc_make_test_file_path_func(const char *file_name); #define LIBC_TEST_PROCESS_(TEST_FUNC, FUNC, VALUE, RET_OR_EMPTY) \ LIBC_TEST_SCAFFOLDING_( \ - TEST_FUNC(__llvm_libc::testing::Test::createCallable(FUNC), VALUE, \ + TEST_FUNC(LIBC_NAMESPACE::testing::Test::createCallable(FUNC), VALUE, \ #FUNC, #VALUE, LIBC_TEST_LOC_()), \ RET_OR_EMPTY) diff --git a/libc/test/UnitTest/LibcTestMain.cpp b/libc/test/UnitTest/LibcTestMain.cpp index 756d119..bf1a921 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 32f7d5e..d9d8950 100644 --- a/libc/test/UnitTest/MemoryMatcher.cpp +++ b/libc/test/UnitTest/MemoryMatcher.cpp @@ -10,9 +10,9 @@ #include "test/UnitTest/Test.h" -using __llvm_libc::testing::tlog; +using LIBC_NAMESPACE::testing::tlog; -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { template <typename T> @@ -75,4 +75,4 @@ void MemoryMatcher::explainError() { } } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/UnitTest/MemoryMatcher.h b/libc/test/UnitTest/MemoryMatcher.h index e3df4c0..cf861a6 100644 --- a/libc/test/UnitTest/MemoryMatcher.h +++ b/libc/test/UnitTest/MemoryMatcher.h @@ -13,35 +13,35 @@ #include "test/UnitTest/Test.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { -using MemoryView = __llvm_libc::cpp::span<const char>; +using MemoryView = LIBC_NAMESPACE::cpp::span<const char>; } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #ifdef LIBC_COPT_TEST_USE_FUCHSIA #define EXPECT_MEM_EQ(expected, actual) \ do { \ - __llvm_libc::testing::MemoryView e = (expected); \ - __llvm_libc::testing::MemoryView a = (actual); \ + LIBC_NAMESPACE::testing::MemoryView e = (expected); \ + LIBC_NAMESPACE::testing::MemoryView a = (actual); \ ASSERT_EQ(e.size(), a.size()); \ EXPECT_BYTES_EQ(e.data(), a.data(), e.size()); \ } while (0) #define ASSERT_MEM_EQ(expected, actual) \ do { \ - __llvm_libc::testing::MemoryView e = (expected); \ - __llvm_libc::testing::MemoryView a = (actual); \ + LIBC_NAMESPACE::testing::MemoryView e = (expected); \ + LIBC_NAMESPACE::testing::MemoryView a = (actual); \ ASSERT_EQ(e.size(), a.size()); \ ASSERT_BYTES_EQ(e.data(), a.data(), e.size()); \ } while (0) #else -namespace __llvm_libc::testing { +namespace LIBC_NAMESPACE::testing { class MemoryMatcher : public Matcher<MemoryView> { MemoryView expected; @@ -57,12 +57,12 @@ public: 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 f3b33b7..8556335 100644 --- a/libc/test/UnitTest/PigweedTest.h +++ b/libc/test/UnitTest/PigweedTest.h @@ -11,7 +11,7 @@ #include <gtest/gtest.h> -namespace __llvm_libc::testing { +namespace LIBC_NAMESPACE::testing { using Test = ::testing::Test; } diff --git a/libc/test/UnitTest/PrintfMatcher.cpp b/libc/test/UnitTest/PrintfMatcher.cpp index 019eafc..e895da2b 100644 --- a/libc/test/UnitTest/PrintfMatcher.cpp +++ b/libc/test/UnitTest/PrintfMatcher.cpp @@ -16,7 +16,7 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { using printf_core::FormatFlags; @@ -94,4 +94,4 @@ void FormatSectionMatcher::explainError() { } } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/UnitTest/PrintfMatcher.h b/libc/test/UnitTest/PrintfMatcher.h index 148c9ff..a4fbeda 100644 --- a/libc/test/UnitTest/PrintfMatcher.h +++ b/libc/test/UnitTest/PrintfMatcher.h @@ -14,7 +14,7 @@ #include <errno.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { class FormatSectionMatcher : public Matcher<printf_core::FormatSection> { @@ -31,12 +31,12 @@ public: }; } // 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 f880eff..c8f32f8 100644 --- a/libc/test/UnitTest/RoundingModeUtils.cpp +++ b/libc/test/UnitTest/RoundingModeUtils.cpp @@ -12,7 +12,7 @@ #include <fenv.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { namespace testing { @@ -48,4 +48,4 @@ ForceRoundingMode::~ForceRoundingMode() { } // namespace testing } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/UnitTest/RoundingModeUtils.h b/libc/test/UnitTest/RoundingModeUtils.h index e8611c3..d1c3c6f 100644 --- a/libc/test/UnitTest/RoundingModeUtils.h +++ b/libc/test/UnitTest/RoundingModeUtils.h @@ -11,7 +11,7 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { namespace testing { @@ -32,6 +32,6 @@ template <RoundingMode R> struct ForceRoundingModeTest : ForceRoundingMode { } // namespace testing } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_UTILS_TESTUTILS_ROUNDINGMODEUTILS_H diff --git a/libc/test/UnitTest/ScanfMatcher.cpp b/libc/test/UnitTest/ScanfMatcher.cpp index 7374858..91cb73f 100644 --- a/libc/test/UnitTest/ScanfMatcher.cpp +++ b/libc/test/UnitTest/ScanfMatcher.cpp @@ -16,7 +16,7 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { using scanf_core::FormatFlags; @@ -99,4 +99,4 @@ void FormatSectionMatcher::explainError() { } } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/UnitTest/ScanfMatcher.h b/libc/test/UnitTest/ScanfMatcher.h index 864a35d..0b9a886 100644 --- a/libc/test/UnitTest/ScanfMatcher.h +++ b/libc/test/UnitTest/ScanfMatcher.h @@ -14,7 +14,7 @@ #include <errno.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { class FormatSectionMatcher : public Matcher<scanf_core::FormatSection> { @@ -31,12 +31,12 @@ public: }; } // 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 8f517a5..ac28926 100644 --- a/libc/test/UnitTest/StringUtils.h +++ b/libc/test/UnitTest/StringUtils.h @@ -12,7 +12,7 @@ #include "src/__support/CPP/string.h" #include "src/__support/CPP/type_traits.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Return the first N hex digits of an integer as a string in upper case. template <typename T> @@ -31,6 +31,6 @@ int_to_hex(T value, size_t length = sizeof(T) * 2) { return "0x" + s; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_UTILS_UNITTEST_SIMPLE_STRING_CONV_H diff --git a/libc/test/UnitTest/TestLogger.cpp b/libc/test/UnitTest/TestLogger.cpp index 02be4bd..6bb0e17 100644 --- a/libc/test/UnitTest/TestLogger.cpp +++ b/libc/test/UnitTest/TestLogger.cpp @@ -6,13 +6,13 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { // cpp::string_view specialization template <> TestLogger &TestLogger::operator<< <cpp::string_view>(cpp::string_view str) { - __llvm_libc::write_to_stderr(str); + LIBC_NAMESPACE::write_to_stderr(str); return *this; } @@ -83,4 +83,4 @@ template TestLogger &TestLogger::operator<< <cpp::UInt<320>>(cpp::UInt<320>); TestLogger tlog; } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/UnitTest/TestLogger.h b/libc/test/UnitTest/TestLogger.h index 2d46ea1..6188bcf 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 300cf2c..697d991 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 2574f1f..d7ad54e 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 c8d5123..6a9b44c 100644 --- a/libc/test/integration/src/pthread/pthread_create_test.cpp +++ b/libc/test/integration/src/pthread/pthread_create_test.cpp @@ -40,12 +40,12 @@ struct TestThreadArgs { pthread_attr_t attrs; void *ret; }; -static __llvm_libc::AllocChecker global_ac; -static __llvm_libc::cpp::Atomic<long> global_thr_count = 0; +static LIBC_NAMESPACE::AllocChecker global_ac; +static LIBC_NAMESPACE::cpp::Atomic<long> global_thr_count = 0; static void *successThread(void *Arg) { - pthread_t th = __llvm_libc::pthread_self(); - auto *thread = reinterpret_cast<__llvm_libc::Thread *>(&th); + pthread_t th = LIBC_NAMESPACE::pthread_self(); + auto *thread = reinterpret_cast<LIBC_NAMESPACE::Thread *>(&th); ASSERT_EQ(libc_errno, 0); ASSERT_TRUE(thread); @@ -59,22 +59,23 @@ static void *successThread(void *Arg) { size_t expec_stacksize, expec_guardsize, expec_stacksize2; int expec_detached; - ASSERT_EQ(__llvm_libc::pthread_attr_getstack(expec_attrs, &expec_stack, - &expec_stacksize), + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_getstack(expec_attrs, &expec_stack, + &expec_stacksize), 0); ASSERT_EQ(libc_errno, 0); ASSERT_EQ( - __llvm_libc::pthread_attr_getstacksize(expec_attrs, &expec_stacksize2), + LIBC_NAMESPACE::pthread_attr_getstacksize(expec_attrs, &expec_stacksize2), 0); ASSERT_EQ(libc_errno, 0); ASSERT_EQ( - __llvm_libc::pthread_attr_getguardsize(expec_attrs, &expec_guardsize), 0); + LIBC_NAMESPACE::pthread_attr_getguardsize(expec_attrs, &expec_guardsize), + 0); ASSERT_EQ(libc_errno, 0); ASSERT_EQ( - __llvm_libc::pthread_attr_getdetachstate(expec_attrs, &expec_detached), + LIBC_NAMESPACE::pthread_attr_getdetachstate(expec_attrs, &expec_detached), 0); ASSERT_EQ(libc_errno, 0); @@ -96,10 +97,10 @@ static void *successThread(void *Arg) { ASSERT_EQ(expec_detached == PTHREAD_CREATE_JOINABLE, thread->attrib->detach_state.load() == - static_cast<uint32_t>(__llvm_libc::DetachState::JOINABLE)); + static_cast<uint32_t>(LIBC_NAMESPACE::DetachState::JOINABLE)); ASSERT_EQ(expec_detached == PTHREAD_CREATE_DETACHED, thread->attrib->detach_state.load() == - static_cast<uint32_t>(__llvm_libc::DetachState::DETACHED)); + static_cast<uint32_t>(LIBC_NAMESPACE::DetachState::DETACHED)); { // Allocate some bytes on the stack on most of the stack and make sure we @@ -123,7 +124,7 @@ static void *successThread(void *Arg) { // [stack - expec_guardsize, stack) is both mapped and has PROT_NONE // permissions. Maybe we can read from /proc/{self}/map? - ASSERT_EQ(__llvm_libc::pthread_attr_destroy(expec_attrs), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_destroy(expec_attrs), 0); ASSERT_EQ(libc_errno, 0); // Arg is malloced, so free. @@ -138,33 +139,33 @@ static void run_success_config(int detachstate, size_t guardsize, TestThreadArgs *th_arg = new (global_ac) TestThreadArgs{}; pthread_attr_t *attr = &(th_arg->attrs); - ASSERT_EQ(__llvm_libc::pthread_attr_init(attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(attr), 0); ASSERT_EQ(libc_errno, 0); - ASSERT_EQ(__llvm_libc::pthread_attr_setdetachstate(attr, detachstate), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setdetachstate(attr, detachstate), 0); ASSERT_EQ(libc_errno, 0); - ASSERT_EQ(__llvm_libc::pthread_attr_setguardsize(attr, guardsize), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setguardsize(attr, guardsize), 0); ASSERT_EQ(libc_errno, 0); void *Stack = nullptr; if (customstack) { - Stack = __llvm_libc::mmap(nullptr, stacksize, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + Stack = LIBC_NAMESPACE::mmap(nullptr, stacksize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); ASSERT_NE(Stack, MAP_FAILED); ASSERT_NE(Stack, static_cast<void *>(nullptr)); ASSERT_EQ(libc_errno, 0); - ASSERT_EQ(__llvm_libc::pthread_attr_setstack(attr, Stack, stacksize), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setstack(attr, Stack, stacksize), 0); ASSERT_EQ(libc_errno, 0); } else { - ASSERT_EQ(__llvm_libc::pthread_attr_setstacksize(attr, stacksize), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setstacksize(attr, stacksize), 0); ASSERT_EQ(libc_errno, 0); } void *expec_ret = nullptr; if (detachstate == PTHREAD_CREATE_JOINABLE) { - ASSERT_EQ(__llvm_libc::getrandom(&expec_ret, sizeof(expec_ret), 0), + ASSERT_EQ(LIBC_NAMESPACE::getrandom(&expec_ret, sizeof(expec_ret), 0), static_cast<ssize_t>(sizeof(expec_ret))); ASSERT_EQ(libc_errno, 0); } @@ -174,19 +175,19 @@ static void run_success_config(int detachstate, size_t guardsize, pthread_t tid; // th_arg and attr are cleanup by the thread. - ASSERT_EQ(__llvm_libc::pthread_create(&tid, attr, successThread, - reinterpret_cast<void *>(th_arg)), + ASSERT_EQ(LIBC_NAMESPACE::pthread_create(&tid, attr, successThread, + reinterpret_cast<void *>(th_arg)), 0); ASSERT_EQ(libc_errno, 0); if (detachstate == PTHREAD_CREATE_JOINABLE) { void *th_ret; - ASSERT_EQ(__llvm_libc::pthread_join(tid, &th_ret), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_join(tid, &th_ret), 0); ASSERT_EQ(libc_errno, 0); ASSERT_EQ(th_ret, expec_ret); if (customstack) { - ASSERT_EQ(__llvm_libc::munmap(Stack, stacksize), 0); + ASSERT_EQ(LIBC_NAMESPACE::munmap(Stack, stacksize), 0); ASSERT_EQ(libc_errno, 0); } } else { @@ -197,7 +198,7 @@ static void run_success_config(int detachstate, size_t guardsize, static void run_success_tests() { // Test parameters - using __llvm_libc::cpp::array; + using LIBC_NAMESPACE::cpp::array; array<int, 2> detachstates = {PTHREAD_CREATE_DETACHED, PTHREAD_CREATE_JOINABLE}; @@ -253,27 +254,28 @@ static void *failure_thread(void *) { static void create_and_check_failure_thread(pthread_attr_t *attr) { pthread_t tid; - int result = __llvm_libc::pthread_create(&tid, attr, failure_thread, nullptr); + int result = + LIBC_NAMESPACE::pthread_create(&tid, attr, failure_thread, nullptr); // EINVAL if we caught on overflow or something of that nature. EAGAIN if it // was just really larger we failed mmap. ASSERT_TRUE(result == EINVAL || result == EAGAIN); // pthread_create should NOT set errno on error ASSERT_EQ(libc_errno, 0); - ASSERT_EQ(__llvm_libc::pthread_attr_destroy(attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_destroy(attr), 0); ASSERT_EQ(libc_errno, 0); } static void run_failure_config(size_t guardsize, size_t stacksize) { pthread_attr_t attr; guardsize &= -EXEC_PAGESIZE; - ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0); ASSERT_EQ(libc_errno, 0); - ASSERT_EQ(__llvm_libc::pthread_attr_setguardsize(&attr, guardsize), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setguardsize(&attr, guardsize), 0); ASSERT_EQ(libc_errno, 0); - ASSERT_EQ(__llvm_libc::pthread_attr_setstacksize(&attr, stacksize), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setstacksize(&attr, stacksize), 0); ASSERT_EQ(libc_errno, 0); create_and_check_failure_thread(&attr); @@ -298,32 +300,32 @@ static void run_failure_tests() { pthread_attr_t attr; // Stacksize too small. - ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0); ASSERT_EQ(libc_errno, 0); attr.__stacksize = PTHREAD_STACK_MIN - 16; create_and_check_failure_thread(&attr); // Stack misaligned. - ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0); ASSERT_EQ(libc_errno, 0); attr.__stack = reinterpret_cast<void *>(1); create_and_check_failure_thread(&attr); // Stack + stacksize misaligned. - ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0); ASSERT_EQ(libc_errno, 0); attr.__stacksize = PTHREAD_STACK_MIN + 1; attr.__stack = reinterpret_cast<void *>(16); create_and_check_failure_thread(&attr); // Guardsize misaligned. - ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0); ASSERT_EQ(libc_errno, 0); attr.__guardsize = EXEC_PAGESIZE / 2; create_and_check_failure_thread(&attr); // Detachstate is unknown. - ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0); ASSERT_EQ(libc_errno, 0); attr.__detachstate = -1; create_and_check_failure_thread(&attr); diff --git a/libc/test/integration/src/pthread/pthread_equal_test.cpp b/libc/test/integration/src/pthread/pthread_equal_test.cpp index 08d8989..82f5a49 100644 --- a/libc/test/integration/src/pthread/pthread_equal_test.cpp +++ b/libc/test/integration/src/pthread/pthread_equal_test.cpp @@ -24,21 +24,21 @@ pthread_t child_thread; pthread_mutex_t mutex; static void *child_func(void *arg) { - __llvm_libc::pthread_mutex_lock(&mutex); + LIBC_NAMESPACE::pthread_mutex_lock(&mutex); int *ret = reinterpret_cast<int *>(arg); - auto self = __llvm_libc::pthread_self(); - *ret = __llvm_libc::pthread_equal(child_thread, self); - __llvm_libc::pthread_mutex_unlock(&mutex); + auto self = LIBC_NAMESPACE::pthread_self(); + *ret = LIBC_NAMESPACE::pthread_equal(child_thread, self); + LIBC_NAMESPACE::pthread_mutex_unlock(&mutex); return nullptr; } TEST_MAIN() { // We init and lock the mutex so that we guarantee that the child thread is // waiting after startup. - ASSERT_EQ(__llvm_libc::pthread_mutex_init(&mutex, nullptr), 0); - ASSERT_EQ(__llvm_libc::pthread_mutex_lock(&mutex), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_init(&mutex, nullptr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_lock(&mutex), 0); - auto main_thread = __llvm_libc::pthread_self(); + auto main_thread = LIBC_NAMESPACE::pthread_self(); // The idea here is that, we start a child thread which will immediately // wait on |mutex|. The main thread will update the global |child_thread| var @@ -47,22 +47,23 @@ TEST_MAIN() { // comparison is returned in the thread arg. int result = 0; pthread_t th; - ASSERT_EQ(__llvm_libc::pthread_create(&th, nullptr, child_func, &result), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_create(&th, nullptr, child_func, &result), + 0); // This new thread should of course not be equal to the main thread. - ASSERT_EQ(__llvm_libc::pthread_equal(th, main_thread), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_equal(th, main_thread), 0); // Set the |child_thread| global var and unlock to allow the child to perform // the comparison. child_thread = th; - ASSERT_EQ(__llvm_libc::pthread_mutex_unlock(&mutex), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_unlock(&mutex), 0); void *retval; - ASSERT_EQ(__llvm_libc::pthread_join(th, &retval), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_join(th, &retval), 0); ASSERT_EQ(uintptr_t(retval), uintptr_t(nullptr)); // The child thread should see that pthread_self return value is the same as // |child_thread|. ASSERT_NE(result, 0); - __llvm_libc::pthread_mutex_destroy(&mutex); + LIBC_NAMESPACE::pthread_mutex_destroy(&mutex); return 0; } diff --git a/libc/test/integration/src/pthread/pthread_exit_test.cpp b/libc/test/integration/src/pthread/pthread_exit_test.cpp index e60fe67..48e6c81 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 7397fa8..f412635 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 6730087..ce2a353 100644 --- a/libc/test/integration/src/pthread/pthread_mutex_test.cpp +++ b/libc/test/integration/src/pthread/pthread_mutex_test.cpp @@ -28,12 +28,12 @@ static int shared_int = START; void *counter(void *arg) { int last_count = START; while (true) { - __llvm_libc::pthread_mutex_lock(&mutex); + LIBC_NAMESPACE::pthread_mutex_lock(&mutex); if (shared_int == last_count + 1) { shared_int++; last_count = shared_int; } - __llvm_libc::pthread_mutex_unlock(&mutex); + LIBC_NAMESPACE::pthread_mutex_unlock(&mutex); if (last_count >= MAX) break; } @@ -41,16 +41,16 @@ void *counter(void *arg) { } void relay_counter() { - ASSERT_EQ(__llvm_libc::pthread_mutex_init(&mutex, nullptr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_init(&mutex, nullptr), 0); // The idea of this test is that two competing threads will update // a counter only if the other thread has updated it. pthread_t thread; - __llvm_libc::pthread_create(&thread, nullptr, counter, nullptr); + LIBC_NAMESPACE::pthread_create(&thread, nullptr, counter, nullptr); int last_count = START; while (true) { - ASSERT_EQ(__llvm_libc::pthread_mutex_lock(&mutex), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_lock(&mutex), 0); if (shared_int == START) { ++shared_int; last_count = shared_int; @@ -59,51 +59,51 @@ void relay_counter() { ++shared_int; last_count = shared_int; } - ASSERT_EQ(__llvm_libc::pthread_mutex_unlock(&mutex), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_unlock(&mutex), 0); if (last_count > MAX) break; } void *retval = reinterpret_cast<void *>(123); - __llvm_libc::pthread_join(thread, &retval); + LIBC_NAMESPACE::pthread_join(thread, &retval); ASSERT_EQ(uintptr_t(retval), uintptr_t(nullptr)); - __llvm_libc::pthread_mutex_destroy(&mutex); + LIBC_NAMESPACE::pthread_mutex_destroy(&mutex); } pthread_mutex_t start_lock, step_lock; bool started, step; void *stepper(void *arg) { - __llvm_libc::pthread_mutex_lock(&start_lock); + LIBC_NAMESPACE::pthread_mutex_lock(&start_lock); started = true; - __llvm_libc::pthread_mutex_unlock(&start_lock); + LIBC_NAMESPACE::pthread_mutex_unlock(&start_lock); - __llvm_libc::pthread_mutex_lock(&step_lock); + LIBC_NAMESPACE::pthread_mutex_lock(&step_lock); step = true; - __llvm_libc::pthread_mutex_unlock(&step_lock); + LIBC_NAMESPACE::pthread_mutex_unlock(&step_lock); return nullptr; } void wait_and_step() { - ASSERT_EQ(__llvm_libc::pthread_mutex_init(&start_lock, nullptr), 0); - ASSERT_EQ(__llvm_libc::pthread_mutex_init(&step_lock, nullptr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_init(&start_lock, nullptr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_init(&step_lock, nullptr), 0); // In this test, we start a new thread but block it before it can make a // step. Once we ensure that the thread is blocked, we unblock it. // After unblocking, we then verify that the thread was indeed unblocked. step = false; started = false; - ASSERT_EQ(__llvm_libc::pthread_mutex_lock(&step_lock), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_lock(&step_lock), 0); pthread_t thread; - __llvm_libc::pthread_create(&thread, nullptr, stepper, nullptr); + LIBC_NAMESPACE::pthread_create(&thread, nullptr, stepper, nullptr); while (true) { // Make sure the thread actually started. - ASSERT_EQ(__llvm_libc::pthread_mutex_lock(&start_lock), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_lock(&start_lock), 0); bool s = started; - ASSERT_EQ(__llvm_libc::pthread_mutex_unlock(&start_lock), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_unlock(&start_lock), 0); if (s) break; } @@ -112,22 +112,22 @@ void wait_and_step() { ASSERT_FALSE(step); // Unlock the step lock and wait until the step is made. - ASSERT_EQ(__llvm_libc::pthread_mutex_unlock(&step_lock), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_unlock(&step_lock), 0); while (true) { - ASSERT_EQ(__llvm_libc::pthread_mutex_lock(&step_lock), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_lock(&step_lock), 0); bool current_step_value = step; - ASSERT_EQ(__llvm_libc::pthread_mutex_unlock(&step_lock), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_unlock(&step_lock), 0); if (current_step_value) break; } void *retval = reinterpret_cast<void *>(123); - __llvm_libc::pthread_join(thread, &retval); + LIBC_NAMESPACE::pthread_join(thread, &retval); ASSERT_EQ(uintptr_t(retval), uintptr_t(nullptr)); - __llvm_libc::pthread_mutex_destroy(&start_lock); - __llvm_libc::pthread_mutex_destroy(&step_lock); + LIBC_NAMESPACE::pthread_mutex_destroy(&start_lock); + LIBC_NAMESPACE::pthread_mutex_destroy(&step_lock); } static constexpr int THREAD_COUNT = 10; @@ -136,54 +136,54 @@ static pthread_mutex_t counter_lock; static int wait_count = 0; void *waiter_func(void *) { - __llvm_libc::pthread_mutex_lock(&counter_lock); + LIBC_NAMESPACE::pthread_mutex_lock(&counter_lock); ++wait_count; - __llvm_libc::pthread_mutex_unlock(&counter_lock); + LIBC_NAMESPACE::pthread_mutex_unlock(&counter_lock); // Block on the waiter lock until the main // thread unblocks. - __llvm_libc::pthread_mutex_lock(&multiple_waiter_lock); - __llvm_libc::pthread_mutex_unlock(&multiple_waiter_lock); + LIBC_NAMESPACE::pthread_mutex_lock(&multiple_waiter_lock); + LIBC_NAMESPACE::pthread_mutex_unlock(&multiple_waiter_lock); - __llvm_libc::pthread_mutex_lock(&counter_lock); + LIBC_NAMESPACE::pthread_mutex_lock(&counter_lock); --wait_count; - __llvm_libc::pthread_mutex_unlock(&counter_lock); + LIBC_NAMESPACE::pthread_mutex_unlock(&counter_lock); return nullptr; } void multiple_waiters() { - __llvm_libc::pthread_mutex_init(&multiple_waiter_lock, nullptr); - __llvm_libc::pthread_mutex_init(&counter_lock, nullptr); + LIBC_NAMESPACE::pthread_mutex_init(&multiple_waiter_lock, nullptr); + LIBC_NAMESPACE::pthread_mutex_init(&counter_lock, nullptr); - __llvm_libc::pthread_mutex_lock(&multiple_waiter_lock); + LIBC_NAMESPACE::pthread_mutex_lock(&multiple_waiter_lock); pthread_t waiters[THREAD_COUNT]; for (int i = 0; i < THREAD_COUNT; ++i) { - __llvm_libc::pthread_create(waiters + i, nullptr, waiter_func, nullptr); + LIBC_NAMESPACE::pthread_create(waiters + i, nullptr, waiter_func, nullptr); } // Spin until the counter is incremented to the desired // value. while (true) { - __llvm_libc::pthread_mutex_lock(&counter_lock); + LIBC_NAMESPACE::pthread_mutex_lock(&counter_lock); if (wait_count == THREAD_COUNT) { - __llvm_libc::pthread_mutex_unlock(&counter_lock); + LIBC_NAMESPACE::pthread_mutex_unlock(&counter_lock); break; } - __llvm_libc::pthread_mutex_unlock(&counter_lock); + LIBC_NAMESPACE::pthread_mutex_unlock(&counter_lock); } - __llvm_libc::pthread_mutex_unlock(&multiple_waiter_lock); + LIBC_NAMESPACE::pthread_mutex_unlock(&multiple_waiter_lock); void *retval; for (int i = 0; i < THREAD_COUNT; ++i) { - __llvm_libc::pthread_join(waiters[i], &retval); + LIBC_NAMESPACE::pthread_join(waiters[i], &retval); } ASSERT_EQ(wait_count, 0); - __llvm_libc::pthread_mutex_destroy(&multiple_waiter_lock); - __llvm_libc::pthread_mutex_destroy(&counter_lock); + LIBC_NAMESPACE::pthread_mutex_destroy(&multiple_waiter_lock); + LIBC_NAMESPACE::pthread_mutex_destroy(&counter_lock); } TEST_MAIN() { diff --git a/libc/test/integration/src/pthread/pthread_name_test.cpp b/libc/test/integration/src/pthread/pthread_name_test.cpp index fa227b3..d341792 100644 --- a/libc/test/integration/src/pthread/pthread_name_test.cpp +++ b/libc/test/integration/src/pthread/pthread_name_test.cpp @@ -23,60 +23,64 @@ #include <pthread.h> #include <stdint.h> // uintptr_t -using string_view = __llvm_libc::cpp::string_view; +using string_view = LIBC_NAMESPACE::cpp::string_view; char child_thread_name_buffer[16]; pthread_mutex_t mutex; static void *child_func(void *) { - __llvm_libc::pthread_mutex_lock(&mutex); - auto self = __llvm_libc::pthread_self(); - __llvm_libc::pthread_getname_np(self, child_thread_name_buffer, 16); - __llvm_libc::pthread_mutex_unlock(&mutex); + LIBC_NAMESPACE::pthread_mutex_lock(&mutex); + auto self = LIBC_NAMESPACE::pthread_self(); + LIBC_NAMESPACE::pthread_getname_np(self, child_thread_name_buffer, 16); + LIBC_NAMESPACE::pthread_mutex_unlock(&mutex); return nullptr; } TEST_MAIN() { // We init and lock the mutex so that we guarantee that the child thread is // waiting after startup. - ASSERT_EQ(__llvm_libc::pthread_mutex_init(&mutex, nullptr), 0); - ASSERT_EQ(__llvm_libc::pthread_mutex_lock(&mutex), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_init(&mutex, nullptr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_lock(&mutex), 0); - auto main_thread = __llvm_libc::pthread_self(); + auto main_thread = LIBC_NAMESPACE::pthread_self(); const char MAIN_THREAD_NAME[] = "main_thread"; char thread_name_buffer[16]; - ASSERT_EQ(__llvm_libc::pthread_setname_np(main_thread, MAIN_THREAD_NAME), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_setname_np(main_thread, MAIN_THREAD_NAME), + 0); ASSERT_EQ( - __llvm_libc::pthread_getname_np(main_thread, thread_name_buffer, 16), 0); + LIBC_NAMESPACE::pthread_getname_np(main_thread, thread_name_buffer, 16), + 0); ASSERT_EQ(string_view(MAIN_THREAD_NAME), string_view(reinterpret_cast<const char *>(thread_name_buffer))); pthread_t th; - ASSERT_EQ(__llvm_libc::pthread_create(&th, nullptr, child_func, nullptr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_create(&th, nullptr, child_func, nullptr), + 0); // This new thread should of course not be equal to the main thread. const char CHILD_THREAD_NAME[] = "child_thread"; - ASSERT_EQ(__llvm_libc::pthread_setname_np(th, CHILD_THREAD_NAME), 0); - ASSERT_EQ(__llvm_libc::pthread_getname_np(th, thread_name_buffer, 16), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_setname_np(th, CHILD_THREAD_NAME), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_getname_np(th, thread_name_buffer, 16), 0); ASSERT_EQ(string_view(CHILD_THREAD_NAME), string_view(reinterpret_cast<const char *>(thread_name_buffer))); - ASSERT_EQ(__llvm_libc::pthread_mutex_unlock(&mutex), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_unlock(&mutex), 0); void *retval; - ASSERT_EQ(__llvm_libc::pthread_join(th, &retval), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_join(th, &retval), 0); ASSERT_EQ(uintptr_t(retval), uintptr_t(nullptr)); // Make sure that the child thread saw it name correctly. ASSERT_EQ( string_view(CHILD_THREAD_NAME), string_view(reinterpret_cast<const char *>(child_thread_name_buffer))); - __llvm_libc::pthread_mutex_destroy(&mutex); + LIBC_NAMESPACE::pthread_mutex_destroy(&mutex); - ASSERT_EQ(__llvm_libc::pthread_setname_np(main_thread, - "a really long name for a thread"), + ASSERT_EQ(LIBC_NAMESPACE::pthread_setname_np( + main_thread, "a really long name for a thread"), ERANGE); char smallbuf[1]; - ASSERT_EQ(__llvm_libc::pthread_getname_np(main_thread, smallbuf, 1), ERANGE); + ASSERT_EQ(LIBC_NAMESPACE::pthread_getname_np(main_thread, smallbuf, 1), + ERANGE); return 0; } diff --git a/libc/test/integration/src/pthread/pthread_once_test.cpp b/libc/test/integration/src/pthread/pthread_once_test.cpp index 2019824..8e0f234 100644 --- a/libc/test/integration/src/pthread/pthread_once_test.cpp +++ b/libc/test/integration/src/pthread/pthread_once_test.cpp @@ -21,14 +21,14 @@ #include <stdint.h> // uintptr_t static constexpr unsigned int NUM_THREADS = 5; -static __llvm_libc::cpp::Atomic<unsigned int> thread_count; +static LIBC_NAMESPACE::cpp::Atomic<unsigned int> thread_count; static unsigned int call_count; static void pthread_once_func() { ++call_count; } static void *func(void *) { static pthread_once_t flag = PTHREAD_ONCE_INIT; - ASSERT_EQ(__llvm_libc::pthread_once(&flag, pthread_once_func), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_once(&flag, pthread_once_func), 0); thread_count.fetch_add(1); @@ -42,13 +42,13 @@ void call_from_5_threads() { pthread_t threads[NUM_THREADS]; for (unsigned int i = 0; i < NUM_THREADS; ++i) { - ASSERT_EQ(__llvm_libc::pthread_create(threads + i, nullptr, func, nullptr), - 0); + ASSERT_EQ( + LIBC_NAMESPACE::pthread_create(threads + i, nullptr, func, nullptr), 0); } for (unsigned int i = 0; i < NUM_THREADS; ++i) { void *retval; - ASSERT_EQ(__llvm_libc::pthread_join(threads[i], &retval), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_join(threads[i], &retval), 0); ASSERT_EQ(uintptr_t(retval), uintptr_t(0)); } @@ -58,16 +58,16 @@ void call_from_5_threads() { static pthread_mutex_t once_func_blocker; static void blocking_once_func() { - __llvm_libc::pthread_mutex_lock(&once_func_blocker); - __llvm_libc::pthread_mutex_unlock(&once_func_blocker); + LIBC_NAMESPACE::pthread_mutex_lock(&once_func_blocker); + LIBC_NAMESPACE::pthread_mutex_unlock(&once_func_blocker); } -static __llvm_libc::cpp::Atomic<unsigned int> start_count; -static __llvm_libc::cpp::Atomic<unsigned int> done_count; +static LIBC_NAMESPACE::cpp::Atomic<unsigned int> start_count; +static LIBC_NAMESPACE::cpp::Atomic<unsigned int> done_count; static void *once_func_caller(void *) { static pthread_once_t flag; start_count.fetch_add(1); - __llvm_libc::pthread_once(&flag, blocking_once_func); + LIBC_NAMESPACE::pthread_once(&flag, blocking_once_func); done_count.fetch_add(1); return nullptr; } @@ -79,15 +79,17 @@ void test_synchronization() { start_count = 0; done_count = 0; - ASSERT_EQ(__llvm_libc::pthread_mutex_init(&once_func_blocker, nullptr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_init(&once_func_blocker, nullptr), 0); // Lock the blocking mutex so that the once func blocks. - ASSERT_EQ(__llvm_libc::pthread_mutex_lock(&once_func_blocker), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_lock(&once_func_blocker), 0); pthread_t t1, t2; ASSERT_EQ( - __llvm_libc::pthread_create(&t1, nullptr, once_func_caller, nullptr), 0); + LIBC_NAMESPACE::pthread_create(&t1, nullptr, once_func_caller, nullptr), + 0); ASSERT_EQ( - __llvm_libc::pthread_create(&t2, nullptr, once_func_caller, nullptr), 0); + LIBC_NAMESPACE::pthread_create(&t2, nullptr, once_func_caller, nullptr), + 0); while (start_count.load() != 2) ; // Spin until both threads start. @@ -96,17 +98,17 @@ void test_synchronization() { EXPECT_EQ(done_count.val, 0U); // Unlock the blocking mutex so that the once func blocks. - ASSERT_EQ(__llvm_libc::pthread_mutex_unlock(&once_func_blocker), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_unlock(&once_func_blocker), 0); void *retval; - ASSERT_EQ(__llvm_libc::pthread_join(t1, &retval), uintptr_t(0)); + ASSERT_EQ(LIBC_NAMESPACE::pthread_join(t1, &retval), uintptr_t(0)); ASSERT_EQ(uintptr_t(retval), 0); - ASSERT_EQ(__llvm_libc::pthread_join(t2, &retval), uintptr_t(0)); + ASSERT_EQ(LIBC_NAMESPACE::pthread_join(t2, &retval), uintptr_t(0)); ASSERT_EQ(uintptr_t(retval), 0); ASSERT_EQ(done_count.val, 2U); - __llvm_libc::pthread_mutex_destroy(&once_func_blocker); + LIBC_NAMESPACE::pthread_mutex_destroy(&once_func_blocker); } TEST_MAIN() { diff --git a/libc/test/integration/src/pthread/pthread_test.cpp b/libc/test/integration/src/pthread/pthread_test.cpp index fa6a828..3565a7c 100644 --- a/libc/test/integration/src/pthread/pthread_test.cpp +++ b/libc/test/integration/src/pthread/pthread_test.cpp @@ -25,11 +25,12 @@ void create_and_join() { pthread_t thread; int old_counter_val = counter; ASSERT_EQ( - __llvm_libc::pthread_create(&thread, nullptr, thread_func, nullptr), 0); + LIBC_NAMESPACE::pthread_create(&thread, nullptr, thread_func, nullptr), + 0); // Start with a retval we dont expect. void *retval = reinterpret_cast<void *>(thread_count + 1); - ASSERT_EQ(__llvm_libc::pthread_join(thread, &retval), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_join(thread, &retval), 0); ASSERT_EQ(uintptr_t(retval), uintptr_t(nullptr)); ASSERT_EQ(counter, old_counter_val + 1); } @@ -43,15 +44,15 @@ void spawn_and_join() { for (int i = 0; i < thread_count; ++i) { args[i] = i; - ASSERT_EQ(__llvm_libc::pthread_create(thread_list + i, nullptr, return_arg, - args + i), + ASSERT_EQ(LIBC_NAMESPACE::pthread_create(thread_list + i, nullptr, + return_arg, args + i), 0); } for (int i = 0; i < thread_count; ++i) { // Start with a retval we dont expect. void *retval = reinterpret_cast<void *>(thread_count + 1); - ASSERT_EQ(__llvm_libc::pthread_join(thread_list[i], &retval), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_join(thread_list[i], &retval), 0); ASSERT_EQ(*reinterpret_cast<int *>(retval), i); } } diff --git a/libc/test/integration/src/pthread/pthread_tss_test.cpp b/libc/test/integration/src/pthread/pthread_tss_test.cpp index b5843d2..c90525a 100644 --- a/libc/test/integration/src/pthread/pthread_tss_test.cpp +++ b/libc/test/integration/src/pthread/pthread_tss_test.cpp @@ -34,8 +34,8 @@ static void dtor(void *data) { static void dtor_failure(void *) { ASSERT_TRUE(false); } static void *func(void *obj) { - ASSERT_EQ(__llvm_libc::pthread_setspecific(key, &child_thread_data), 0); - int *d = reinterpret_cast<int *>(__llvm_libc::pthread_getspecific(key)); + ASSERT_EQ(LIBC_NAMESPACE::pthread_setspecific(key, &child_thread_data), 0); + int *d = reinterpret_cast<int *>(LIBC_NAMESPACE::pthread_getspecific(key)); ASSERT_TRUE(d != nullptr); ASSERT_EQ(&child_thread_data, d); ASSERT_EQ(*d, THREAD_DATA_INITVAL); @@ -45,37 +45,37 @@ static void *func(void *obj) { static void *func_null_val(void *) { // null value, we should not call dtor - ASSERT_EQ(__llvm_libc::pthread_setspecific(key, nullptr), 0); - ASSERT_EQ(__llvm_libc::pthread_getspecific(key), nullptr); + ASSERT_EQ(LIBC_NAMESPACE::pthread_setspecific(key, nullptr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_getspecific(key), nullptr); return nullptr; } static void standard_usage_test() { - ASSERT_EQ(__llvm_libc::pthread_key_create(&key, &dtor), 0); - ASSERT_EQ(__llvm_libc::pthread_setspecific(key, &main_thread_data), 0); - int *d = reinterpret_cast<int *>(__llvm_libc::pthread_getspecific(key)); + ASSERT_EQ(LIBC_NAMESPACE::pthread_key_create(&key, &dtor), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_setspecific(key, &main_thread_data), 0); + int *d = reinterpret_cast<int *>(LIBC_NAMESPACE::pthread_getspecific(key)); ASSERT_TRUE(d != nullptr); ASSERT_EQ(&main_thread_data, d); ASSERT_EQ(*d, THREAD_DATA_INITVAL); pthread_t th; int arg = 0xBAD; - ASSERT_EQ(__llvm_libc::pthread_create(&th, nullptr, &func, &arg), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_create(&th, nullptr, &func, &arg), 0); void *retval = &child_thread_data; // Init to some non-nullptr val. - ASSERT_EQ(__llvm_libc::pthread_join(th, &retval), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_join(th, &retval), 0); ASSERT_EQ(retval, nullptr); ASSERT_EQ(arg, THREAD_RUN_VAL); ASSERT_EQ(child_thread_data, THREAD_DATA_FINIVAL); - ASSERT_EQ(__llvm_libc::pthread_key_delete(key), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_key_delete(key), 0); } static void null_value_test() { pthread_t th; - ASSERT_EQ(__llvm_libc::pthread_key_create(&key, &dtor_failure), 0); - ASSERT_EQ(__llvm_libc::pthread_create(&th, nullptr, &func_null_val, nullptr), - 0); - ASSERT_EQ(__llvm_libc::pthread_join(th, nullptr), 0); - ASSERT_EQ(__llvm_libc::pthread_key_delete(key), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_key_create(&key, &dtor_failure), 0); + ASSERT_EQ( + LIBC_NAMESPACE::pthread_create(&th, nullptr, &func_null_val, nullptr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_join(th, nullptr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_key_delete(key), 0); } TEST_MAIN() { diff --git a/libc/test/integration/src/spawn/posix_spawn_test.cpp b/libc/test/integration/src/spawn/posix_spawn_test.cpp index 69b60a41..104096c 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 117a059..8331594 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 9c292bf..82a9b89 100644 --- a/libc/test/integration/src/stdlib/getenv_test.cpp +++ b/libc/test/integration/src/stdlib/getenv_test.cpp @@ -28,19 +28,21 @@ static bool my_streq(const char *lhs, const char *rhs) { } TEST_MAIN(int argc, char **argv, char **envp) { - ASSERT_TRUE(my_streq(__llvm_libc::getenv(""), static_cast<char *>(nullptr))); - ASSERT_TRUE(my_streq(__llvm_libc::getenv("="), static_cast<char *>(nullptr))); - ASSERT_TRUE(my_streq(__llvm_libc::getenv("MISSING ENV VARIABLE"), + ASSERT_TRUE( + my_streq(LIBC_NAMESPACE::getenv(""), static_cast<char *>(nullptr))); + ASSERT_TRUE( + my_streq(LIBC_NAMESPACE::getenv("="), static_cast<char *>(nullptr))); + ASSERT_TRUE(my_streq(LIBC_NAMESPACE::getenv("MISSING ENV VARIABLE"), static_cast<char *>(nullptr))); ASSERT_FALSE( - my_streq(__llvm_libc::getenv("PATH"), static_cast<char *>(nullptr))); - ASSERT_TRUE(my_streq(__llvm_libc::getenv("FRANCE"), "Paris")); - ASSERT_FALSE(my_streq(__llvm_libc::getenv("FRANCE"), "Berlin")); - ASSERT_TRUE(my_streq(__llvm_libc::getenv("GERMANY"), "Berlin")); + my_streq(LIBC_NAMESPACE::getenv("PATH"), static_cast<char *>(nullptr))); + ASSERT_TRUE(my_streq(LIBC_NAMESPACE::getenv("FRANCE"), "Paris")); + ASSERT_FALSE(my_streq(LIBC_NAMESPACE::getenv("FRANCE"), "Berlin")); + ASSERT_TRUE(my_streq(LIBC_NAMESPACE::getenv("GERMANY"), "Berlin")); ASSERT_TRUE( - my_streq(__llvm_libc::getenv("FRANC"), static_cast<char *>(nullptr))); - ASSERT_TRUE( - my_streq(__llvm_libc::getenv("FRANCE1"), static_cast<char *>(nullptr))); + my_streq(LIBC_NAMESPACE::getenv("FRANC"), static_cast<char *>(nullptr))); + ASSERT_TRUE(my_streq(LIBC_NAMESPACE::getenv("FRANCE1"), + static_cast<char *>(nullptr))); return 0; } diff --git a/libc/test/integration/src/threads/call_once_test.cpp b/libc/test/integration/src/threads/call_once_test.cpp index a84eca2..efb920d 100644 --- a/libc/test/integration/src/threads/call_once_test.cpp +++ b/libc/test/integration/src/threads/call_once_test.cpp @@ -20,14 +20,14 @@ #include <threads.h> static constexpr unsigned int NUM_THREADS = 5; -static __llvm_libc::cpp::Atomic<unsigned int> thread_count; +static LIBC_NAMESPACE::cpp::Atomic<unsigned int> thread_count; static unsigned int call_count; static void call_once_func() { ++call_count; } static int func(void *) { static once_flag flag = ONCE_FLAG_INIT; - __llvm_libc::call_once(&flag, call_once_func); + LIBC_NAMESPACE::call_once(&flag, call_once_func); thread_count.fetch_add(1); @@ -41,13 +41,13 @@ void call_from_5_threads() { thrd_t threads[NUM_THREADS]; for (unsigned int i = 0; i < NUM_THREADS; ++i) { - ASSERT_EQ(__llvm_libc::thrd_create(threads + i, func, nullptr), + ASSERT_EQ(LIBC_NAMESPACE::thrd_create(threads + i, func, nullptr), static_cast<int>(thrd_success)); } for (unsigned int i = 0; i < NUM_THREADS; ++i) { int retval; - ASSERT_EQ(__llvm_libc::thrd_join(threads[i], &retval), + ASSERT_EQ(LIBC_NAMESPACE::thrd_join(threads[i], &retval), static_cast<int>(thrd_success)); ASSERT_EQ(retval, 0); } @@ -58,16 +58,16 @@ void call_from_5_threads() { static mtx_t once_func_blocker; static void blocking_once_func() { - __llvm_libc::mtx_lock(&once_func_blocker); - __llvm_libc::mtx_unlock(&once_func_blocker); + LIBC_NAMESPACE::mtx_lock(&once_func_blocker); + LIBC_NAMESPACE::mtx_unlock(&once_func_blocker); } -static __llvm_libc::cpp::Atomic<unsigned int> start_count; -static __llvm_libc::cpp::Atomic<unsigned int> done_count; +static LIBC_NAMESPACE::cpp::Atomic<unsigned int> start_count; +static LIBC_NAMESPACE::cpp::Atomic<unsigned int> done_count; static int once_func_caller(void *) { static once_flag flag; start_count.fetch_add(1); - __llvm_libc::call_once(&flag, blocking_once_func); + LIBC_NAMESPACE::call_once(&flag, blocking_once_func); done_count.fetch_add(1); return 0; } @@ -79,16 +79,16 @@ void test_synchronization() { start_count = 0; done_count = 0; - ASSERT_EQ(__llvm_libc::mtx_init(&once_func_blocker, mtx_plain), + ASSERT_EQ(LIBC_NAMESPACE::mtx_init(&once_func_blocker, mtx_plain), static_cast<int>(thrd_success)); // Lock the blocking mutex so that the once func blocks. - ASSERT_EQ(__llvm_libc::mtx_lock(&once_func_blocker), + ASSERT_EQ(LIBC_NAMESPACE::mtx_lock(&once_func_blocker), static_cast<int>(thrd_success)); thrd_t t1, t2; - ASSERT_EQ(__llvm_libc::thrd_create(&t1, once_func_caller, nullptr), + ASSERT_EQ(LIBC_NAMESPACE::thrd_create(&t1, once_func_caller, nullptr), static_cast<int>(thrd_success)); - ASSERT_EQ(__llvm_libc::thrd_create(&t2, once_func_caller, nullptr), + ASSERT_EQ(LIBC_NAMESPACE::thrd_create(&t2, once_func_caller, nullptr), static_cast<int>(thrd_success)); while (start_count.load() != 2) @@ -98,20 +98,20 @@ void test_synchronization() { EXPECT_EQ(done_count.val, 0U); // Unlock the blocking mutex so that the once func blocks. - ASSERT_EQ(__llvm_libc::mtx_unlock(&once_func_blocker), + ASSERT_EQ(LIBC_NAMESPACE::mtx_unlock(&once_func_blocker), static_cast<int>(thrd_success)); int retval; - ASSERT_EQ(__llvm_libc::thrd_join(t1, &retval), + ASSERT_EQ(LIBC_NAMESPACE::thrd_join(t1, &retval), static_cast<int>(thrd_success)); ASSERT_EQ(retval, 0); - ASSERT_EQ(__llvm_libc::thrd_join(t2, &retval), + ASSERT_EQ(LIBC_NAMESPACE::thrd_join(t2, &retval), static_cast<int>(thrd_success)); ASSERT_EQ(retval, 0); ASSERT_EQ(done_count.val, 2U); - __llvm_libc::mtx_destroy(&once_func_blocker); + LIBC_NAMESPACE::mtx_destroy(&once_func_blocker); } TEST_MAIN() { diff --git a/libc/test/integration/src/threads/cnd_test.cpp b/libc/test/integration/src/threads/cnd_test.cpp index ecc04ff..8791c6a 100644 --- a/libc/test/integration/src/threads/cnd_test.cpp +++ b/libc/test/integration/src/threads/cnd_test.cpp @@ -37,56 +37,56 @@ namespace wait_notify_broadcast_test { constexpr unsigned int THRD_COUNT = 1000; -static __llvm_libc::cpp::Atomic<unsigned int> broadcast_count(0); +static LIBC_NAMESPACE::cpp::Atomic<unsigned int> broadcast_count(0); static cnd_t broadcast_cnd, threads_ready_cnd; static mtx_t broadcast_mtx, threads_ready_mtx; int broadcast_thread_func(void *) { - __llvm_libc::mtx_lock(&broadcast_mtx); + LIBC_NAMESPACE::mtx_lock(&broadcast_mtx); unsigned oldval = broadcast_count.fetch_add(1); if (oldval == THRD_COUNT - 1) { - __llvm_libc::mtx_lock(&threads_ready_mtx); - __llvm_libc::cnd_signal(&threads_ready_cnd); - __llvm_libc::mtx_unlock(&threads_ready_mtx); + LIBC_NAMESPACE::mtx_lock(&threads_ready_mtx); + LIBC_NAMESPACE::cnd_signal(&threads_ready_cnd); + LIBC_NAMESPACE::mtx_unlock(&threads_ready_mtx); } - __llvm_libc::cnd_wait(&broadcast_cnd, &broadcast_mtx); - __llvm_libc::mtx_unlock(&broadcast_mtx); + LIBC_NAMESPACE::cnd_wait(&broadcast_cnd, &broadcast_mtx); + LIBC_NAMESPACE::mtx_unlock(&broadcast_mtx); broadcast_count.fetch_sub(1); return 0; } void wait_notify_broadcast_test() { - __llvm_libc::cnd_init(&broadcast_cnd); - __llvm_libc::cnd_init(&threads_ready_cnd); - __llvm_libc::mtx_init(&broadcast_mtx, mtx_plain); - __llvm_libc::mtx_init(&threads_ready_mtx, mtx_plain); + LIBC_NAMESPACE::cnd_init(&broadcast_cnd); + LIBC_NAMESPACE::cnd_init(&threads_ready_cnd); + LIBC_NAMESPACE::mtx_init(&broadcast_mtx, mtx_plain); + LIBC_NAMESPACE::mtx_init(&threads_ready_mtx, mtx_plain); - __llvm_libc::mtx_lock(&threads_ready_mtx); + LIBC_NAMESPACE::mtx_lock(&threads_ready_mtx); thrd_t threads[THRD_COUNT]; for (unsigned int i = 0; i < THRD_COUNT; ++i) - __llvm_libc::thrd_create(&threads[i], broadcast_thread_func, nullptr); + LIBC_NAMESPACE::thrd_create(&threads[i], broadcast_thread_func, nullptr); - __llvm_libc::cnd_wait(&threads_ready_cnd, &threads_ready_mtx); - __llvm_libc::mtx_unlock(&threads_ready_mtx); + LIBC_NAMESPACE::cnd_wait(&threads_ready_cnd, &threads_ready_mtx); + LIBC_NAMESPACE::mtx_unlock(&threads_ready_mtx); - __llvm_libc::mtx_lock(&broadcast_mtx); + LIBC_NAMESPACE::mtx_lock(&broadcast_mtx); ASSERT_EQ(broadcast_count.val, THRD_COUNT); - __llvm_libc::cnd_broadcast(&broadcast_cnd); - __llvm_libc::mtx_unlock(&broadcast_mtx); + LIBC_NAMESPACE::cnd_broadcast(&broadcast_cnd); + LIBC_NAMESPACE::mtx_unlock(&broadcast_mtx); for (unsigned int i = 0; i < THRD_COUNT; ++i) { int retval = 0xBAD; - __llvm_libc::thrd_join(threads[i], &retval); + LIBC_NAMESPACE::thrd_join(threads[i], &retval); ASSERT_EQ(retval, 0); } ASSERT_EQ(broadcast_count.val, 0U); - __llvm_libc::cnd_destroy(&broadcast_cnd); - __llvm_libc::cnd_destroy(&threads_ready_cnd); - __llvm_libc::mtx_destroy(&broadcast_mtx); - __llvm_libc::mtx_destroy(&threads_ready_mtx); + LIBC_NAMESPACE::cnd_destroy(&broadcast_cnd); + LIBC_NAMESPACE::cnd_destroy(&threads_ready_cnd); + LIBC_NAMESPACE::mtx_destroy(&broadcast_mtx); + LIBC_NAMESPACE::mtx_destroy(&threads_ready_mtx); } } // namespace wait_notify_broadcast_test @@ -101,46 +101,47 @@ mtx_t waiter_mtx, main_thread_mtx; cnd_t waiter_cnd, main_thread_cnd; int waiter_thread_func(void *unused) { - __llvm_libc::mtx_lock(&waiter_mtx); + LIBC_NAMESPACE::mtx_lock(&waiter_mtx); - __llvm_libc::mtx_lock(&main_thread_mtx); - __llvm_libc::cnd_signal(&main_thread_cnd); - __llvm_libc::mtx_unlock(&main_thread_mtx); + LIBC_NAMESPACE::mtx_lock(&main_thread_mtx); + LIBC_NAMESPACE::cnd_signal(&main_thread_cnd); + LIBC_NAMESPACE::mtx_unlock(&main_thread_mtx); - __llvm_libc::cnd_wait(&waiter_cnd, &waiter_mtx); - __llvm_libc::mtx_unlock(&waiter_mtx); + LIBC_NAMESPACE::cnd_wait(&waiter_cnd, &waiter_mtx); + LIBC_NAMESPACE::mtx_unlock(&waiter_mtx); return 0x600D; } void single_waiter_test() { - ASSERT_EQ(__llvm_libc::mtx_init(&waiter_mtx, mtx_plain), int(thrd_success)); - ASSERT_EQ(__llvm_libc::mtx_init(&main_thread_mtx, mtx_plain), + ASSERT_EQ(LIBC_NAMESPACE::mtx_init(&waiter_mtx, mtx_plain), int(thrd_success)); - ASSERT_EQ(__llvm_libc::cnd_init(&waiter_cnd), int(thrd_success)); - ASSERT_EQ(__llvm_libc::cnd_init(&main_thread_cnd), int(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::mtx_init(&main_thread_mtx, mtx_plain), + int(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::cnd_init(&waiter_cnd), int(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::cnd_init(&main_thread_cnd), int(thrd_success)); - ASSERT_EQ(__llvm_libc::mtx_lock(&main_thread_mtx), int(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::mtx_lock(&main_thread_mtx), int(thrd_success)); thrd_t waiter_thread; - __llvm_libc::thrd_create(&waiter_thread, waiter_thread_func, nullptr); + LIBC_NAMESPACE::thrd_create(&waiter_thread, waiter_thread_func, nullptr); - ASSERT_EQ(__llvm_libc::cnd_wait(&main_thread_cnd, &main_thread_mtx), + ASSERT_EQ(LIBC_NAMESPACE::cnd_wait(&main_thread_cnd, &main_thread_mtx), int(thrd_success)); - ASSERT_EQ(__llvm_libc::mtx_unlock(&main_thread_mtx), int(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::mtx_unlock(&main_thread_mtx), int(thrd_success)); - ASSERT_EQ(__llvm_libc::mtx_lock(&waiter_mtx), int(thrd_success)); - ASSERT_EQ(__llvm_libc::cnd_signal(&waiter_cnd), int(thrd_success)); - ASSERT_EQ(__llvm_libc::mtx_unlock(&waiter_mtx), int(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::mtx_lock(&waiter_mtx), int(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::cnd_signal(&waiter_cnd), int(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::mtx_unlock(&waiter_mtx), int(thrd_success)); int retval; - __llvm_libc::thrd_join(waiter_thread, &retval); + LIBC_NAMESPACE::thrd_join(waiter_thread, &retval); ASSERT_EQ(retval, 0x600D); - __llvm_libc::mtx_destroy(&waiter_mtx); - __llvm_libc::mtx_destroy(&main_thread_mtx); - __llvm_libc::cnd_destroy(&waiter_cnd); - __llvm_libc::cnd_destroy(&main_thread_cnd); + LIBC_NAMESPACE::mtx_destroy(&waiter_mtx); + LIBC_NAMESPACE::mtx_destroy(&main_thread_mtx); + LIBC_NAMESPACE::cnd_destroy(&waiter_cnd); + LIBC_NAMESPACE::cnd_destroy(&main_thread_cnd); } } // namespace single_waiter_test diff --git a/libc/test/integration/src/threads/mtx_test.cpp b/libc/test/integration/src/threads/mtx_test.cpp index 5887e11..82b0350 100644 --- a/libc/test/integration/src/threads/mtx_test.cpp +++ b/libc/test/integration/src/threads/mtx_test.cpp @@ -26,12 +26,12 @@ static int shared_int = START; int counter(void *arg) { int last_count = START; while (true) { - __llvm_libc::mtx_lock(&mutex); + LIBC_NAMESPACE::mtx_lock(&mutex); if (shared_int == last_count + 1) { shared_int++; last_count = shared_int; } - __llvm_libc::mtx_unlock(&mutex); + LIBC_NAMESPACE::mtx_unlock(&mutex); if (last_count >= MAX) break; } @@ -39,17 +39,17 @@ int counter(void *arg) { } void relay_counter() { - ASSERT_EQ(__llvm_libc::mtx_init(&mutex, mtx_plain), + ASSERT_EQ(LIBC_NAMESPACE::mtx_init(&mutex, mtx_plain), static_cast<int>(thrd_success)); // The idea of this test is that two competing threads will update // a counter only if the other thread has updated it. thrd_t thread; - __llvm_libc::thrd_create(&thread, counter, nullptr); + LIBC_NAMESPACE::thrd_create(&thread, counter, nullptr); int last_count = START; while (true) { - ASSERT_EQ(__llvm_libc::mtx_lock(&mutex), static_cast<int>(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::mtx_lock(&mutex), static_cast<int>(thrd_success)); if (shared_int == START) { ++shared_int; last_count = shared_int; @@ -58,36 +58,37 @@ void relay_counter() { ++shared_int; last_count = shared_int; } - ASSERT_EQ(__llvm_libc::mtx_unlock(&mutex), static_cast<int>(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::mtx_unlock(&mutex), + static_cast<int>(thrd_success)); if (last_count > MAX) break; } int retval = 123; - __llvm_libc::thrd_join(thread, &retval); + LIBC_NAMESPACE::thrd_join(thread, &retval); ASSERT_EQ(retval, 0); - __llvm_libc::mtx_destroy(&mutex); + LIBC_NAMESPACE::mtx_destroy(&mutex); } mtx_t start_lock, step_lock; bool started, step; int stepper(void *arg) { - __llvm_libc::mtx_lock(&start_lock); + LIBC_NAMESPACE::mtx_lock(&start_lock); started = true; - __llvm_libc::mtx_unlock(&start_lock); + LIBC_NAMESPACE::mtx_unlock(&start_lock); - __llvm_libc::mtx_lock(&step_lock); + LIBC_NAMESPACE::mtx_lock(&step_lock); step = true; - __llvm_libc::mtx_unlock(&step_lock); + LIBC_NAMESPACE::mtx_unlock(&step_lock); return 0; } void wait_and_step() { - ASSERT_EQ(__llvm_libc::mtx_init(&start_lock, mtx_plain), + ASSERT_EQ(LIBC_NAMESPACE::mtx_init(&start_lock, mtx_plain), static_cast<int>(thrd_success)); - ASSERT_EQ(__llvm_libc::mtx_init(&step_lock, mtx_plain), + ASSERT_EQ(LIBC_NAMESPACE::mtx_init(&step_lock, mtx_plain), static_cast<int>(thrd_success)); // In this test, we start a new thread but block it before it can make a @@ -95,17 +96,18 @@ void wait_and_step() { // After unblocking, we then verify that the thread was indeed unblocked. step = false; started = false; - ASSERT_EQ(__llvm_libc::mtx_lock(&step_lock), static_cast<int>(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::mtx_lock(&step_lock), + static_cast<int>(thrd_success)); thrd_t thread; - __llvm_libc::thrd_create(&thread, stepper, nullptr); + LIBC_NAMESPACE::thrd_create(&thread, stepper, nullptr); while (true) { // Make sure the thread actually started. - ASSERT_EQ(__llvm_libc::mtx_lock(&start_lock), + ASSERT_EQ(LIBC_NAMESPACE::mtx_lock(&start_lock), static_cast<int>(thrd_success)); bool s = started; - ASSERT_EQ(__llvm_libc::mtx_unlock(&start_lock), + ASSERT_EQ(LIBC_NAMESPACE::mtx_unlock(&start_lock), static_cast<int>(thrd_success)); if (s) break; @@ -115,25 +117,25 @@ void wait_and_step() { ASSERT_FALSE(step); // Unlock the step lock and wait until the step is made. - ASSERT_EQ(__llvm_libc::mtx_unlock(&step_lock), + ASSERT_EQ(LIBC_NAMESPACE::mtx_unlock(&step_lock), static_cast<int>(thrd_success)); while (true) { - ASSERT_EQ(__llvm_libc::mtx_lock(&step_lock), + ASSERT_EQ(LIBC_NAMESPACE::mtx_lock(&step_lock), static_cast<int>(thrd_success)); bool current_step_value = step; - ASSERT_EQ(__llvm_libc::mtx_unlock(&step_lock), + ASSERT_EQ(LIBC_NAMESPACE::mtx_unlock(&step_lock), static_cast<int>(thrd_success)); if (current_step_value) break; } int retval = 123; - __llvm_libc::thrd_join(thread, &retval); + LIBC_NAMESPACE::thrd_join(thread, &retval); ASSERT_EQ(retval, 0); - __llvm_libc::mtx_destroy(&start_lock); - __llvm_libc::mtx_destroy(&step_lock); + LIBC_NAMESPACE::mtx_destroy(&start_lock); + LIBC_NAMESPACE::mtx_destroy(&step_lock); } static constexpr int THREAD_COUNT = 10; @@ -142,54 +144,54 @@ static mtx_t counter_lock; static int wait_count = 0; int waiter_func(void *) { - __llvm_libc::mtx_lock(&counter_lock); + LIBC_NAMESPACE::mtx_lock(&counter_lock); ++wait_count; - __llvm_libc::mtx_unlock(&counter_lock); + LIBC_NAMESPACE::mtx_unlock(&counter_lock); // Block on the waiter lock until the main // thread unblocks. - __llvm_libc::mtx_lock(&multiple_waiter_lock); - __llvm_libc::mtx_unlock(&multiple_waiter_lock); + LIBC_NAMESPACE::mtx_lock(&multiple_waiter_lock); + LIBC_NAMESPACE::mtx_unlock(&multiple_waiter_lock); - __llvm_libc::mtx_lock(&counter_lock); + LIBC_NAMESPACE::mtx_lock(&counter_lock); --wait_count; - __llvm_libc::mtx_unlock(&counter_lock); + LIBC_NAMESPACE::mtx_unlock(&counter_lock); return 0; } void multiple_waiters() { - __llvm_libc::mtx_init(&multiple_waiter_lock, mtx_plain); - __llvm_libc::mtx_init(&counter_lock, mtx_plain); + LIBC_NAMESPACE::mtx_init(&multiple_waiter_lock, mtx_plain); + LIBC_NAMESPACE::mtx_init(&counter_lock, mtx_plain); - __llvm_libc::mtx_lock(&multiple_waiter_lock); + LIBC_NAMESPACE::mtx_lock(&multiple_waiter_lock); thrd_t waiters[THREAD_COUNT]; for (int i = 0; i < THREAD_COUNT; ++i) { - __llvm_libc::thrd_create(waiters + i, waiter_func, nullptr); + LIBC_NAMESPACE::thrd_create(waiters + i, waiter_func, nullptr); } // Spin until the counter is incremented to the desired // value. while (true) { - __llvm_libc::mtx_lock(&counter_lock); + LIBC_NAMESPACE::mtx_lock(&counter_lock); if (wait_count == THREAD_COUNT) { - __llvm_libc::mtx_unlock(&counter_lock); + LIBC_NAMESPACE::mtx_unlock(&counter_lock); break; } - __llvm_libc::mtx_unlock(&counter_lock); + LIBC_NAMESPACE::mtx_unlock(&counter_lock); } - __llvm_libc::mtx_unlock(&multiple_waiter_lock); + LIBC_NAMESPACE::mtx_unlock(&multiple_waiter_lock); int retval; for (int i = 0; i < THREAD_COUNT; ++i) { - __llvm_libc::thrd_join(waiters[i], &retval); + LIBC_NAMESPACE::thrd_join(waiters[i], &retval); } ASSERT_EQ(wait_count, 0); - __llvm_libc::mtx_destroy(&multiple_waiter_lock); - __llvm_libc::mtx_destroy(&counter_lock); + LIBC_NAMESPACE::mtx_destroy(&multiple_waiter_lock); + LIBC_NAMESPACE::mtx_destroy(&counter_lock); } TEST_MAIN() { diff --git a/libc/test/integration/src/threads/thrd_equal_test.cpp b/libc/test/integration/src/threads/thrd_equal_test.cpp index 8b4a00d..4f8866f 100644 --- a/libc/test/integration/src/threads/thrd_equal_test.cpp +++ b/libc/test/integration/src/threads/thrd_equal_test.cpp @@ -23,21 +23,21 @@ thrd_t child_thread; mtx_t mutex; static int child_func(void *arg) { - __llvm_libc::mtx_lock(&mutex); + LIBC_NAMESPACE::mtx_lock(&mutex); int *ret = reinterpret_cast<int *>(arg); - auto self = __llvm_libc::thrd_current(); - *ret = __llvm_libc::thrd_equal(child_thread, self); - __llvm_libc::mtx_unlock(&mutex); + auto self = LIBC_NAMESPACE::thrd_current(); + *ret = LIBC_NAMESPACE::thrd_equal(child_thread, self); + LIBC_NAMESPACE::mtx_unlock(&mutex); return 0; } TEST_MAIN() { // We init and lock the mutex so that we guarantee that the child thread is // waiting after startup. - ASSERT_EQ(__llvm_libc::mtx_init(&mutex, mtx_plain), int(thrd_success)); - ASSERT_EQ(__llvm_libc::mtx_lock(&mutex), int(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::mtx_init(&mutex, mtx_plain), int(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::mtx_lock(&mutex), int(thrd_success)); - auto main_thread = __llvm_libc::thrd_current(); + auto main_thread = LIBC_NAMESPACE::thrd_current(); // The idea here is that, we start a child thread which will immediately // wait on |mutex|. The main thread will update the global |child_thread| var @@ -46,23 +46,23 @@ TEST_MAIN() { // comparison is returned in the thread arg. int result = 0; thrd_t th; - ASSERT_EQ(__llvm_libc::thrd_create(&th, child_func, &result), + ASSERT_EQ(LIBC_NAMESPACE::thrd_create(&th, child_func, &result), int(thrd_success)); // This new thread should of course not be equal to the main thread. - ASSERT_EQ(__llvm_libc::thrd_equal(th, main_thread), 0); + ASSERT_EQ(LIBC_NAMESPACE::thrd_equal(th, main_thread), 0); // Set the |child_thread| global var and unlock to allow the child to perform // the comparison. child_thread = th; - ASSERT_EQ(__llvm_libc::mtx_unlock(&mutex), int(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::mtx_unlock(&mutex), int(thrd_success)); int retval; - ASSERT_EQ(__llvm_libc::thrd_join(th, &retval), int(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::thrd_join(th, &retval), int(thrd_success)); ASSERT_EQ(retval, 0); // The child thread should see that thrd_current return value is the same as // |child_thread|. ASSERT_NE(result, 0); - __llvm_libc::mtx_destroy(&mutex); + LIBC_NAMESPACE::mtx_destroy(&mutex); return 0; } diff --git a/libc/test/integration/src/threads/thrd_exit_test.cpp b/libc/test/integration/src/threads/thrd_exit_test.cpp index 6e7baa9..0939a762 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 33d230c..5872836 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 df0954d..c1c91c8 100644 --- a/libc/test/integration/src/threads/tss_test.cpp +++ b/libc/test/integration/src/threads/tss_test.cpp @@ -31,8 +31,8 @@ void dtor(void *data) { } int func(void *obj) { - ASSERT_EQ(__llvm_libc::tss_set(key, &child_thread_data), thrd_success); - int *d = reinterpret_cast<int *>(__llvm_libc::tss_get(key)); + ASSERT_EQ(LIBC_NAMESPACE::tss_set(key, &child_thread_data), thrd_success); + int *d = reinterpret_cast<int *>(LIBC_NAMESPACE::tss_get(key)); ASSERT_TRUE(d != nullptr); ASSERT_EQ(&child_thread_data, d); ASSERT_EQ(*d, THREAD_DATA_INITVAL); @@ -41,23 +41,23 @@ int func(void *obj) { } TEST_MAIN() { - ASSERT_EQ(__llvm_libc::tss_create(&key, &dtor), thrd_success); - ASSERT_EQ(__llvm_libc::tss_set(key, &main_thread_data), thrd_success); - int *d = reinterpret_cast<int *>(__llvm_libc::tss_get(key)); + ASSERT_EQ(LIBC_NAMESPACE::tss_create(&key, &dtor), thrd_success); + ASSERT_EQ(LIBC_NAMESPACE::tss_set(key, &main_thread_data), thrd_success); + int *d = reinterpret_cast<int *>(LIBC_NAMESPACE::tss_get(key)); ASSERT_TRUE(d != nullptr); ASSERT_EQ(&main_thread_data, d); ASSERT_EQ(*d, THREAD_DATA_INITVAL); thrd_t th; int arg = 0xBAD; - ASSERT_EQ(__llvm_libc::thrd_create(&th, &func, &arg), thrd_success); + ASSERT_EQ(LIBC_NAMESPACE::thrd_create(&th, &func, &arg), thrd_success); int retval = THREAD_DATA_INITVAL; // Init to some non-zero val. - ASSERT_EQ(__llvm_libc::thrd_join(th, &retval), thrd_success); + ASSERT_EQ(LIBC_NAMESPACE::thrd_join(th, &retval), thrd_success); ASSERT_EQ(retval, 0); ASSERT_EQ(arg, THREAD_RUN_VAL); ASSERT_EQ(child_thread_data, THREAD_DATA_FINIVAL); - __llvm_libc::tss_delete(key); + LIBC_NAMESPACE::tss_delete(key); return 0; } diff --git a/libc/test/integration/src/unistd/execv_test.cpp b/libc/test/integration/src/unistd/execv_test.cpp index 4a39690..254ef95 100644 --- a/libc/test/integration/src/unistd/execv_test.cpp +++ b/libc/test/integration/src/unistd/execv_test.cpp @@ -16,36 +16,36 @@ #include <sys/wait.h> void fork_and_execv_normal_exit() { - pid_t pid = __llvm_libc::fork(); + pid_t pid = LIBC_NAMESPACE::fork(); if (pid == 0) { const char *path = "libc_execv_test_normal_exit"; char *const argv[] = { const_cast<char *>("execv_test_normal_exit"), nullptr, }; - __llvm_libc::execv(path, argv); + LIBC_NAMESPACE::execv(path, argv); } ASSERT_TRUE(pid > 0); int status; - pid_t cpid = __llvm_libc::waitpid(pid, &status, 0); + pid_t cpid = LIBC_NAMESPACE::waitpid(pid, &status, 0); ASSERT_TRUE(cpid > 0); ASSERT_EQ(cpid, pid); ASSERT_TRUE(WIFEXITED(status)); } void fork_and_execv_signal_exit() { - pid_t pid = __llvm_libc::fork(); + pid_t pid = LIBC_NAMESPACE::fork(); if (pid == 0) { const char *path = "libc_execv_test_signal_exit"; char *const argv[] = { const_cast<char *>("execv_test_normal_exit"), nullptr, }; - __llvm_libc::execv(path, argv); + LIBC_NAMESPACE::execv(path, argv); } ASSERT_TRUE(pid > 0); int status; - pid_t cpid = __llvm_libc::waitpid(pid, &status, 0); + pid_t cpid = LIBC_NAMESPACE::waitpid(pid, &status, 0); ASSERT_TRUE(cpid > 0); ASSERT_EQ(cpid, pid); ASSERT_FALSE(WIFEXITED(status)); diff --git a/libc/test/integration/src/unistd/execve_test.cpp b/libc/test/integration/src/unistd/execve_test.cpp index 409fec7..fb1a83d 100644 --- a/libc/test/integration/src/unistd/execve_test.cpp +++ b/libc/test/integration/src/unistd/execve_test.cpp @@ -16,36 +16,36 @@ #include <sys/wait.h> void fork_and_execv_normal_exit(char **envp) { - pid_t pid = __llvm_libc::fork(); + pid_t pid = LIBC_NAMESPACE::fork(); if (pid == 0) { const char *path = "libc_execv_test_normal_exit"; char *const argv[] = { const_cast<char *>("execv_test_normal_exit"), nullptr, }; - __llvm_libc::execve(path, argv, envp); + LIBC_NAMESPACE::execve(path, argv, envp); } ASSERT_TRUE(pid > 0); int status; - pid_t cpid = __llvm_libc::waitpid(pid, &status, 0); + pid_t cpid = LIBC_NAMESPACE::waitpid(pid, &status, 0); ASSERT_TRUE(cpid > 0); ASSERT_EQ(cpid, pid); ASSERT_TRUE(WIFEXITED(status)); } void fork_and_execv_signal_exit(char **envp) { - pid_t pid = __llvm_libc::fork(); + pid_t pid = LIBC_NAMESPACE::fork(); if (pid == 0) { const char *path = "libc_execv_test_signal_exit"; char *const argv[] = { const_cast<char *>("execv_test_normal_exit"), nullptr, }; - __llvm_libc::execve(path, argv, envp); + LIBC_NAMESPACE::execve(path, argv, envp); } ASSERT_TRUE(pid > 0); int status; - pid_t cpid = __llvm_libc::waitpid(pid, &status, 0); + pid_t cpid = LIBC_NAMESPACE::waitpid(pid, &status, 0); ASSERT_TRUE(cpid > 0); ASSERT_EQ(cpid, pid); ASSERT_FALSE(WIFEXITED(status)); diff --git a/libc/test/integration/src/unistd/fork_test.cpp b/libc/test/integration/src/unistd/fork_test.cpp index 1679862..9c9213e 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 3214ebf..3d8f582 100644 --- a/libc/test/integration/src/unistd/getcwd_test.cpp +++ b/libc/test/integration/src/unistd/getcwd_test.cpp @@ -15,26 +15,26 @@ #include <stdlib.h> // For malloc and free -using __llvm_libc::cpp::string_view; +using LIBC_NAMESPACE::cpp::string_view; TEST_MAIN(int argc, char **argv, char **envp) { char buffer[1024]; - ASSERT_TRUE(string_view(__llvm_libc::getenv("PWD")) == - __llvm_libc::getcwd(buffer, 1024)); + ASSERT_TRUE(string_view(LIBC_NAMESPACE::getenv("PWD")) == + LIBC_NAMESPACE::getcwd(buffer, 1024)); // nullptr buffer - char *cwd = __llvm_libc::getcwd(nullptr, 0); - ASSERT_TRUE(string_view(__llvm_libc::getenv("PWD")) == cwd); + char *cwd = LIBC_NAMESPACE::getcwd(nullptr, 0); + ASSERT_TRUE(string_view(LIBC_NAMESPACE::getenv("PWD")) == cwd); free(cwd); // Bad size - cwd = __llvm_libc::getcwd(buffer, 0); + cwd = LIBC_NAMESPACE::getcwd(buffer, 0); ASSERT_TRUE(cwd == nullptr); ASSERT_EQ(libc_errno, EINVAL); libc_errno = 0; // Insufficient size - cwd = __llvm_libc::getcwd(buffer, 2); + cwd = LIBC_NAMESPACE::getcwd(buffer, 2); ASSERT_TRUE(cwd == nullptr); int err = libc_errno; ASSERT_EQ(err, ERANGE); diff --git a/libc/test/integration/startup/gpu/rpc_interface_test.cpp b/libc/test/integration/startup/gpu/rpc_interface_test.cpp index 3aa1346..674e2cc 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 afde3dd..09a4ae6 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 75e9574..4032d89 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 d8315af..5f235a9 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 16408f7..5b105c8 100644 --- a/libc/test/src/__support/CPP/atomic_test.cpp +++ b/libc/test/src/__support/CPP/atomic_test.cpp @@ -13,22 +13,22 @@ // threads, at which point it becomes a chicken and egg problem. TEST(LlvmLibcAtomicTest, LoadStore) { - __llvm_libc::cpp::Atomic<int> aint(123); - ASSERT_EQ(aint.load(__llvm_libc::cpp::MemoryOrder::RELAXED), 123); + LIBC_NAMESPACE::cpp::Atomic<int> aint(123); + ASSERT_EQ(aint.load(LIBC_NAMESPACE::cpp::MemoryOrder::RELAXED), 123); - aint.store(100, __llvm_libc::cpp::MemoryOrder::RELAXED); - ASSERT_EQ(aint.load(__llvm_libc::cpp::MemoryOrder::RELAXED), 100); + aint.store(100, LIBC_NAMESPACE::cpp::MemoryOrder::RELAXED); + ASSERT_EQ(aint.load(LIBC_NAMESPACE::cpp::MemoryOrder::RELAXED), 100); aint = 1234; // Equivalent of store - ASSERT_EQ(aint.load(__llvm_libc::cpp::MemoryOrder::RELAXED), 1234); + ASSERT_EQ(aint.load(LIBC_NAMESPACE::cpp::MemoryOrder::RELAXED), 1234); } TEST(LlvmLibcAtomicTest, CompareExchangeStrong) { int desired = 123; - __llvm_libc::cpp::Atomic<int> aint(desired); + LIBC_NAMESPACE::cpp::Atomic<int> aint(desired); ASSERT_TRUE(aint.compare_exchange_strong(desired, 100)); - ASSERT_EQ(aint.load(__llvm_libc::cpp::MemoryOrder::RELAXED), 100); + ASSERT_EQ(aint.load(LIBC_NAMESPACE::cpp::MemoryOrder::RELAXED), 100); ASSERT_FALSE(aint.compare_exchange_strong(desired, 100)); - ASSERT_EQ(aint.load(__llvm_libc::cpp::MemoryOrder::RELAXED), 100); + ASSERT_EQ(aint.load(LIBC_NAMESPACE::cpp::MemoryOrder::RELAXED), 100); } diff --git a/libc/test/src/__support/CPP/bitset_test.cpp b/libc/test/src/__support/CPP/bitset_test.cpp index 9983cfc..f1d4e4c 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 ffae423..8337081 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 1d040e6..fe37852 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 fea428e..12641b7 100644 --- a/libc/test/src/__support/CPP/limits_test.cpp +++ b/libc/test/src/__support/CPP/limits_test.cpp @@ -10,7 +10,7 @@ #include "src/__support/UInt.h" #include "test/UnitTest/Test.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // This just checks against the C spec, almost all implementations will surpass // this. @@ -32,14 +32,14 @@ TEST(LlvmLibcLimitsTest, LimitsFollowSpec) { } TEST(LlvmLibcLimitsTest, UInt128Limits) { - auto umax128 = cpp::numeric_limits<__llvm_libc::cpp::UInt<128>>::max(); + auto umax128 = cpp::numeric_limits<LIBC_NAMESPACE::cpp::UInt<128>>::max(); auto umax64 = - __llvm_libc::cpp::UInt<128>(cpp::numeric_limits<uint64_t>::max()); + LIBC_NAMESPACE::cpp::UInt<128>(cpp::numeric_limits<uint64_t>::max()); EXPECT_GT(umax128, umax64); - ASSERT_EQ(~__llvm_libc::cpp::UInt<128>(0), umax128); + ASSERT_EQ(~LIBC_NAMESPACE::cpp::UInt<128>(0), umax128); #ifdef __SIZEOF_INT128__ ASSERT_EQ(~__uint128_t(0), cpp::numeric_limits<__uint128_t>::max()); #endif } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/src/__support/CPP/optional_test.cpp b/libc/test/src/__support/CPP/optional_test.cpp index c59175d..f9254d4 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 4476f4e..6da06c3 100644 --- a/libc/test/src/__support/CPP/span_test.cpp +++ b/libc/test/src/__support/CPP/span_test.cpp @@ -10,8 +10,8 @@ #include "src/__support/CPP/span.h" #include "test/UnitTest/Test.h" -using __llvm_libc::cpp::array; -using __llvm_libc::cpp::span; +using LIBC_NAMESPACE::cpp::array; +using LIBC_NAMESPACE::cpp::span; TEST(LlvmLibcSpanTest, InitializeEmpty) { span<int> s; diff --git a/libc/test/src/__support/CPP/string_test.cpp b/libc/test/src/__support/CPP/string_test.cpp index 928277f..e606ab1 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 c6bfd77..e285fc5 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 59a0d39..33eb8ab 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 4e1eb41..0e5f4a1 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 b1ef711..8fafa76 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 f910eb1..916523e 100644 --- a/libc/test/src/__support/FPUtil/fpbits_test.cpp +++ b/libc/test/src/__support/FPUtil/fpbits_test.cpp @@ -10,14 +10,15 @@ #include "src/__support/FPUtil/fpbits_str.h" #include "test/UnitTest/Test.h" -using __llvm_libc::fputil::FPBits; +using LIBC_NAMESPACE::fputil::FPBits; TEST(LlvmLibcFPBitsTest, FloatType) { - EXPECT_STREQ(__llvm_libc::str(FPBits<float>::inf()).c_str(), "(+Infinity)"); - EXPECT_STREQ(__llvm_libc::str(FPBits<float>::neg_inf()).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits<float>::inf()).c_str(), + "(+Infinity)"); + EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits<float>::neg_inf()).c_str(), "(-Infinity)"); EXPECT_STREQ( - __llvm_libc::str(FPBits<float>(FPBits<float>::build_nan(1))).c_str(), + LIBC_NAMESPACE::str(FPBits<float>(FPBits<float>::build_nan(1))).c_str(), "(NaN)"); FPBits<float> zero(0.0f); @@ -25,7 +26,7 @@ TEST(LlvmLibcFPBitsTest, FloatType) { EXPECT_EQ(zero.get_unbiased_exponent(), static_cast<uint16_t>(0)); EXPECT_EQ(zero.get_mantissa(), static_cast<uint32_t>(0)); EXPECT_EQ(zero.uintval(), static_cast<uint32_t>(0x00000000)); - EXPECT_STREQ(__llvm_libc::str(zero).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(zero).c_str(), "0x00000000 = (S: 0, E: 0x0000, M: 0x00000000)"); FPBits<float> negzero(-0.0f); @@ -33,7 +34,7 @@ TEST(LlvmLibcFPBitsTest, FloatType) { EXPECT_EQ(negzero.get_unbiased_exponent(), static_cast<uint16_t>(0)); EXPECT_EQ(negzero.get_mantissa(), static_cast<uint32_t>(0)); EXPECT_EQ(negzero.uintval(), static_cast<uint32_t>(0x80000000)); - EXPECT_STREQ(__llvm_libc::str(negzero).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(negzero).c_str(), "0x80000000 = (S: 1, E: 0x0000, M: 0x00000000)"); FPBits<float> one(1.0f); @@ -41,7 +42,7 @@ TEST(LlvmLibcFPBitsTest, FloatType) { EXPECT_EQ(one.get_unbiased_exponent(), static_cast<uint16_t>(0x7F)); EXPECT_EQ(one.get_mantissa(), static_cast<uint32_t>(0)); EXPECT_EQ(one.uintval(), static_cast<uint32_t>(0x3F800000)); - EXPECT_STREQ(__llvm_libc::str(one).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(one).c_str(), "0x3F800000 = (S: 0, E: 0x007F, M: 0x00000000)"); FPBits<float> negone(-1.0f); @@ -49,7 +50,7 @@ TEST(LlvmLibcFPBitsTest, FloatType) { EXPECT_EQ(negone.get_unbiased_exponent(), static_cast<uint16_t>(0x7F)); EXPECT_EQ(negone.get_mantissa(), static_cast<uint32_t>(0)); EXPECT_EQ(negone.uintval(), static_cast<uint32_t>(0xBF800000)); - EXPECT_STREQ(__llvm_libc::str(negone).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(negone).c_str(), "0xBF800000 = (S: 1, E: 0x007F, M: 0x00000000)"); FPBits<float> num(1.125f); @@ -57,7 +58,7 @@ TEST(LlvmLibcFPBitsTest, FloatType) { EXPECT_EQ(num.get_unbiased_exponent(), static_cast<uint16_t>(0x7F)); EXPECT_EQ(num.get_mantissa(), static_cast<uint32_t>(0x00100000)); EXPECT_EQ(num.uintval(), static_cast<uint32_t>(0x3F900000)); - EXPECT_STREQ(__llvm_libc::str(num).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(num).c_str(), "0x3F900000 = (S: 0, E: 0x007F, M: 0x00100000)"); FPBits<float> negnum(-1.125f); @@ -65,16 +66,17 @@ TEST(LlvmLibcFPBitsTest, FloatType) { EXPECT_EQ(negnum.get_unbiased_exponent(), static_cast<uint16_t>(0x7F)); EXPECT_EQ(negnum.get_mantissa(), static_cast<uint32_t>(0x00100000)); EXPECT_EQ(negnum.uintval(), static_cast<uint32_t>(0xBF900000)); - EXPECT_STREQ(__llvm_libc::str(negnum).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(negnum).c_str(), "0xBF900000 = (S: 1, E: 0x007F, M: 0x00100000)"); } TEST(LlvmLibcFPBitsTest, DoubleType) { - EXPECT_STREQ(__llvm_libc::str(FPBits<double>::inf()).c_str(), "(+Infinity)"); - EXPECT_STREQ(__llvm_libc::str(FPBits<double>::neg_inf()).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits<double>::inf()).c_str(), + "(+Infinity)"); + EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits<double>::neg_inf()).c_str(), "(-Infinity)"); EXPECT_STREQ( - __llvm_libc::str(FPBits<double>(FPBits<double>::build_nan(1))).c_str(), + LIBC_NAMESPACE::str(FPBits<double>(FPBits<double>::build_nan(1))).c_str(), "(NaN)"); FPBits<double> zero(0.0); @@ -82,7 +84,7 @@ TEST(LlvmLibcFPBitsTest, DoubleType) { EXPECT_EQ(zero.get_unbiased_exponent(), static_cast<uint16_t>(0x0000)); EXPECT_EQ(zero.get_mantissa(), static_cast<uint64_t>(0x0000000000000000)); EXPECT_EQ(zero.uintval(), static_cast<uint64_t>(0x0000000000000000)); - EXPECT_STREQ(__llvm_libc::str(zero).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(zero).c_str(), "0x0000000000000000 = (S: 0, E: 0x0000, M: 0x0000000000000000)"); FPBits<double> negzero(-0.0); @@ -90,7 +92,7 @@ TEST(LlvmLibcFPBitsTest, DoubleType) { EXPECT_EQ(negzero.get_unbiased_exponent(), static_cast<uint16_t>(0x0000)); EXPECT_EQ(negzero.get_mantissa(), static_cast<uint64_t>(0x0000000000000000)); EXPECT_EQ(negzero.uintval(), static_cast<uint64_t>(0x8000000000000000)); - EXPECT_STREQ(__llvm_libc::str(negzero).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(negzero).c_str(), "0x8000000000000000 = (S: 1, E: 0x0000, M: 0x0000000000000000)"); FPBits<double> one(1.0); @@ -98,7 +100,7 @@ TEST(LlvmLibcFPBitsTest, DoubleType) { EXPECT_EQ(one.get_unbiased_exponent(), static_cast<uint16_t>(0x03FF)); EXPECT_EQ(one.get_mantissa(), static_cast<uint64_t>(0x0000000000000000)); EXPECT_EQ(one.uintval(), static_cast<uint64_t>(0x3FF0000000000000)); - EXPECT_STREQ(__llvm_libc::str(one).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(one).c_str(), "0x3FF0000000000000 = (S: 0, E: 0x03FF, M: 0x0000000000000000)"); FPBits<double> negone(-1.0); @@ -106,7 +108,7 @@ TEST(LlvmLibcFPBitsTest, DoubleType) { EXPECT_EQ(negone.get_unbiased_exponent(), static_cast<uint16_t>(0x03FF)); EXPECT_EQ(negone.get_mantissa(), static_cast<uint64_t>(0x0000000000000000)); EXPECT_EQ(negone.uintval(), static_cast<uint64_t>(0xBFF0000000000000)); - EXPECT_STREQ(__llvm_libc::str(negone).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(negone).c_str(), "0xBFF0000000000000 = (S: 1, E: 0x03FF, M: 0x0000000000000000)"); FPBits<double> num(1.125); @@ -114,7 +116,7 @@ TEST(LlvmLibcFPBitsTest, DoubleType) { EXPECT_EQ(num.get_unbiased_exponent(), static_cast<uint16_t>(0x03FF)); EXPECT_EQ(num.get_mantissa(), static_cast<uint64_t>(0x0002000000000000)); EXPECT_EQ(num.uintval(), static_cast<uint64_t>(0x3FF2000000000000)); - EXPECT_STREQ(__llvm_libc::str(num).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(num).c_str(), "0x3FF2000000000000 = (S: 0, E: 0x03FF, M: 0x0002000000000000)"); FPBits<double> negnum(-1.125); @@ -122,7 +124,7 @@ TEST(LlvmLibcFPBitsTest, DoubleType) { EXPECT_EQ(negnum.get_unbiased_exponent(), static_cast<uint16_t>(0x03FF)); EXPECT_EQ(negnum.get_mantissa(), static_cast<uint64_t>(0x0002000000000000)); EXPECT_EQ(negnum.uintval(), static_cast<uint64_t>(0xBFF2000000000000)); - EXPECT_STREQ(__llvm_libc::str(negnum).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(negnum).c_str(), "0xBFF2000000000000 = (S: 1, E: 0x03FF, M: 0x0002000000000000)"); } @@ -131,14 +133,14 @@ TEST(LlvmLibcFPBitsTest, X86LongDoubleType) { if constexpr (sizeof(long double) == sizeof(double)) return; // The tests for the "double" type cover for this case. - EXPECT_STREQ(__llvm_libc::str(FPBits<long double>::inf()).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits<long double>::inf()).c_str(), "(+Infinity)"); - EXPECT_STREQ(__llvm_libc::str(FPBits<long double>::neg_inf()).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits<long double>::neg_inf()).c_str(), "(-Infinity)"); - EXPECT_STREQ( - __llvm_libc::str(FPBits<long double>(FPBits<long double>::build_nan(1))) - .c_str(), - "(NaN)"); + EXPECT_STREQ(LIBC_NAMESPACE::str( + FPBits<long double>(FPBits<long double>::build_nan(1))) + .c_str(), + "(NaN)"); FPBits<long double> zero(0.0l); EXPECT_EQ(zero.get_sign(), false); @@ -147,7 +149,7 @@ TEST(LlvmLibcFPBitsTest, X86LongDoubleType) { << 64); EXPECT_EQ(zero.uintval(), static_cast<UInt128>(0x0000000000000000) << 64); EXPECT_STREQ( - __llvm_libc::str(zero).c_str(), + LIBC_NAMESPACE::str(zero).c_str(), "0x00000000000000000000000000000000 = " "(S: 0, E: 0x0000, I: 0, M: 0x00000000000000000000000000000000)"); @@ -158,7 +160,7 @@ TEST(LlvmLibcFPBitsTest, X86LongDoubleType) { << 64); EXPECT_EQ(negzero.uintval(), static_cast<UInt128>(0x1) << 79); EXPECT_STREQ( - __llvm_libc::str(negzero).c_str(), + LIBC_NAMESPACE::str(negzero).c_str(), "0x00000000000080000000000000000000 = " "(S: 1, E: 0x0000, I: 0, M: 0x00000000000000000000000000000000)"); @@ -168,7 +170,7 @@ TEST(LlvmLibcFPBitsTest, X86LongDoubleType) { EXPECT_EQ(one.get_mantissa(), static_cast<UInt128>(0x0000000000000000) << 64); EXPECT_EQ(one.uintval(), static_cast<UInt128>(0x3FFF8) << 60); EXPECT_STREQ( - __llvm_libc::str(one).c_str(), + LIBC_NAMESPACE::str(one).c_str(), "0x0000000000003FFF8000000000000000 = " "(S: 0, E: 0x3FFF, I: 1, M: 0x00000000000000000000000000000000)"); @@ -179,7 +181,7 @@ TEST(LlvmLibcFPBitsTest, X86LongDoubleType) { << 64); EXPECT_EQ(negone.uintval(), static_cast<UInt128>(0xBFFF8) << 60); EXPECT_STREQ( - __llvm_libc::str(negone).c_str(), + LIBC_NAMESPACE::str(negone).c_str(), "0x000000000000BFFF8000000000000000 = " "(S: 1, E: 0x3FFF, I: 1, M: 0x00000000000000000000000000000000)"); @@ -189,7 +191,7 @@ TEST(LlvmLibcFPBitsTest, X86LongDoubleType) { EXPECT_EQ(num.get_mantissa(), static_cast<UInt128>(0x1) << 60); EXPECT_EQ(num.uintval(), static_cast<UInt128>(0x3FFF9) << 60); EXPECT_STREQ( - __llvm_libc::str(num).c_str(), + LIBC_NAMESPACE::str(num).c_str(), "0x0000000000003FFF9000000000000000 = " "(S: 0, E: 0x3FFF, I: 1, M: 0x00000000000000001000000000000000)"); @@ -199,7 +201,7 @@ TEST(LlvmLibcFPBitsTest, X86LongDoubleType) { EXPECT_EQ(negnum.get_mantissa(), static_cast<UInt128>(0x1) << 60); EXPECT_EQ(negnum.uintval(), static_cast<UInt128>(0xBFFF9) << 60); EXPECT_STREQ( - __llvm_libc::str(negnum).c_str(), + LIBC_NAMESPACE::str(negnum).c_str(), "0x000000000000BFFF9000000000000000 = " "(S: 1, E: 0x3FFF, I: 1, M: 0x00000000000000001000000000000000)"); } @@ -208,14 +210,14 @@ TEST(LlvmLibcFPBitsTest, LongDoubleType) { #if defined(LONG_DOUBLE_IS_DOUBLE) return; // The tests for the "double" type cover for this case. #else - EXPECT_STREQ(__llvm_libc::str(FPBits<long double>::inf()).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits<long double>::inf()).c_str(), "(+Infinity)"); - EXPECT_STREQ(__llvm_libc::str(FPBits<long double>::neg_inf()).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits<long double>::neg_inf()).c_str(), "(-Infinity)"); - EXPECT_STREQ( - __llvm_libc::str(FPBits<long double>(FPBits<long double>::build_nan(1))) - .c_str(), - "(NaN)"); + EXPECT_STREQ(LIBC_NAMESPACE::str( + FPBits<long double>(FPBits<long double>::build_nan(1))) + .c_str(), + "(NaN)"); FPBits<long double> zero(0.0l); EXPECT_EQ(zero.get_sign(), false); @@ -223,7 +225,7 @@ TEST(LlvmLibcFPBitsTest, LongDoubleType) { EXPECT_EQ(zero.get_mantissa(), static_cast<UInt128>(0x0000000000000000) << 64); EXPECT_EQ(zero.uintval(), static_cast<UInt128>(0x0000000000000000) << 64); - EXPECT_STREQ(__llvm_libc::str(zero).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(zero).c_str(), "0x00000000000000000000000000000000 = " "(S: 0, E: 0x0000, M: 0x00000000000000000000000000000000)"); @@ -233,7 +235,7 @@ TEST(LlvmLibcFPBitsTest, LongDoubleType) { EXPECT_EQ(negzero.get_mantissa(), static_cast<UInt128>(0x0000000000000000) << 64); EXPECT_EQ(negzero.uintval(), static_cast<UInt128>(0x1) << 127); - EXPECT_STREQ(__llvm_libc::str(negzero).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(negzero).c_str(), "0x80000000000000000000000000000000 = " "(S: 1, E: 0x0000, M: 0x00000000000000000000000000000000)"); @@ -242,7 +244,7 @@ TEST(LlvmLibcFPBitsTest, LongDoubleType) { EXPECT_EQ(one.get_unbiased_exponent(), static_cast<uint16_t>(0x3FFF)); EXPECT_EQ(one.get_mantissa(), static_cast<UInt128>(0x0000000000000000) << 64); EXPECT_EQ(one.uintval(), static_cast<UInt128>(0x3FFF) << 112); - EXPECT_STREQ(__llvm_libc::str(one).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(one).c_str(), "0x3FFF0000000000000000000000000000 = " "(S: 0, E: 0x3FFF, M: 0x00000000000000000000000000000000)"); @@ -252,7 +254,7 @@ TEST(LlvmLibcFPBitsTest, LongDoubleType) { EXPECT_EQ(negone.get_mantissa(), static_cast<UInt128>(0x0000000000000000) << 64); EXPECT_EQ(negone.uintval(), static_cast<UInt128>(0xBFFF) << 112); - EXPECT_STREQ(__llvm_libc::str(negone).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(negone).c_str(), "0xBFFF0000000000000000000000000000 = " "(S: 1, E: 0x3FFF, M: 0x00000000000000000000000000000000)"); @@ -261,7 +263,7 @@ TEST(LlvmLibcFPBitsTest, LongDoubleType) { EXPECT_EQ(num.get_unbiased_exponent(), static_cast<uint16_t>(0x3FFF)); EXPECT_EQ(num.get_mantissa(), static_cast<UInt128>(0x2) << 108); EXPECT_EQ(num.uintval(), static_cast<UInt128>(0x3FFF2) << 108); - EXPECT_STREQ(__llvm_libc::str(num).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(num).c_str(), "0x3FFF2000000000000000000000000000 = " "(S: 0, E: 0x3FFF, M: 0x00002000000000000000000000000000)"); @@ -270,7 +272,7 @@ TEST(LlvmLibcFPBitsTest, LongDoubleType) { EXPECT_EQ(negnum.get_unbiased_exponent(), static_cast<uint16_t>(0x3FFF)); EXPECT_EQ(negnum.get_mantissa(), static_cast<UInt128>(0x2) << 108); EXPECT_EQ(negnum.uintval(), static_cast<UInt128>(0xBFFF2) << 108); - EXPECT_STREQ(__llvm_libc::str(negnum).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(negnum).c_str(), "0xBFFF2000000000000000000000000000 = " "(S: 1, E: 0x3FFF, M: 0x00002000000000000000000000000000)"); #endif diff --git a/libc/test/src/__support/FPUtil/rounding_mode_test.cpp b/libc/test/src/__support/FPUtil/rounding_mode_test.cpp index 01c1b3c2..e73d10d 100644 --- a/libc/test/src/__support/FPUtil/rounding_mode_test.cpp +++ b/libc/test/src/__support/FPUtil/rounding_mode_test.cpp @@ -12,11 +12,11 @@ #include <fenv.h> -using __llvm_libc::testing::mpfr::ForceRoundingMode; -using __llvm_libc::testing::mpfr::RoundingMode; +using LIBC_NAMESPACE::testing::mpfr::ForceRoundingMode; +using LIBC_NAMESPACE::testing::mpfr::RoundingMode; TEST(LlvmLibcFEnvImplTest, QuickRoundingUpTest) { - using __llvm_libc::fputil::fenv_is_round_up; + using LIBC_NAMESPACE::fputil::fenv_is_round_up; { ForceRoundingMode __r(RoundingMode::Upward); if (__r.success) @@ -40,7 +40,7 @@ TEST(LlvmLibcFEnvImplTest, QuickRoundingUpTest) { } TEST(LlvmLibcFEnvImplTest, QuickRoundingDownTest) { - using __llvm_libc::fputil::fenv_is_round_down; + using LIBC_NAMESPACE::fputil::fenv_is_round_down; { ForceRoundingMode __r(RoundingMode::Upward); if (__r.success) @@ -64,7 +64,7 @@ TEST(LlvmLibcFEnvImplTest, QuickRoundingDownTest) { } TEST(LlvmLibcFEnvImplTest, QuickRoundingNearestTest) { - using __llvm_libc::fputil::fenv_is_round_to_nearest; + using LIBC_NAMESPACE::fputil::fenv_is_round_to_nearest; { ForceRoundingMode __r(RoundingMode::Upward); if (__r.success) @@ -88,7 +88,7 @@ TEST(LlvmLibcFEnvImplTest, QuickRoundingNearestTest) { } TEST(LlvmLibcFEnvImplTest, QuickRoundingTowardZeroTest) { - using __llvm_libc::fputil::fenv_is_round_to_zero; + using LIBC_NAMESPACE::fputil::fenv_is_round_to_zero; { ForceRoundingMode __r(RoundingMode::Upward); if (__r.success) @@ -112,7 +112,7 @@ TEST(LlvmLibcFEnvImplTest, QuickRoundingTowardZeroTest) { } TEST(LlvmLibcFEnvImplTest, QuickGetRoundTest) { - using __llvm_libc::fputil::quick_get_round; + using LIBC_NAMESPACE::fputil::quick_get_round; { ForceRoundingMode __r(RoundingMode::Upward); if (__r.success) diff --git a/libc/test/src/__support/File/file_test.cpp b/libc/test/src/__support/File/file_test.cpp index 1a67ebd..fbcedc1 100644 --- a/libc/test/src/__support/File/file_test.cpp +++ b/libc/test/src/__support/File/file_test.cpp @@ -15,11 +15,11 @@ #include <stdio.h> #include <stdlib.h> -using ModeFlags = __llvm_libc::File::ModeFlags; -using MemoryView = __llvm_libc::testing::MemoryView; -using __llvm_libc::ErrorOr; -using __llvm_libc::File; -using __llvm_libc::FileIOResult; +using ModeFlags = LIBC_NAMESPACE::File::ModeFlags; +using MemoryView = LIBC_NAMESPACE::testing::MemoryView; +using LIBC_NAMESPACE::ErrorOr; +using LIBC_NAMESPACE::File; +using LIBC_NAMESPACE::FileIOResult; class StringFile : public File { static constexpr size_t SIZE = 512; @@ -28,11 +28,12 @@ class StringFile : public File { size_t eof_marker; bool write_append; - static FileIOResult str_read(__llvm_libc::File *f, void *data, size_t len); - static FileIOResult str_write(__llvm_libc::File *f, const void *data, + static FileIOResult str_read(LIBC_NAMESPACE::File *f, void *data, size_t len); + static FileIOResult str_write(LIBC_NAMESPACE::File *f, const void *data, size_t len); - static ErrorOr<long> str_seek(__llvm_libc::File *f, long offset, int whence); - static int str_close(__llvm_libc::File *f) { + static ErrorOr<long> str_seek(LIBC_NAMESPACE::File *f, long offset, + int whence); + static int str_close(LIBC_NAMESPACE::File *f) { delete reinterpret_cast<StringFile *>(f); return 0; } @@ -40,11 +41,12 @@ class StringFile : public File { public: explicit StringFile(char *buffer, size_t buflen, int bufmode, bool owned, ModeFlags modeflags) - : __llvm_libc::File(&str_write, &str_read, &str_seek, &str_close, - reinterpret_cast<uint8_t *>(buffer), buflen, bufmode, - owned, modeflags), + : LIBC_NAMESPACE::File(&str_write, &str_read, &str_seek, &str_close, + reinterpret_cast<uint8_t *>(buffer), buflen, + bufmode, owned, modeflags), pos(0), eof_marker(0), write_append(false) { - if (modeflags & static_cast<ModeFlags>(__llvm_libc::File::OpenMode::APPEND)) + if (modeflags & + static_cast<ModeFlags>(LIBC_NAMESPACE::File::OpenMode::APPEND)) write_append = true; } @@ -63,7 +65,7 @@ public: } }; -FileIOResult StringFile::str_read(__llvm_libc::File *f, void *data, +FileIOResult StringFile::str_read(LIBC_NAMESPACE::File *f, void *data, size_t len) { StringFile *sf = static_cast<StringFile *>(f); if (sf->pos >= sf->eof_marker) @@ -75,7 +77,7 @@ FileIOResult StringFile::str_read(__llvm_libc::File *f, void *data, return i; } -FileIOResult StringFile::str_write(__llvm_libc::File *f, const void *data, +FileIOResult StringFile::str_write(LIBC_NAMESPACE::File *f, const void *data, size_t len) { StringFile *sf = static_cast<StringFile *>(f); if (sf->write_append) @@ -91,7 +93,7 @@ FileIOResult StringFile::str_write(__llvm_libc::File *f, const void *data, return i; } -ErrorOr<long> StringFile::str_seek(__llvm_libc::File *f, long offset, +ErrorOr<long> StringFile::str_seek(LIBC_NAMESPACE::File *f, long offset, int whence) { StringFile *sf = static_cast<StringFile *>(f); if (whence == SEEK_SET) @@ -105,11 +107,11 @@ ErrorOr<long> StringFile::str_seek(__llvm_libc::File *f, long offset, StringFile *new_string_file(char *buffer, size_t buflen, int bufmode, bool owned, const char *mode) { - __llvm_libc::AllocChecker ac; + LIBC_NAMESPACE::AllocChecker ac; // We will just assume the allocation succeeds. We cannot test anything // otherwise. return new (ac) StringFile(buffer, buflen, bufmode, owned, - __llvm_libc::File::mode_flags(mode)); + LIBC_NAMESPACE::File::mode_flags(mode)); } TEST(LlvmLibcFileTest, WriteOnly) { diff --git a/libc/test/src/__support/File/platform_file_test.cpp b/libc/test/src/__support/File/platform_file_test.cpp index 022c8af..469d750 100644 --- a/libc/test/src/__support/File/platform_file_test.cpp +++ b/libc/test/src/__support/File/platform_file_test.cpp @@ -11,12 +11,12 @@ #include <stdio.h> // For SEEK_* macros -using File = __llvm_libc::File; +using File = LIBC_NAMESPACE::File; constexpr char TEXT[] = "Hello, File"; constexpr size_t TEXT_SIZE = sizeof(TEXT) - 1; // Ignore the null terminator LIBC_INLINE File *openfile(const char *file_name, const char *mode) { - auto error_or_file = __llvm_libc::openfile(file_name, mode); + auto error_or_file = LIBC_NAMESPACE::openfile(file_name, mode); return error_or_file.has_value() ? error_or_file.value() : nullptr; } diff --git a/libc/test/src/__support/File/platform_stderr_test.cpp b/libc/test/src/__support/File/platform_stderr_test.cpp index ac79572..1311d72 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 c0c41d5..2fdf716 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 a47281a..b479e8d 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 84e750a..9dd1a6a 100644 --- a/libc/test/src/__support/OSUtil/linux/x86_64/syscall_test.cpp +++ b/libc/test/src/__support/OSUtil/linux/x86_64/syscall_test.cpp @@ -14,32 +14,34 @@ TEST(LlvmLibcX86_64_SyscallTest, APITest) { // We only do a signature test here. Actual functionality tests are // done by the unit tests of the syscall wrappers like mmap. - using __llvm_libc::cpp::function; + using LIBC_NAMESPACE::cpp::function; function<long(long)> f( - [](long n) { return __llvm_libc::syscall_impl<long>(n); }); - function<long(long, long)> f1( - [](long n, long a1) { return __llvm_libc::syscall_impl<long>(n, a1); }); + [](long n) { return LIBC_NAMESPACE::syscall_impl<long>(n); }); + function<long(long, long)> f1([](long n, long a1) { + return LIBC_NAMESPACE::syscall_impl<long>(n, a1); + }); function<long(long, long, long)> f2([](long n, long a1, long a2) { - return __llvm_libc::syscall_impl<long>(n, a1, a2); + return LIBC_NAMESPACE::syscall_impl<long>(n, a1, a2); }); function<long(long, long, long, long)> f3( [](long n, long a1, long a2, long a3) { - return __llvm_libc::syscall_impl<long>(n, a1, a2, a3); + return LIBC_NAMESPACE::syscall_impl<long>(n, a1, a2, a3); }); function<long(long, long, long, long, long)> f4( [](long n, long a1, long a2, long a3, long a4) { - return __llvm_libc::syscall_impl<long>(n, a1, a2, a3, a4); + return LIBC_NAMESPACE::syscall_impl<long>(n, a1, a2, a3, a4); }); function<long(long, long, long, long, long, long)> f5( [](long n, long a1, long a2, long a3, long a4, long a5) { - return __llvm_libc::syscall_impl<long>(n, a1, a2, a3, a4, a5); + return LIBC_NAMESPACE::syscall_impl<long>(n, a1, a2, a3, a4, a5); }); function<long(long, long, long, long, long, long, long)> f6( [](long n, long a1, long a2, long a3, long a4, long a5, long a6) { - return __llvm_libc::syscall_impl<long>(n, a1, a2, a3, a4, a5, a6); + return LIBC_NAMESPACE::syscall_impl<long>(n, a1, a2, a3, a4, a5, a6); }); - function<long(long, void *)> not_long_type( - [](long n, void *a1) { return __llvm_libc::syscall_impl<long>(n, a1); }); + function<long(long, void *)> not_long_type([](long n, void *a1) { + return LIBC_NAMESPACE::syscall_impl<long>(n, a1); + }); } diff --git a/libc/test/src/__support/RPC/rpc_smoke_test.cpp b/libc/test/src/__support/RPC/rpc_smoke_test.cpp index b575e01..54821e2 100644 --- a/libc/test/src/__support/RPC/rpc_smoke_test.cpp +++ b/libc/test/src/__support/RPC/rpc_smoke_test.cpp @@ -17,8 +17,8 @@ struct Packet { uint64_t unused; }; -using ProcAType = __llvm_libc::rpc::Process<false, Packet>; -using ProcBType = __llvm_libc::rpc::Process<true, Packet>; +using ProcAType = LIBC_NAMESPACE::rpc::Process<false, Packet>; +using ProcBType = LIBC_NAMESPACE::rpc::Process<true, Packet>; static_assert(ProcAType::inbox_offset(port_count) == ProcBType::outbox_offset(port_count)); diff --git a/libc/test/src/__support/arg_list_test.cpp b/libc/test/src/__support/arg_list_test.cpp index f266ccf..1876cf7 100644 --- a/libc/test/src/__support/arg_list_test.cpp +++ b/libc/test/src/__support/arg_list_test.cpp @@ -13,7 +13,7 @@ int get_nth_int(int n, ...) { va_list vlist; va_start(vlist, n); - __llvm_libc::internal::ArgList v(vlist); + LIBC_NAMESPACE::internal::ArgList v(vlist); va_end(vlist); for (int i = 0; i < n; ++i) { @@ -29,10 +29,10 @@ TEST(LlvmLibcArgListTest, BasicUsage) { int sum_two_nums(int first, int second, ...) { va_list vlist; va_start(vlist, second); - __llvm_libc::internal::ArgList v1(vlist); + LIBC_NAMESPACE::internal::ArgList v1(vlist); va_end(vlist); - __llvm_libc::internal::ArgList v2 = v1; + LIBC_NAMESPACE::internal::ArgList v2 = v1; int first_val; for (int i = 0; i < first; ++i) { @@ -60,7 +60,7 @@ TEST(LlvmLibcArgListTest, CopyConstructor) { long int check_primitives(int first, ...) { va_list vlist; va_start(vlist, first); - __llvm_libc::internal::ArgList args(vlist); + LIBC_NAMESPACE::internal::ArgList args(vlist); va_end(vlist); long int count = 0; @@ -106,7 +106,7 @@ struct S { long int check_struct_type(int first, ...) { va_list vlist; va_start(vlist, first); - __llvm_libc::internal::ArgList args(vlist); + LIBC_NAMESPACE::internal::ArgList args(vlist); va_end(vlist); S s = args.next_var<S>(); @@ -130,7 +130,7 @@ using int4 = int __attribute__((ext_vector_type(4))); int check_vector_type(int first, ...) { va_list vlist; va_start(vlist, first); - __llvm_libc::internal::ArgList args(vlist); + LIBC_NAMESPACE::internal::ArgList args(vlist); va_end(vlist); int1 v1 = args.next_var<int1>(); diff --git a/libc/test/src/__support/blockstore_test.cpp b/libc/test/src/__support/blockstore_test.cpp index 10277af..f628572 100644 --- a/libc/test/src/__support/blockstore_test.cpp +++ b/libc/test/src/__support/blockstore_test.cpp @@ -15,11 +15,11 @@ struct Element { unsigned c; }; -class LlvmLibcBlockStoreTest : public __llvm_libc::testing::Test { +class LlvmLibcBlockStoreTest : public LIBC_NAMESPACE::testing::Test { public: template <size_t BLOCK_SIZE, size_t ELEMENT_COUNT, bool REVERSE> void populate_and_iterate() { - __llvm_libc::cpp::BlockStore<Element, BLOCK_SIZE, REVERSE> block_store; + LIBC_NAMESPACE::cpp::BlockStore<Element, BLOCK_SIZE, REVERSE> block_store; for (int i = 0; i < int(ELEMENT_COUNT); ++i) ASSERT_TRUE(block_store.push_back({i, 2 * i, 3 * unsigned(i)})); auto end = block_store.end(); @@ -38,12 +38,12 @@ public: } } ASSERT_EQ(i, int(ELEMENT_COUNT)); - __llvm_libc::cpp::BlockStore<Element, BLOCK_SIZE, REVERSE>::destroy( + LIBC_NAMESPACE::cpp::BlockStore<Element, BLOCK_SIZE, REVERSE>::destroy( &block_store); } template <bool REVERSE> void back_test() { - using __llvm_libc::cpp::BlockStore; + using LIBC_NAMESPACE::cpp::BlockStore; BlockStore<int, 4, REVERSE> block_store; for (int i = 0; i < 20; i++) ASSERT_TRUE(block_store.push_back(i)); @@ -53,7 +53,7 @@ public: } template <bool REVERSE> void empty_test() { - using __llvm_libc::cpp::BlockStore; + using LIBC_NAMESPACE::cpp::BlockStore; BlockStore<int, 2, REVERSE> block_store; ASSERT_TRUE(block_store.empty()); diff --git a/libc/test/src/__support/char_vector_test.cpp b/libc/test/src/__support/char_vector_test.cpp index 3d60092..ea41d534 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 42296a6..4d95c03 100644 --- a/libc/test/src/__support/endian_test.cpp +++ b/libc/test/src/__support/endian_test.cpp @@ -9,7 +9,7 @@ #include "src/__support/endian.h" #include "test/UnitTest/Test.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { struct LlvmLibcEndian : testing::Test { template <typename T> void check(const T original, const T swapped) { @@ -52,4 +52,4 @@ TEST_F(LlvmLibcEndian, uint64_t) { check(original, swapped); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/src/__support/fixedvector_test.cpp b/libc/test/src/__support/fixedvector_test.cpp index bc1ee38..a70ebfa 100644 --- a/libc/test/src/__support/fixedvector_test.cpp +++ b/libc/test/src/__support/fixedvector_test.cpp @@ -10,7 +10,7 @@ #include "test/UnitTest/Test.h" TEST(LlvmLibcFixedVectorTest, PushAndPop) { - __llvm_libc::FixedVector<int, 20> fixed_vector; + LIBC_NAMESPACE::FixedVector<int, 20> fixed_vector; ASSERT_TRUE(fixed_vector.empty()); for (int i = 0; i < 20; i++) ASSERT_TRUE(fixed_vector.push_back(i)); @@ -25,7 +25,7 @@ TEST(LlvmLibcFixedVectorTest, PushAndPop) { } TEST(LlvmLibcFixedVectorTest, Reset) { - __llvm_libc::FixedVector<int, 20> fixed_vector; + LIBC_NAMESPACE::FixedVector<int, 20> fixed_vector; ASSERT_TRUE(fixed_vector.empty()); for (int i = 0; i < 20; i++) ASSERT_TRUE(fixed_vector.push_back(i)); @@ -35,11 +35,11 @@ TEST(LlvmLibcFixedVectorTest, Reset) { } TEST(LlvmLibcFixedVectorTest, Destroy) { - __llvm_libc::FixedVector<int, 20> fixed_vector; + LIBC_NAMESPACE::FixedVector<int, 20> fixed_vector; ASSERT_TRUE(fixed_vector.empty()); for (int i = 0; i < 20; i++) ASSERT_TRUE(fixed_vector.push_back(i)); ASSERT_FALSE(fixed_vector.empty()); - __llvm_libc::FixedVector<int, 20>::destroy(&fixed_vector); + LIBC_NAMESPACE::FixedVector<int, 20>::destroy(&fixed_vector); ASSERT_TRUE(fixed_vector.empty()); } diff --git a/libc/test/src/__support/high_precision_decimal_test.cpp b/libc/test/src/__support/high_precision_decimal_test.cpp index abe4a60..a9c039e 100644 --- a/libc/test/src/__support/high_precision_decimal_test.cpp +++ b/libc/test/src/__support/high_precision_decimal_test.cpp @@ -12,8 +12,8 @@ #include "test/UnitTest/Test.h" TEST(LlvmLibcHighPrecisionDecimalTest, BasicInit) { - __llvm_libc::internal::HighPrecisionDecimal hpd = - __llvm_libc::internal::HighPrecisionDecimal("1.2345"); + LIBC_NAMESPACE::internal::HighPrecisionDecimal hpd = + LIBC_NAMESPACE::internal::HighPrecisionDecimal("1.2345"); uint8_t *digits = hpd.get_digits(); EXPECT_EQ(digits[0], uint8_t(1)); @@ -26,8 +26,8 @@ TEST(LlvmLibcHighPrecisionDecimalTest, BasicInit) { } TEST(LlvmLibcHighPrecisionDecimalTest, BasicShift) { - __llvm_libc::internal::HighPrecisionDecimal hpd = - __llvm_libc::internal::HighPrecisionDecimal("1"); + LIBC_NAMESPACE::internal::HighPrecisionDecimal hpd = + LIBC_NAMESPACE::internal::HighPrecisionDecimal("1"); uint8_t *digits = hpd.get_digits(); hpd.shift(1); // shift left 1, equal to multiplying by 2. @@ -38,8 +38,8 @@ TEST(LlvmLibcHighPrecisionDecimalTest, BasicShift) { } TEST(LlvmLibcHighPrecisionDecimalTest, ShouldRoundup) { - __llvm_libc::internal::HighPrecisionDecimal hpd = - __llvm_libc::internal::HighPrecisionDecimal(".5"); + LIBC_NAMESPACE::internal::HighPrecisionDecimal hpd = + LIBC_NAMESPACE::internal::HighPrecisionDecimal(".5"); uint8_t *digits = hpd.get_digits(); EXPECT_EQ(digits[0], uint8_t(5)); @@ -49,8 +49,8 @@ TEST(LlvmLibcHighPrecisionDecimalTest, ShouldRoundup) { } TEST(LlvmLibcHighPrecisionDecimalTest, SmallShift) { - __llvm_libc::internal::HighPrecisionDecimal hpd = - __llvm_libc::internal::HighPrecisionDecimal("1.2345"); + LIBC_NAMESPACE::internal::HighPrecisionDecimal hpd = + LIBC_NAMESPACE::internal::HighPrecisionDecimal("1.2345"); uint8_t *digits = hpd.get_digits(); hpd.shift(-1); // shift right one, equal to dividing by 2 @@ -98,8 +98,8 @@ TEST(LlvmLibcHighPrecisionDecimalTest, SmallShift) { } TEST(LlvmLibcHighPrecisionDecimalTest, MediumShift) { - __llvm_libc::internal::HighPrecisionDecimal hpd = - __llvm_libc::internal::HighPrecisionDecimal(".299792458"); + LIBC_NAMESPACE::internal::HighPrecisionDecimal hpd = + LIBC_NAMESPACE::internal::HighPrecisionDecimal(".299792458"); uint8_t *digits = hpd.get_digits(); hpd.shift(-3); // shift right three, equal to dividing by 8 @@ -135,8 +135,8 @@ TEST(LlvmLibcHighPrecisionDecimalTest, MediumShift) { } TEST(LlvmLibcHighPrecisionDecimalTest, BigShift) { - __llvm_libc::internal::HighPrecisionDecimal hpd = - __llvm_libc::internal::HighPrecisionDecimal(".299792458"); + LIBC_NAMESPACE::internal::HighPrecisionDecimal hpd = + LIBC_NAMESPACE::internal::HighPrecisionDecimal(".299792458"); uint8_t *digits = hpd.get_digits(); hpd.shift(-29); // shift right 29, equal to dividing by 536,870,912 @@ -190,8 +190,8 @@ TEST(LlvmLibcHighPrecisionDecimalTest, BigShift) { } TEST(LlvmLibcHighPrecisionDecimalTest, BigShiftInSteps) { - __llvm_libc::internal::HighPrecisionDecimal hpd = - __llvm_libc::internal::HighPrecisionDecimal("1"); + LIBC_NAMESPACE::internal::HighPrecisionDecimal hpd = + LIBC_NAMESPACE::internal::HighPrecisionDecimal("1"); uint8_t *digits = hpd.get_digits(); hpd.shift(60); // shift left 60, equal to multiplying by @@ -287,8 +287,8 @@ TEST(LlvmLibcHighPrecisionDecimalTest, BigShiftInSteps) { } TEST(LlvmLibcHighPrecisionDecimalTest, VeryBigShift) { - __llvm_libc::internal::HighPrecisionDecimal hpd = - __llvm_libc::internal::HighPrecisionDecimal("1"); + LIBC_NAMESPACE::internal::HighPrecisionDecimal hpd = + LIBC_NAMESPACE::internal::HighPrecisionDecimal("1"); uint8_t *digits = hpd.get_digits(); hpd.shift(100); // shift left 100, equal to multiplying by @@ -340,8 +340,8 @@ TEST(LlvmLibcHighPrecisionDecimalTest, VeryBigShift) { } TEST(LlvmLibcHighPrecisionDecimalTest, RoundingTest) { - __llvm_libc::internal::HighPrecisionDecimal hpd = - __llvm_libc::internal::HighPrecisionDecimal("1.2345"); + LIBC_NAMESPACE::internal::HighPrecisionDecimal hpd = + LIBC_NAMESPACE::internal::HighPrecisionDecimal("1.2345"); EXPECT_EQ(hpd.round_to_integer_type<uint32_t>(), uint32_t(1)); EXPECT_EQ(hpd.round_to_integer_type<uint64_t>(), uint64_t(1)); @@ -360,7 +360,7 @@ TEST(LlvmLibcHighPrecisionDecimalTest, RoundingTest) { EXPECT_EQ(hpd.round_to_integer_type<UInt128>(), UInt128(5)); // 2.5 is right between two integers, so we round to even (2) - hpd = __llvm_libc::internal::HighPrecisionDecimal("2.5"); + hpd = LIBC_NAMESPACE::internal::HighPrecisionDecimal("2.5"); EXPECT_EQ(hpd.round_to_integer_type<uint32_t>(), uint32_t(2)); EXPECT_EQ(hpd.round_to_integer_type<uint64_t>(), uint64_t(2)); @@ -378,13 +378,13 @@ TEST(LlvmLibcHighPrecisionDecimalTest, RoundingTest) { // handled, so int types that are too small are ignored for this test.) // 1099511627776 = 2^40 - hpd = __llvm_libc::internal::HighPrecisionDecimal("1099511627776"); + hpd = LIBC_NAMESPACE::internal::HighPrecisionDecimal("1099511627776"); EXPECT_EQ(hpd.round_to_integer_type<uint64_t>(), uint64_t(1099511627776)); EXPECT_EQ(hpd.round_to_integer_type<UInt128>(), UInt128(1099511627776)); // 1267650600228229401496703205376 = 2^100 - hpd = __llvm_libc::internal::HighPrecisionDecimal( + hpd = LIBC_NAMESPACE::internal::HighPrecisionDecimal( "1267650600228229401496703205376"); UInt128 result = UInt128(1) << 100; @@ -393,15 +393,15 @@ TEST(LlvmLibcHighPrecisionDecimalTest, RoundingTest) { } TEST(LlvmLibcHighPrecisionDecimalTest, BigExpTest) { - __llvm_libc::internal::HighPrecisionDecimal big_hpd = - __llvm_libc::internal::HighPrecisionDecimal("1e123456789"); + LIBC_NAMESPACE::internal::HighPrecisionDecimal big_hpd = + LIBC_NAMESPACE::internal::HighPrecisionDecimal("1e123456789"); // We need to add one to handle the digit before the decimal point in our // number. EXPECT_EQ(big_hpd.get_decimal_point(), 123456789 + 1); - __llvm_libc::internal::HighPrecisionDecimal big_negative_hpd = - __llvm_libc::internal::HighPrecisionDecimal("1e-123456789"); + LIBC_NAMESPACE::internal::HighPrecisionDecimal big_negative_hpd = + LIBC_NAMESPACE::internal::HighPrecisionDecimal("1e-123456789"); // Same, but since the number is negative the net result is -123456788 EXPECT_EQ(big_negative_hpd.get_decimal_point(), -123456789 + 1); diff --git a/libc/test/src/__support/integer_to_string_test.cpp b/libc/test/src/__support/integer_to_string_test.cpp index 991582e..c8913bf 100644 --- a/libc/test/src/__support/integer_to_string_test.cpp +++ b/libc/test/src/__support/integer_to_string_test.cpp @@ -16,14 +16,14 @@ #include "limits.h" -using __llvm_libc::IntegerToString; -using __llvm_libc::cpp::span; -using __llvm_libc::cpp::string_view; -using __llvm_libc::radix::Bin; -using __llvm_libc::radix::Custom; -using __llvm_libc::radix::Dec; -using __llvm_libc::radix::Hex; -using __llvm_libc::radix::Oct; +using LIBC_NAMESPACE::IntegerToString; +using LIBC_NAMESPACE::cpp::span; +using LIBC_NAMESPACE::cpp::string_view; +using LIBC_NAMESPACE::radix::Bin; +using LIBC_NAMESPACE::radix::Custom; +using LIBC_NAMESPACE::radix::Dec; +using LIBC_NAMESPACE::radix::Hex; +using LIBC_NAMESPACE::radix::Oct; #define EXPECT(type, value, string_value) \ { \ @@ -225,7 +225,7 @@ TEST(LlvmLibcIntegerToStringTest, UINT64_Base_36) { } TEST(LlvmLibcIntegerToStringTest, UINT256_Base_16) { - using UInt256 = __llvm_libc::cpp::UInt<256>; + using UInt256 = LIBC_NAMESPACE::cpp::UInt<256>; using type = IntegerToString<UInt256, Hex::WithWidth<64>>; EXPECT(type, static_cast<UInt256>(0), "0000000000000000000000000000000000000000000000000000000000000000"); diff --git a/libc/test/src/__support/str_to_float_test.cpp b/libc/test/src/__support/str_to_float_test.cpp index 4ebdb33..ae72941 100644 --- a/libc/test/src/__support/str_to_float_test.cpp +++ b/libc/test/src/__support/str_to_float_test.cpp @@ -13,20 +13,20 @@ #include "test/UnitTest/Test.h" -class LlvmLibcStrToFloatTest : public __llvm_libc::testing::Test { +class LlvmLibcStrToFloatTest : public LIBC_NAMESPACE::testing::Test { public: template <class T> void clinger_fast_path_test( - const typename __llvm_libc::fputil::FPBits<T>::UIntType inputMantissa, + const typename LIBC_NAMESPACE::fputil::FPBits<T>::UIntType inputMantissa, const int32_t inputExp10, - const typename __llvm_libc::fputil::FPBits<T>::UIntType + const typename LIBC_NAMESPACE::fputil::FPBits<T>::UIntType expectedOutputMantissa, const uint32_t expectedOutputExp2) { - typename __llvm_libc::fputil::FPBits<T>::UIntType actual_output_mantissa = - 0; + typename LIBC_NAMESPACE::fputil::FPBits<T>::UIntType + actual_output_mantissa = 0; uint32_t actual_output_exp2 = 0; - auto result = __llvm_libc::internal::clinger_fast_path<T>( + auto result = LIBC_NAMESPACE::internal::clinger_fast_path<T>( {inputMantissa, inputExp10}); ASSERT_TRUE(result.has_value()); @@ -40,26 +40,26 @@ public: template <class T> void clinger_fast_path_fails_test( - const typename __llvm_libc::fputil::FPBits<T>::UIntType inputMantissa, + const typename LIBC_NAMESPACE::fputil::FPBits<T>::UIntType inputMantissa, const int32_t inputExp10) { - ASSERT_FALSE( - __llvm_libc::internal::clinger_fast_path<T>({inputMantissa, inputExp10}) - .has_value()); + ASSERT_FALSE(LIBC_NAMESPACE::internal::clinger_fast_path<T>( + {inputMantissa, inputExp10}) + .has_value()); } template <class T> void eisel_lemire_test( - const typename __llvm_libc::fputil::FPBits<T>::UIntType inputMantissa, + const typename LIBC_NAMESPACE::fputil::FPBits<T>::UIntType inputMantissa, const int32_t inputExp10, - const typename __llvm_libc::fputil::FPBits<T>::UIntType + const typename LIBC_NAMESPACE::fputil::FPBits<T>::UIntType expectedOutputMantissa, const uint32_t expectedOutputExp2) { - typename __llvm_libc::fputil::FPBits<T>::UIntType actual_output_mantissa = - 0; + typename LIBC_NAMESPACE::fputil::FPBits<T>::UIntType + actual_output_mantissa = 0; uint32_t actual_output_exp2 = 0; auto result = - __llvm_libc::internal::eisel_lemire<T>({inputMantissa, inputExp10}); + LIBC_NAMESPACE::internal::eisel_lemire<T>({inputMantissa, inputExp10}); ASSERT_TRUE(result.has_value()); @@ -73,15 +73,16 @@ public: template <class T> void simple_decimal_conversion_test( const char *__restrict numStart, - const typename __llvm_libc::fputil::FPBits<T>::UIntType + const typename LIBC_NAMESPACE::fputil::FPBits<T>::UIntType expectedOutputMantissa, const uint32_t expectedOutputExp2, const int expectedErrno = 0) { - typename __llvm_libc::fputil::FPBits<T>::UIntType actual_output_mantissa = - 0; + typename LIBC_NAMESPACE::fputil::FPBits<T>::UIntType + actual_output_mantissa = 0; uint32_t actual_output_exp2 = 0; libc_errno = 0; - auto result = __llvm_libc::internal::simple_decimal_conversion<T>(numStart); + auto result = + LIBC_NAMESPACE::internal::simple_decimal_conversion<T>(numStart); actual_output_mantissa = result.num.mantissa; actual_output_exp2 = result.num.exponent; @@ -95,39 +96,40 @@ public: TEST(LlvmLibcStrToFloatTest, LeadingZeroes) { uint64_t test_num64 = 1; uint32_t num_of_zeroes = 63; - EXPECT_EQ(__llvm_libc::internal::leading_zeroes<uint64_t>(0), 64u); + EXPECT_EQ(LIBC_NAMESPACE::internal::leading_zeroes<uint64_t>(0), 64u); for (; num_of_zeroes < 64; test_num64 <<= 1, num_of_zeroes--) { - EXPECT_EQ(__llvm_libc::internal::leading_zeroes<uint64_t>(test_num64), + EXPECT_EQ(LIBC_NAMESPACE::internal::leading_zeroes<uint64_t>(test_num64), num_of_zeroes); } test_num64 = 3; num_of_zeroes = 62; for (; num_of_zeroes > 63; test_num64 <<= 1, num_of_zeroes--) { - EXPECT_EQ(__llvm_libc::internal::leading_zeroes<uint64_t>(test_num64), + EXPECT_EQ(LIBC_NAMESPACE::internal::leading_zeroes<uint64_t>(test_num64), num_of_zeroes); } - EXPECT_EQ(__llvm_libc::internal::leading_zeroes<uint64_t>(0xffffffffffffffff), - 0u); + EXPECT_EQ( + LIBC_NAMESPACE::internal::leading_zeroes<uint64_t>(0xffffffffffffffff), + 0u); test_num64 = 1; num_of_zeroes = 63; for (; num_of_zeroes > 63; test_num64 = (test_num64 << 1) + 1, num_of_zeroes--) { - EXPECT_EQ(__llvm_libc::internal::leading_zeroes<uint64_t>(test_num64), + EXPECT_EQ(LIBC_NAMESPACE::internal::leading_zeroes<uint64_t>(test_num64), num_of_zeroes); } uint64_t test_num32 = 1; num_of_zeroes = 31; - EXPECT_EQ(__llvm_libc::internal::leading_zeroes<uint32_t>(0), 32u); + EXPECT_EQ(LIBC_NAMESPACE::internal::leading_zeroes<uint32_t>(0), 32u); for (; num_of_zeroes < 32; test_num32 <<= 1, num_of_zeroes--) { - EXPECT_EQ(__llvm_libc::internal::leading_zeroes<uint32_t>(test_num32), + EXPECT_EQ(LIBC_NAMESPACE::internal::leading_zeroes<uint32_t>(test_num32), num_of_zeroes); } - EXPECT_EQ(__llvm_libc::internal::leading_zeroes<uint32_t>(0xffffffff), 0u); + EXPECT_EQ(LIBC_NAMESPACE::internal::leading_zeroes<uint32_t>(0xffffffff), 0u); } TEST_F(LlvmLibcStrToFloatTest, ClingerFastPathFloat64Simple) { @@ -188,11 +190,11 @@ TEST_F(LlvmLibcStrToFloatTest, EiselLemireFallbackStates) { // from both of its closest floating point approximations // (12345678901234548736 and 12345678901234550784) ASSERT_FALSE( - __llvm_libc::internal::eisel_lemire<double>({12345678901234549760u, 0}) + LIBC_NAMESPACE::internal::eisel_lemire<double>({12345678901234549760u, 0}) .has_value()); ASSERT_FALSE( - __llvm_libc::internal::eisel_lemire<float>({20040229, 0}).has_value()); + LIBC_NAMESPACE::internal::eisel_lemire<float>({20040229, 0}).has_value()); } TEST_F(LlvmLibcStrToFloatTest, SimpleDecimalConversion64BasicWholeNumbers) { @@ -252,8 +254,9 @@ TEST(LlvmLibcStrToFloatTest, SimpleDecimalConversionExtraTypes) { uint32_t output_exp2 = 0; libc_errno = 0; - auto float_result = __llvm_libc::internal::simple_decimal_conversion<float>( - "123456789012345678900"); + auto float_result = + LIBC_NAMESPACE::internal::simple_decimal_conversion<float>( + "123456789012345678900"); float_output_mantissa = float_result.num.mantissa; output_exp2 = float_result.num.exponent; EXPECT_EQ(float_output_mantissa, uint32_t(0xd629d4)); @@ -264,8 +267,9 @@ TEST(LlvmLibcStrToFloatTest, SimpleDecimalConversionExtraTypes) { output_exp2 = 0; libc_errno = 0; - auto double_result = __llvm_libc::internal::simple_decimal_conversion<double>( - "123456789012345678900"); + auto double_result = + LIBC_NAMESPACE::internal::simple_decimal_conversion<double>( + "123456789012345678900"); double_output_mantissa = double_result.num.mantissa; output_exp2 = double_result.num.exponent; @@ -314,16 +318,16 @@ TEST_F(LlvmLibcStrToFloatTest, EiselLemireFloat80TableLimits) { TEST_F(LlvmLibcStrToFloatTest, EiselLemireFloat80Fallback) { // This number is halfway between two possible results, and the algorithm // can't determine which is correct. - ASSERT_FALSE(__llvm_libc::internal::eisel_lemire<long double>( + ASSERT_FALSE(LIBC_NAMESPACE::internal::eisel_lemire<long double>( {12345678901234567890u, 1}) .has_value()); // These numbers' exponents are out of range for the current powers of ten // table. - ASSERT_FALSE( - __llvm_libc::internal::eisel_lemire<long double>({1, 1000}).has_value()); - ASSERT_FALSE( - __llvm_libc::internal::eisel_lemire<long double>({1, -1000}).has_value()); + ASSERT_FALSE(LIBC_NAMESPACE::internal::eisel_lemire<long double>({1, 1000}) + .has_value()); + ASSERT_FALSE(LIBC_NAMESPACE::internal::eisel_lemire<long double>({1, -1000}) + .has_value()); } #else // Quad precision long double TEST_F(LlvmLibcStrToFloatTest, EiselLemireFloat128Simple) { @@ -348,7 +352,7 @@ TEST_F(LlvmLibcStrToFloatTest, EiselLemireFloat128LongerMantissa) { TEST_F(LlvmLibcStrToFloatTest, EiselLemireFloat128Fallback) { ASSERT_FALSE( - __llvm_libc::internal::eisel_lemire<long double>( + LIBC_NAMESPACE::internal::eisel_lemire<long double>( {(UInt128(0x5ce0e9a56015fec5) << 64) + UInt128(0xaadfa328ae39b333), 1}) .has_value()); diff --git a/libc/test/src/__support/uint_test.cpp b/libc/test/src/__support/uint_test.cpp index 3fe9b26..971bac5 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 8a896494..d5d2550 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 d44263a..b71d361 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 916aae3..10cdb96 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 80b0b1c..646756e 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 f34e0cb..97041fb 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 89b0c9a..f8a0804 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 fd49475..a9f84db 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 7c3ed36..4d57d67 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 c399cc4..ba7caf6 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 0896320..48378c4 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 3b82e19..ecf78e1 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 9777bb2..6e11919 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 5407c76..05b2fd06 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 b98d3bd..b8f27a9 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 d5dde8c..92f8072 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 2c2b7d9..3770ce4 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 d0879d4..0413b43 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 72f9f46..ff1a30a 100644 --- a/libc/test/src/dirent/dirent_test.cpp +++ b/libc/test/src/dirent/dirent_test.cpp @@ -17,20 +17,20 @@ #include <dirent.h> -using string_view = __llvm_libc::cpp::string_view; +using string_view = LIBC_NAMESPACE::cpp::string_view; TEST(LlvmLibcDirentTest, SimpleOpenAndRead) { - ::DIR *dir = __llvm_libc::opendir("testdata"); + ::DIR *dir = LIBC_NAMESPACE::opendir("testdata"); ASSERT_TRUE(dir != nullptr); // The file descriptors 0, 1 and 2 are reserved for standard streams. // So, the file descriptor for the newly opened directory should be // greater than 2. - ASSERT_GT(__llvm_libc::dirfd(dir), 2); + ASSERT_GT(LIBC_NAMESPACE::dirfd(dir), 2); struct ::dirent *file1 = nullptr, *file2 = nullptr, *dir1 = nullptr, *dir2 = nullptr; while (true) { - struct ::dirent *d = __llvm_libc::readdir(dir); + struct ::dirent *d = LIBC_NAMESPACE::readdir(dir); if (d == nullptr) break; if (string_view(&d->d_name[0]) == "file1.txt") @@ -51,12 +51,12 @@ TEST(LlvmLibcDirentTest, SimpleOpenAndRead) { ASSERT_TRUE(dir1 != nullptr); ASSERT_TRUE(dir2 != nullptr); - ASSERT_EQ(__llvm_libc::closedir(dir), 0); + ASSERT_EQ(LIBC_NAMESPACE::closedir(dir), 0); } TEST(LlvmLibcDirentTest, OpenNonExistentDir) { libc_errno = 0; - ::DIR *dir = __llvm_libc::opendir("___xyz123__.non_existent__"); + ::DIR *dir = LIBC_NAMESPACE::opendir("___xyz123__.non_existent__"); ASSERT_TRUE(dir == nullptr); ASSERT_EQ(libc_errno, ENOENT); libc_errno = 0; @@ -64,7 +64,7 @@ TEST(LlvmLibcDirentTest, OpenNonExistentDir) { TEST(LlvmLibcDirentTest, OpenFile) { libc_errno = 0; - ::DIR *dir = __llvm_libc::opendir("testdata/file1.txt"); + ::DIR *dir = LIBC_NAMESPACE::opendir("testdata/file1.txt"); ASSERT_TRUE(dir == nullptr); ASSERT_EQ(libc_errno, ENOTDIR); libc_errno = 0; diff --git a/libc/test/src/fcntl/creat_test.cpp b/libc/test/src/fcntl/creat_test.cpp index 1b0e8cb..ca926b3 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 73cce41..b95f3f2 100644 --- a/libc/test/src/fcntl/openat_test.cpp +++ b/libc/test/src/fcntl/openat_test.cpp @@ -17,27 +17,27 @@ #include <fcntl.h> TEST(LlvmLibcUniStd, OpenAndReadTest) { - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; constexpr const char *TEST_DIR = "testdata"; constexpr const char *TEST_FILE = "openat.test"; - int dir_fd = __llvm_libc::open(TEST_DIR, O_DIRECTORY); + int dir_fd = LIBC_NAMESPACE::open(TEST_DIR, O_DIRECTORY); ASSERT_EQ(libc_errno, 0); ASSERT_GT(dir_fd, 0); constexpr const char TEST_MSG[] = "openat test"; constexpr int TEST_MSG_SIZE = sizeof(TEST_MSG) - 1; - int read_fd = __llvm_libc::openat(dir_fd, TEST_FILE, O_RDONLY); + int read_fd = LIBC_NAMESPACE::openat(dir_fd, TEST_FILE, O_RDONLY); ASSERT_EQ(libc_errno, 0); ASSERT_GT(read_fd, 0); char read_buf[TEST_MSG_SIZE]; - ASSERT_THAT(__llvm_libc::read(read_fd, read_buf, TEST_MSG_SIZE), + ASSERT_THAT(LIBC_NAMESPACE::read(read_fd, read_buf, TEST_MSG_SIZE), Succeeds(TEST_MSG_SIZE)); - ASSERT_THAT(__llvm_libc::close(read_fd), Succeeds(0)); - ASSERT_THAT(__llvm_libc::close(dir_fd), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(read_fd), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(dir_fd), Succeeds(0)); } TEST(LlvmLibcUniStd, FailTest) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - EXPECT_THAT(__llvm_libc::openat(AT_FDCWD, "openat.test", O_RDONLY), + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + EXPECT_THAT(LIBC_NAMESPACE::openat(AT_FDCWD, "openat.test", O_RDONLY), Fails(ENOENT)); } diff --git a/libc/test/src/fenv/enabled_exceptions_test.cpp b/libc/test/src/fenv/enabled_exceptions_test.cpp index bb0c572..f950920 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 9d26fe7..434adc0 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 3563187..e4e2240 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 80414b2..fa3e856 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 c27a2bf..c891a55 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 40e336e..fe23ef2 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 1b3884a..96f253f 100644 --- a/libc/test/src/fenv/feupdateenv_test.cpp +++ b/libc/test/src/fenv/feupdateenv_test.cpp @@ -15,13 +15,13 @@ #include <signal.h> TEST(LlvmLibcFEnvTest, UpdateEnvTest) { - __llvm_libc::fputil::disable_except(FE_ALL_EXCEPT); - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); + LIBC_NAMESPACE::fputil::disable_except(FE_ALL_EXCEPT); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); fenv_t env; - ASSERT_EQ(__llvm_libc::fputil::get_env(&env), 0); - __llvm_libc::fputil::set_except(FE_INVALID | FE_INEXACT); - ASSERT_EQ(__llvm_libc::feupdateenv(&env), 0); - ASSERT_EQ(__llvm_libc::fputil::test_except(FE_INVALID | FE_INEXACT), + ASSERT_EQ(LIBC_NAMESPACE::fputil::get_env(&env), 0); + LIBC_NAMESPACE::fputil::set_except(FE_INVALID | FE_INEXACT); + ASSERT_EQ(LIBC_NAMESPACE::feupdateenv(&env), 0); + ASSERT_EQ(LIBC_NAMESPACE::fputil::test_except(FE_INVALID | FE_INEXACT), FE_INVALID | FE_INEXACT); } diff --git a/libc/test/src/fenv/getenv_and_setenv_test.cpp b/libc/test/src/fenv/getenv_and_setenv_test.cpp index 5fe2132..8184a5c 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 0f03b5f..4560160 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 7c98704..8d3a8a2 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 321aad5..59eb1d7 100644 --- a/libc/test/src/inttypes/imaxdiv_test.cpp +++ b/libc/test/src/inttypes/imaxdiv_test.cpp @@ -12,4 +12,4 @@ #include <inttypes.h> -LIST_DIV_TESTS(intmax_t, imaxdiv_t, __llvm_libc::imaxdiv) +LIST_DIV_TESTS(intmax_t, imaxdiv_t, LIBC_NAMESPACE::imaxdiv) diff --git a/libc/test/src/inttypes/strtoimax_test.cpp b/libc/test/src/inttypes/strtoimax_test.cpp index 3947e68..de76d62 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 77c6ded..82d7be9 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 78c1a08..d1e2b2e 100644 --- a/libc/test/src/math/CeilTest.h +++ b/libc/test/src/math/CeilTest.h @@ -12,9 +12,9 @@ #include <math.h> -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template <typename T> class CeilTest : public __llvm_libc::testing::Test { +template <typename T> class CeilTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/CopySignTest.h b/libc/test/src/math/CopySignTest.h index 3d1eed1..aecd012 100644 --- a/libc/test/src/math/CopySignTest.h +++ b/libc/test/src/math/CopySignTest.h @@ -12,9 +12,10 @@ #include <math.h> -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template <typename T> class CopySignTest : public __llvm_libc::testing::Test { +template <typename T> +class CopySignTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/FAbsTest.h b/libc/test/src/math/FAbsTest.h index 38b09cf..3342926 100644 --- a/libc/test/src/math/FAbsTest.h +++ b/libc/test/src/math/FAbsTest.h @@ -12,9 +12,9 @@ #include <math.h> -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template <typename T> class FAbsTest : public __llvm_libc::testing::Test { +template <typename T> class FAbsTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/FDimTest.h b/libc/test/src/math/FDimTest.h index c0dbda1..3118c36 100644 --- a/libc/test/src/math/FDimTest.h +++ b/libc/test/src/math/FDimTest.h @@ -13,10 +13,10 @@ #include <math.h> template <typename T> -class FDimTestTemplate : public __llvm_libc::testing::Test { +class FDimTestTemplate : public LIBC_NAMESPACE::testing::Test { public: using FuncPtr = T (*)(T, T); - using FPBits = __llvm_libc::fputil::FPBits<T>; + using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>; using UIntType = typename FPBits::UIntType; void test_na_n_arg(FuncPtr func) { @@ -74,9 +74,9 @@ public: private: // constexpr does not work on FPBits yet, so we cannot have these constants as // static. - const T nan = T(__llvm_libc::fputil::FPBits<T>::build_quiet_nan(1)); - const T inf = T(__llvm_libc::fputil::FPBits<T>::inf()); - const T neg_inf = T(__llvm_libc::fputil::FPBits<T>::neg_inf()); - const T zero = T(__llvm_libc::fputil::FPBits<T>::zero()); - const T neg_zero = T(__llvm_libc::fputil::FPBits<T>::neg_zero()); + const T nan = T(LIBC_NAMESPACE::fputil::FPBits<T>::build_quiet_nan(1)); + const T inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::inf()); + const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_inf()); + const T zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::zero()); + const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_zero()); }; diff --git a/libc/test/src/math/FMaxTest.h b/libc/test/src/math/FMaxTest.h index 0a6c767..e371086 100644 --- a/libc/test/src/math/FMaxTest.h +++ b/libc/test/src/math/FMaxTest.h @@ -12,9 +12,9 @@ #include <math.h> -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template <typename T> class FMaxTest : public __llvm_libc::testing::Test { +template <typename T> class FMaxTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/FMinTest.h b/libc/test/src/math/FMinTest.h index 10c87f9..7f8393a 100644 --- a/libc/test/src/math/FMinTest.h +++ b/libc/test/src/math/FMinTest.h @@ -12,9 +12,9 @@ #include <math.h> -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template <typename T> class FMinTest : public __llvm_libc::testing::Test { +template <typename T> class FMinTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/FModTest.h b/libc/test/src/math/FModTest.h index 6bff888..5fc0ebf 100644 --- a/libc/test/src/math/FModTest.h +++ b/libc/test/src/math/FModTest.h @@ -21,11 +21,11 @@ EXPECT_FP_EQ(expected, f(x, y)); \ EXPECT_MATH_ERRNO((dom_err) ? EDOM : 0); \ EXPECT_FP_EXCEPTION(expected_exception); \ - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT) + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT) #define TEST_REGULAR(x, y, expected) TEST_SPECIAL(x, y, expected, false, 0) -template <typename T> class FmodTest : public __llvm_libc::testing::Test { +template <typename T> class FmodTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/FloorTest.h b/libc/test/src/math/FloorTest.h index ce1075a..843c70b 100644 --- a/libc/test/src/math/FloorTest.h +++ b/libc/test/src/math/FloorTest.h @@ -12,9 +12,9 @@ #include <math.h> -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template <typename T> class FloorTest : public __llvm_libc::testing::Test { +template <typename T> class FloorTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/FmaTest.h b/libc/test/src/math/FmaTest.h index 3a5ed2b..c2573d0 100644 --- a/libc/test/src/math/FmaTest.h +++ b/libc/test/src/math/FmaTest.h @@ -15,25 +15,25 @@ #include "test/src/math/RandUtils.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; template <typename T> -class FmaTestTemplate : public __llvm_libc::testing::Test { +class FmaTestTemplate : public LIBC_NAMESPACE::testing::Test { private: using Func = T (*)(T, T, T); - using FPBits = __llvm_libc::fputil::FPBits<T>; + using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>; using UIntType = typename FPBits::UIntType; - const T nan = T(__llvm_libc::fputil::FPBits<T>::build_quiet_nan(1)); - const T inf = T(__llvm_libc::fputil::FPBits<T>::inf()); - const T neg_inf = T(__llvm_libc::fputil::FPBits<T>::neg_inf()); - const T zero = T(__llvm_libc::fputil::FPBits<T>::zero()); - const T neg_zero = T(__llvm_libc::fputil::FPBits<T>::neg_zero()); + const T nan = T(LIBC_NAMESPACE::fputil::FPBits<T>::build_quiet_nan(1)); + const T inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::inf()); + const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_inf()); + const T zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::zero()); + const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_zero()); UIntType get_random_bit_pattern() { UIntType bits{0}; for (UIntType i = 0; i < sizeof(UIntType) / 2; ++i) { - bits = - (bits << 2) + static_cast<uint16_t>(__llvm_libc::testutils::rand()); + bits = (bits << 2) + + static_cast<uint16_t>(LIBC_NAMESPACE::testutils::rand()); } return bits; } diff --git a/libc/test/src/math/FrexpTest.h b/libc/test/src/math/FrexpTest.h index 6bfb4d2..19c9887 100644 --- a/libc/test/src/math/FrexpTest.h +++ b/libc/test/src/math/FrexpTest.h @@ -13,14 +13,14 @@ #include <math.h> -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template <typename T> class FrexpTest : public __llvm_libc::testing::Test { +template <typename T> class FrexpTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) static constexpr UIntType HIDDEN_BIT = - UIntType(1) << __llvm_libc::fputil::MantissaWidth<T>::VALUE; + UIntType(1) << LIBC_NAMESPACE::fputil::MantissaWidth<T>::VALUE; public: typedef T (*FrexpFunc)(T, int *); @@ -103,8 +103,8 @@ public: mpfr::BinaryOutput<T> result; result.f = func(x, &result.i); - ASSERT_TRUE(__llvm_libc::fputil::abs(result.f) < 1.0); - ASSERT_TRUE(__llvm_libc::fputil::abs(result.f) >= 0.5); + ASSERT_TRUE(LIBC_NAMESPACE::fputil::abs(result.f) < 1.0); + ASSERT_TRUE(LIBC_NAMESPACE::fputil::abs(result.f) >= 0.5); ASSERT_MPFR_MATCH(mpfr::Operation::Frexp, x, result, 0.0); } } diff --git a/libc/test/src/math/HypotTest.h b/libc/test/src/math/HypotTest.h index d140926..c01a771 100644 --- a/libc/test/src/math/HypotTest.h +++ b/libc/test/src/math/HypotTest.h @@ -16,13 +16,13 @@ #include <math.h> -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; template <typename T> -class HypotTestTemplate : public __llvm_libc::testing::Test { +class HypotTestTemplate : public LIBC_NAMESPACE::testing::Test { private: using Func = T (*)(T, T); - using FPBits = __llvm_libc::fputil::FPBits<T>; + using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>; using UIntType = typename FPBits::UIntType; const T nan = T(FPBits::build_quiet_nan(1)); const T inf = T(FPBits::inf()); diff --git a/libc/test/src/math/ILogbTest.h b/libc/test/src/math/ILogbTest.h index 6ad5eb0..e51a5d7 100644 --- a/libc/test/src/math/ILogbTest.h +++ b/libc/test/src/math/ILogbTest.h @@ -16,7 +16,7 @@ #include <limits.h> -class LlvmLibcILogbTest : public __llvm_libc::testing::Test { +class LlvmLibcILogbTest : public LIBC_NAMESPACE::testing::Test { public: template <typename T> struct ILogbFunc { typedef int (*Func)(T); @@ -24,14 +24,15 @@ public: template <typename T> void test_special_numbers(typename ILogbFunc<T>::Func func) { - EXPECT_EQ(FP_ILOGB0, func(T(__llvm_libc::fputil::FPBits<T>::zero()))); - EXPECT_EQ(FP_ILOGB0, func(T(__llvm_libc::fputil::FPBits<T>::neg_zero()))); + EXPECT_EQ(FP_ILOGB0, func(T(LIBC_NAMESPACE::fputil::FPBits<T>::zero()))); + EXPECT_EQ(FP_ILOGB0, + func(T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_zero()))); EXPECT_EQ(FP_ILOGBNAN, - func(T(__llvm_libc::fputil::FPBits<T>::build_quiet_nan(1)))); + func(T(LIBC_NAMESPACE::fputil::FPBits<T>::build_quiet_nan(1)))); - EXPECT_EQ(INT_MAX, func(T(__llvm_libc::fputil::FPBits<T>::inf()))); - EXPECT_EQ(INT_MAX, func(T(__llvm_libc::fputil::FPBits<T>::neg_inf()))); + EXPECT_EQ(INT_MAX, func(T(LIBC_NAMESPACE::fputil::FPBits<T>::inf()))); + EXPECT_EQ(INT_MAX, func(T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_inf()))); } template <typename T> @@ -75,7 +76,7 @@ public: template <typename T> void test_subnormal_range(typename ILogbFunc<T>::Func func) { - using FPBits = __llvm_libc::fputil::FPBits<T>; + using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>; using UIntType = typename FPBits::UIntType; constexpr UIntType COUNT = 10'001; constexpr UIntType STEP = @@ -88,14 +89,14 @@ public: continue; int exponent; - __llvm_libc::fputil::frexp(x, exponent); + LIBC_NAMESPACE::fputil::frexp(x, exponent); ASSERT_EQ(exponent, func(x) + 1); } } template <typename T> void test_normal_range(typename ILogbFunc<T>::Func func) { - using FPBits = __llvm_libc::fputil::FPBits<T>; + using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>; using UIntType = typename FPBits::UIntType; constexpr UIntType COUNT = 10'001; constexpr UIntType STEP = @@ -106,7 +107,7 @@ public: 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 2e59299..bffa733 100644 --- a/libc/test/src/math/LdExpTest.h +++ b/libc/test/src/math/LdExpTest.h @@ -19,20 +19,20 @@ #include <stdint.h> template <typename T> -class LdExpTestTemplate : public __llvm_libc::testing::Test { - using FPBits = __llvm_libc::fputil::FPBits<T>; - using NormalFloat = __llvm_libc::fputil::NormalFloat<T>; +class LdExpTestTemplate : public LIBC_NAMESPACE::testing::Test { + using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>; + using NormalFloat = LIBC_NAMESPACE::fputil::NormalFloat<T>; using UIntType = typename FPBits::UIntType; static constexpr UIntType MANTISSA_WIDTH = - __llvm_libc::fputil::MantissaWidth<T>::VALUE; + LIBC_NAMESPACE::fputil::MantissaWidth<T>::VALUE; // A normalized mantissa to be used with tests. static constexpr UIntType MANTISSA = NormalFloat::ONE + 0x1234; - const T zero = T(__llvm_libc::fputil::FPBits<T>::zero()); - const T neg_zero = T(__llvm_libc::fputil::FPBits<T>::neg_zero()); - const T inf = T(__llvm_libc::fputil::FPBits<T>::inf()); - const T neg_inf = T(__llvm_libc::fputil::FPBits<T>::neg_inf()); - const T nan = T(__llvm_libc::fputil::FPBits<T>::build_quiet_nan(1)); + const T zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::zero()); + const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_zero()); + const T inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::inf()); + const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_inf()); + const T nan = T(LIBC_NAMESPACE::fputil::FPBits<T>::build_quiet_nan(1)); public: typedef T (*LdExpFunc)(T, int); diff --git a/libc/test/src/math/LogbTest.h b/libc/test/src/math/LogbTest.h index b4a17fd..c2cf4f1 100644 --- a/libc/test/src/math/LogbTest.h +++ b/libc/test/src/math/LogbTest.h @@ -13,14 +13,14 @@ #include <math.h> -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template <typename T> class LogbTest : public __llvm_libc::testing::Test { +template <typename T> class LogbTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) static constexpr UIntType HIDDEN_BIT = - UIntType(1) << __llvm_libc::fputil::MantissaWidth<T>::VALUE; + UIntType(1) << LIBC_NAMESPACE::fputil::MantissaWidth<T>::VALUE; public: typedef T (*LogbFunc)(T); @@ -80,7 +80,7 @@ public: 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 e4596c2..21adef8 100644 --- a/libc/test/src/math/ModfTest.h +++ b/libc/test/src/math/ModfTest.h @@ -14,9 +14,9 @@ #include <math.h> -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template <typename T> class ModfTest : public __llvm_libc::testing::Test { +template <typename T> class ModfTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) @@ -93,8 +93,8 @@ public: 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 e6de941..4e450cf 100644 --- a/libc/test/src/math/NextAfterTest.h +++ b/libc/test/src/math/NextAfterTest.h @@ -18,13 +18,13 @@ #include <math.h> template <typename T> -class NextAfterTestTemplate : public __llvm_libc::testing::Test { - using FPBits = __llvm_libc::fputil::FPBits<T>; - using MantissaWidth = __llvm_libc::fputil::MantissaWidth<T>; +class NextAfterTestTemplate : public LIBC_NAMESPACE::testing::Test { + using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>; + using MantissaWidth = LIBC_NAMESPACE::fputil::MantissaWidth<T>; using UIntType = typename FPBits::UIntType; static constexpr int BIT_WIDTH_OF_TYPE = - __llvm_libc::fputil::FloatProperties<T>::BIT_WIDTH; + LIBC_NAMESPACE::fputil::FloatProperties<T>::BIT_WIDTH; const T zero = T(FPBits::zero()); const T neg_zero = T(FPBits::neg_zero()); @@ -52,54 +52,54 @@ public: T x = zero; T result = func(x, T(1)); UIntType expected_bits = 1; - T expected = __llvm_libc::cpp::bit_cast<T>(expected_bits); + T expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits); ASSERT_FP_EQ(result, expected); result = func(x, T(-1)); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + 1; - expected = __llvm_libc::cpp::bit_cast<T>(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits); ASSERT_FP_EQ(result, expected); x = neg_zero; result = func(x, 1); expected_bits = 1; - expected = __llvm_libc::cpp::bit_cast<T>(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits); ASSERT_FP_EQ(result, expected); result = func(x, -1); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + 1; - expected = __llvm_libc::cpp::bit_cast<T>(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits); ASSERT_FP_EQ(result, expected); // 'from' is max subnormal value. - x = __llvm_libc::cpp::bit_cast<T>(max_subnormal); + x = LIBC_NAMESPACE::cpp::bit_cast<T>(max_subnormal); result = func(x, 1); - expected = __llvm_libc::cpp::bit_cast<T>(min_normal); + expected = LIBC_NAMESPACE::cpp::bit_cast<T>(min_normal); ASSERT_FP_EQ(result, expected); result = func(x, 0); expected_bits = max_subnormal - 1; - expected = __llvm_libc::cpp::bit_cast<T>(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits); ASSERT_FP_EQ(result, expected); x = -x; result = func(x, -1); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + min_normal; - expected = __llvm_libc::cpp::bit_cast<T>(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits); ASSERT_FP_EQ(result, expected); result = func(x, 0); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + max_subnormal - 1; - expected = __llvm_libc::cpp::bit_cast<T>(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits); ASSERT_FP_EQ(result, expected); // 'from' is min subnormal value. - x = __llvm_libc::cpp::bit_cast<T>(min_subnormal); + x = LIBC_NAMESPACE::cpp::bit_cast<T>(min_subnormal); result = func(x, 1); expected_bits = min_subnormal + 1; - expected = __llvm_libc::cpp::bit_cast<T>(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits); ASSERT_FP_EQ(result, expected); ASSERT_FP_EQ(func(x, 0), 0); @@ -107,35 +107,35 @@ public: result = func(x, -1); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + min_subnormal + 1; - expected = __llvm_libc::cpp::bit_cast<T>(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits); ASSERT_FP_EQ(result, expected); ASSERT_FP_EQ(func(x, 0), T(-0.0)); // 'from' is min normal. - x = __llvm_libc::cpp::bit_cast<T>(min_normal); + x = LIBC_NAMESPACE::cpp::bit_cast<T>(min_normal); result = func(x, 0); expected_bits = max_subnormal; - expected = __llvm_libc::cpp::bit_cast<T>(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits); ASSERT_FP_EQ(result, expected); result = func(x, inf); expected_bits = min_normal + 1; - expected = __llvm_libc::cpp::bit_cast<T>(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits); ASSERT_FP_EQ(result, expected); x = -x; result = func(x, 0); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + max_subnormal; - expected = __llvm_libc::cpp::bit_cast<T>(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits); ASSERT_FP_EQ(result, expected); result = func(x, -inf); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + min_normal + 1; - expected = __llvm_libc::cpp::bit_cast<T>(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits); ASSERT_FP_EQ(result, expected); // 'from' is max normal and 'to' is infinity. - x = __llvm_libc::cpp::bit_cast<T>(max_normal); + x = LIBC_NAMESPACE::cpp::bit_cast<T>(max_normal); result = func(x, inf); ASSERT_FP_EQ(result, inf); @@ -146,14 +146,14 @@ public: x = inf; result = func(x, 0); expected_bits = max_normal; - expected = __llvm_libc::cpp::bit_cast<T>(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits); ASSERT_FP_EQ(result, expected); ASSERT_FP_EQ(func(x, inf), inf); x = neg_inf; result = func(x, 0); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + max_normal; - expected = __llvm_libc::cpp::bit_cast<T>(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits); ASSERT_FP_EQ(result, expected); ASSERT_FP_EQ(func(x, neg_inf), neg_inf); diff --git a/libc/test/src/math/RIntTest.h b/libc/test/src/math/RIntTest.h index b181231..2721121 100644 --- a/libc/test/src/math/RIntTest.h +++ b/libc/test/src/math/RIntTest.h @@ -19,18 +19,18 @@ #include <math.h> #include <stdio.h> -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; static constexpr int ROUNDING_MODES[4] = {FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO, FE_TONEAREST}; template <typename T> -class RIntTestTemplate : public __llvm_libc::testing::Test { +class RIntTestTemplate : public LIBC_NAMESPACE::testing::Test { public: typedef T (*RIntFunc)(T); private: - using FPBits = __llvm_libc::fputil::FPBits<T>; + using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>; using UIntType = typename FPBits::UIntType; const T zero = T(FPBits::zero()); @@ -57,7 +57,7 @@ private: 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 @@ public: 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 @@ public: 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 @@ public: 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 @@ public: } 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 0ccc623..0d09764 100644 --- a/libc/test/src/math/RandUtils.cpp +++ b/libc/test/src/math/RandUtils.cpp @@ -10,10 +10,10 @@ #include <cstdlib> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testutils { int rand() { return std::rand(); } } // namespace testutils -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/src/math/RandUtils.h b/libc/test/src/math/RandUtils.h index b65a98b..05236ea 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 5766bef..6da0756 100644 --- a/libc/test/src/math/RemQuoTest.h +++ b/libc/test/src/math/RemQuoTest.h @@ -16,18 +16,18 @@ #include "utils/MPFRWrapper/MPFRUtils.h" #include <math.h> -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; template <typename T> -class RemQuoTestTemplate : public __llvm_libc::testing::Test { - using FPBits = __llvm_libc::fputil::FPBits<T>; +class RemQuoTestTemplate : public LIBC_NAMESPACE::testing::Test { + using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>; using UIntType = typename FPBits::UIntType; - const T zero = T(__llvm_libc::fputil::FPBits<T>::zero()); - const T neg_zero = T(__llvm_libc::fputil::FPBits<T>::neg_zero()); - const T inf = T(__llvm_libc::fputil::FPBits<T>::inf()); - const T neg_inf = T(__llvm_libc::fputil::FPBits<T>::neg_inf()); - const T nan = T(__llvm_libc::fputil::FPBits<T>::build_quiet_nan(1)); + const T zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::zero()); + const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_zero()); + const T inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::inf()); + const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_inf()); + const T nan = T(LIBC_NAMESPACE::fputil::FPBits<T>::build_quiet_nan(1)); public: typedef T (*RemQuoFunc)(T, T, int *); diff --git a/libc/test/src/math/RoundTest.h b/libc/test/src/math/RoundTest.h index 0e104e2..e99491c 100644 --- a/libc/test/src/math/RoundTest.h +++ b/libc/test/src/math/RoundTest.h @@ -12,9 +12,9 @@ #include <math.h> -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template <typename T> class RoundTest : public __llvm_libc::testing::Test { +template <typename T> class RoundTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/RoundToIntegerTest.h b/libc/test/src/math/RoundToIntegerTest.h index a7b85ed..6b20586 100644 --- a/libc/test/src/math/RoundToIntegerTest.h +++ b/libc/test/src/math/RoundToIntegerTest.h @@ -18,32 +18,32 @@ #include <errno.h> #include <math.h> -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; static constexpr int ROUNDING_MODES[4] = {FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO, FE_TONEAREST}; template <typename F, typename I, bool TestModes = false> -class RoundToIntegerTestTemplate : public __llvm_libc::testing::Test { +class RoundToIntegerTestTemplate : public LIBC_NAMESPACE::testing::Test { public: typedef I (*RoundToIntegerFunc)(F); private: - using FPBits = __llvm_libc::fputil::FPBits<F>; + using FPBits = LIBC_NAMESPACE::fputil::FPBits<F>; using UIntType = typename FPBits::UIntType; - const F zero = F(__llvm_libc::fputil::FPBits<F>::zero()); - const F neg_zero = F(__llvm_libc::fputil::FPBits<F>::neg_zero()); - const F inf = F(__llvm_libc::fputil::FPBits<F>::inf()); - const F neg_inf = F(__llvm_libc::fputil::FPBits<F>::neg_inf()); - const F nan = F(__llvm_libc::fputil::FPBits<F>::build_quiet_nan(1)); + const F zero = F(LIBC_NAMESPACE::fputil::FPBits<F>::zero()); + const F neg_zero = F(LIBC_NAMESPACE::fputil::FPBits<F>::neg_zero()); + const F inf = F(LIBC_NAMESPACE::fputil::FPBits<F>::inf()); + const F neg_inf = F(LIBC_NAMESPACE::fputil::FPBits<F>::neg_inf()); + const F nan = F(LIBC_NAMESPACE::fputil::FPBits<F>::build_quiet_nan(1)); static constexpr I INTEGER_MIN = I(1) << (sizeof(I) * 8 - 1); static constexpr I INTEGER_MAX = -(INTEGER_MIN + 1); void test_one_input(RoundToIntegerFunc func, F input, I expected, bool expectError) { libc_errno = 0; - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); ASSERT_EQ(func(input), expected); @@ -77,7 +77,7 @@ public: // 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 @@ public: 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 @@ public: 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 @@ public: 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 @@ public: bits.set_unbiased_exponent(EXPONENT_LIMIT + FPBits::EXPONENT_BIAS); bits.set_sign(1); bits.set_mantissa(UIntType(0x1) - << (__llvm_libc::fputil::MantissaWidth<F>::VALUE - 1)); + << (LIBC_NAMESPACE::fputil::MantissaWidth<F>::VALUE - 1)); F x = F(bits); if (TestModes) { for (int m : ROUNDING_MODES) { - __llvm_libc::fputil::set_round(m); + LIBC_NAMESPACE::fputil::set_round(m); long mpfr_long_result; bool erangeflag = mpfr::round_to_long(x, to_mpfr_rounding_mode(m), mpfr_long_result); @@ -226,22 +226,22 @@ public: // 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 @@ public: 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 f73a14a..24f14b7 100644 --- a/libc/test/src/math/SqrtTest.h +++ b/libc/test/src/math/SqrtTest.h @@ -13,14 +13,14 @@ #include <math.h> -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template <typename T> class SqrtTest : public __llvm_libc::testing::Test { +template <typename T> class SqrtTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) static constexpr UIntType HIDDEN_BIT = - UIntType(1) << __llvm_libc::fputil::MantissaWidth<T>::VALUE; + UIntType(1) << LIBC_NAMESPACE::fputil::MantissaWidth<T>::VALUE; public: typedef T (*SqrtFunc)(T); @@ -48,7 +48,7 @@ public: constexpr UIntType COUNT = 200'001; constexpr UIntType STEP = HIDDEN_BIT / COUNT; for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) { - T x = __llvm_libc::cpp::bit_cast<T>(v); + T x = LIBC_NAMESPACE::cpp::bit_cast<T>(v); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sqrt, x, func(x), 0.5); } } @@ -57,7 +57,7 @@ public: constexpr UIntType COUNT = 200'001; constexpr UIntType STEP = UIntType(-1) / COUNT; for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) { - T x = __llvm_libc::cpp::bit_cast<T>(v); + T x = LIBC_NAMESPACE::cpp::bit_cast<T>(v); if (isnan(x) || (x < 0)) { continue; } diff --git a/libc/test/src/math/TruncTest.h b/libc/test/src/math/TruncTest.h index 7d9e1cb..fa29ee1 100644 --- a/libc/test/src/math/TruncTest.h +++ b/libc/test/src/math/TruncTest.h @@ -12,9 +12,9 @@ #include <math.h> -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template <typename T> class TruncTest : public __llvm_libc::testing::Test { +template <typename T> class TruncTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/acosf_test.cpp b/libc/test/src/math/acosf_test.cpp index 63895ec..cb1a074 100644 --- a/libc/test/src/math/acosf_test.cpp +++ b/libc/test/src/math/acosf_test.cpp @@ -17,31 +17,31 @@ #include <errno.h> #include <stdint.h> -using FPBits = __llvm_libc::fputil::FPBits<float>; +using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>; -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcAcosfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(aNaN)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(inf)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(neg_inf)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(neg_inf)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::acosf(1.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::acosf(1.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(2.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(2.0f)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(-2.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(-2.0f)); EXPECT_MATH_ERRNO(EDOM); } @@ -53,7 +53,7 @@ TEST(LlvmLibcAcosfTest, InFloatRange) { if (isnan(x) || isinf(x)) continue; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Acos, x, - __llvm_libc::acosf(x), 0.5); + LIBC_NAMESPACE::acosf(x), 0.5); } } @@ -78,8 +78,8 @@ TEST(LlvmLibcAcosfTest, SpecificBitPatterns) { for (int i = 0; i < N; ++i) { float x = float(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Acos, x, - __llvm_libc::acosf(x), 0.5); + LIBC_NAMESPACE::acosf(x), 0.5); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Acos, -x, - __llvm_libc::acosf(-x), 0.5); + LIBC_NAMESPACE::acosf(-x), 0.5); } } diff --git a/libc/test/src/math/acoshf_test.cpp b/libc/test/src/math/acoshf_test.cpp index 895503c..846f503 100644 --- a/libc/test/src/math/acoshf_test.cpp +++ b/libc/test/src/math/acoshf_test.cpp @@ -17,28 +17,28 @@ #include <errno.h> #include <stdint.h> -using FPBits_t = __llvm_libc::fputil::FPBits<float>; +using FPBits_t = LIBC_NAMESPACE::fputil::FPBits<float>; -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcAcoshfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acoshf(aNaN)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acoshf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acoshf(0.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acoshf(0.0f)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::acoshf(1.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::acoshf(1.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::acoshf(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(inf, LIBC_NAMESPACE::acoshf(inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acoshf(neg_inf)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acoshf(neg_inf)); EXPECT_MATH_ERRNO(EDOM); } @@ -50,7 +50,7 @@ TEST(LlvmLibcAcoshfTest, InFloatRange) { if (isnan(x) || isinf(x)) continue; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Acosh, x, - __llvm_libc::acoshf(x), 0.5); + LIBC_NAMESPACE::acoshf(x), 0.5); } } @@ -74,6 +74,6 @@ TEST(LlvmLibcAcoshfTest, SpecificBitPatterns) { for (int i = 0; i < N; ++i) { float x = float(FPBits_t(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Acosh, x, - __llvm_libc::acoshf(x), 0.5); + LIBC_NAMESPACE::acoshf(x), 0.5); } } diff --git a/libc/test/src/math/asinf_test.cpp b/libc/test/src/math/asinf_test.cpp index cc99e5b..49dcd38 100644 --- a/libc/test/src/math/asinf_test.cpp +++ b/libc/test/src/math/asinf_test.cpp @@ -18,28 +18,28 @@ #include <errno.h> #include <stdint.h> -using FPBits = __llvm_libc::fputil::FPBits<float>; +using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>; -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcAsinfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinf(aNaN)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::asinf(0.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::asinf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, __llvm_libc::asinf(-0.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, LIBC_NAMESPACE::asinf(-0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinf(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinf(inf)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinf(neg_inf)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinf(neg_inf)); EXPECT_MATH_ERRNO(EDOM); } @@ -51,7 +51,7 @@ TEST(LlvmLibcAsinfTest, InFloatRange) { if (isnan(x) || isinf(x)) continue; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Asin, x, - __llvm_libc::asinf(x), 0.5); + LIBC_NAMESPACE::asinf(x), 0.5); } } @@ -74,8 +74,8 @@ TEST(LlvmLibcAsinfTest, SpecificBitPatterns) { for (int i = 0; i < N; ++i) { float x = float(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Asin, x, - __llvm_libc::asinf(x), 0.5); + LIBC_NAMESPACE::asinf(x), 0.5); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Asin, -x, - __llvm_libc::asinf(-x), 0.5); + LIBC_NAMESPACE::asinf(-x), 0.5); } } diff --git a/libc/test/src/math/asinhf_test.cpp b/libc/test/src/math/asinhf_test.cpp index cadb957..0bbd5db 100644 --- a/libc/test/src/math/asinhf_test.cpp +++ b/libc/test/src/math/asinhf_test.cpp @@ -17,28 +17,28 @@ #include <errno.h> #include <stdint.h> -using FPBits_t = __llvm_libc::fputil::FPBits<float>; +using FPBits_t = LIBC_NAMESPACE::fputil::FPBits<float>; -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcAsinhfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinhf(aNaN)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinhf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::asinhf(0.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::asinhf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, __llvm_libc::asinhf(-0.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, LIBC_NAMESPACE::asinhf(-0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::asinhf(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(inf, LIBC_NAMESPACE::asinhf(inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(neg_inf, __llvm_libc::asinhf(neg_inf)); + EXPECT_FP_EQ_ALL_ROUNDING(neg_inf, LIBC_NAMESPACE::asinhf(neg_inf)); EXPECT_MATH_ERRNO(0); } @@ -50,9 +50,9 @@ TEST(LlvmLibcAsinhfTest, InFloatRange) { if (isnan(x) || isinf(x)) continue; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Asinh, x, - __llvm_libc::asinhf(x), 0.5); + LIBC_NAMESPACE::asinhf(x), 0.5); ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Asinh, -x, - __llvm_libc::asinhf(-x), 0.5); + LIBC_NAMESPACE::asinhf(-x), 0.5); } } @@ -75,8 +75,8 @@ TEST(LlvmLibcAsinhfTest, SpecificBitPatterns) { for (int i = 0; i < N; ++i) { float x = float(FPBits_t(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Asinh, x, - __llvm_libc::asinhf(x), 0.5); + LIBC_NAMESPACE::asinhf(x), 0.5); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Asinh, -x, - __llvm_libc::asinhf(-x), 0.5); + LIBC_NAMESPACE::asinhf(-x), 0.5); } } diff --git a/libc/test/src/math/atanf_test.cpp b/libc/test/src/math/atanf_test.cpp index cd60b8d..c7eab7b 100644 --- a/libc/test/src/math/atanf_test.cpp +++ b/libc/test/src/math/atanf_test.cpp @@ -19,26 +19,26 @@ #include <initializer_list> -using FPBits = __llvm_libc::fputil::FPBits<float>; +using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>; -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcAtanfTest, SpecialNumbers) { libc_errno = 0; - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanf(aNaN)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanf(aNaN)); EXPECT_FP_EXCEPTION(0); EXPECT_MATH_ERRNO(0); - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::atanf(0.0f)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::atanf(0.0f)); EXPECT_FP_EXCEPTION(0); EXPECT_MATH_ERRNO(0); - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, __llvm_libc::atanf(-0.0f)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, LIBC_NAMESPACE::atanf(-0.0f)); EXPECT_FP_EXCEPTION(0); EXPECT_MATH_ERRNO(0); } @@ -49,9 +49,9 @@ TEST(LlvmLibcAtanfTest, InFloatRange) { for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) { float x = float(FPBits(v)); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Atan, x, - __llvm_libc::atanf(x), 0.5); + LIBC_NAMESPACE::atanf(x), 0.5); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Atan, -x, - __llvm_libc::atanf(-x), 0.5); + LIBC_NAMESPACE::atanf(-x), 0.5); } } @@ -61,6 +61,6 @@ TEST(LlvmLibcAtanfTest, SpecialValues) { 0x7F800000U, 0xFF800000U}) { float x = float(FPBits(v)); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Atan, x, - __llvm_libc::atanf(x), 0.5); + LIBC_NAMESPACE::atanf(x), 0.5); } } diff --git a/libc/test/src/math/atanhf_test.cpp b/libc/test/src/math/atanhf_test.cpp index 021a3f1..c1a8d19 100644 --- a/libc/test/src/math/atanhf_test.cpp +++ b/libc/test/src/math/atanhf_test.cpp @@ -17,70 +17,70 @@ #include <errno.h> #include <stdint.h> -using FPBits = __llvm_libc::fputil::FPBits<float>; +using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>; -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcAtanhfTest, SpecialNumbers) { libc_errno = 0; - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanhf(aNaN)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf(aNaN)); EXPECT_FP_EXCEPTION(0); EXPECT_MATH_ERRNO(0); - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::atanhf(0.0f)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::atanhf(0.0f)); EXPECT_FP_EXCEPTION(0); EXPECT_MATH_ERRNO(0); - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, __llvm_libc::atanhf(-0.0f)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, LIBC_NAMESPACE::atanhf(-0.0f)); EXPECT_FP_EXCEPTION(0); EXPECT_MATH_ERRNO(0); - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::atanhf(1.0f)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(inf, LIBC_NAMESPACE::atanhf(1.0f)); EXPECT_FP_EXCEPTION(FE_DIVBYZERO); EXPECT_MATH_ERRNO(ERANGE); - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(neg_inf, __llvm_libc::atanhf(-1.0f)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(neg_inf, LIBC_NAMESPACE::atanhf(-1.0f)); EXPECT_FP_EXCEPTION(FE_DIVBYZERO); EXPECT_MATH_ERRNO(ERANGE); auto bt = FPBits(1.0f); bt.bits += 1; - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanhf(bt.get_val())); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf(bt.get_val())); EXPECT_FP_EXCEPTION(FE_INVALID); EXPECT_MATH_ERRNO(EDOM); - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); bt.set_sign(true); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanhf(bt.get_val())); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf(bt.get_val())); EXPECT_FP_EXCEPTION(FE_INVALID); EXPECT_MATH_ERRNO(EDOM); - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanhf(2.0f)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf(2.0f)); EXPECT_FP_EXCEPTION(FE_INVALID); EXPECT_MATH_ERRNO(EDOM); - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanhf(-2.0f)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf(-2.0f)); EXPECT_FP_EXCEPTION(FE_INVALID); EXPECT_MATH_ERRNO(EDOM); - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanhf(inf)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf(inf)); EXPECT_FP_EXCEPTION(FE_INVALID); EXPECT_MATH_ERRNO(EDOM); bt.set_sign(true); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanhf(neg_inf)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf(neg_inf)); EXPECT_FP_EXCEPTION(FE_INVALID); EXPECT_MATH_ERRNO(EDOM); } @@ -90,20 +90,22 @@ TEST(LlvmLibcAtanhfTest, InFloatRange) { const uint32_t STEP = FPBits(1.0f).uintval() / COUNT; for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) { float x = float(FPBits(v)); - ASSERT_MPFR_MATCH(mpfr::Operation::Atanh, x, __llvm_libc::atanhf(x), 0.5); - ASSERT_MPFR_MATCH(mpfr::Operation::Atanh, -x, __llvm_libc::atanhf(-x), 0.5); + ASSERT_MPFR_MATCH(mpfr::Operation::Atanh, x, LIBC_NAMESPACE::atanhf(x), + 0.5); + ASSERT_MPFR_MATCH(mpfr::Operation::Atanh, -x, LIBC_NAMESPACE::atanhf(-x), + 0.5); } } // For small values, atanh(x) is x. TEST(LlvmLibcAtanhfTest, SmallValues) { float x = float(FPBits(uint32_t(0x17800000))); - float result = __llvm_libc::atanhf(x); + float result = LIBC_NAMESPACE::atanhf(x); EXPECT_MPFR_MATCH(mpfr::Operation::Atanh, x, result, 0.5); EXPECT_FP_EQ(x, result); x = float(FPBits(uint32_t(0x00400000))); - result = __llvm_libc::atanhf(x); + result = LIBC_NAMESPACE::atanhf(x); EXPECT_MPFR_MATCH(mpfr::Operation::Atanh, x, result, 0.5); EXPECT_FP_EQ(x, result); } diff --git a/libc/test/src/math/ceil_test.cpp b/libc/test/src/math/ceil_test.cpp index 2a592e3..800452a 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 cfa8cb2..2a25042 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 6fe3046..0f76660 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 37bfa0d..5b3d812 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 fec283c..344ffee 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 d1de911..bed6067 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 f93d869..6d8aeaf 100644 --- a/libc/test/src/math/cos_test.cpp +++ b/libc/test/src/math/cos_test.cpp @@ -13,7 +13,7 @@ #include <math.h> -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(double) @@ -27,6 +27,6 @@ TEST(LlvmLibccosTest, Range) { if (isnan(x) || isinf(x) || x > _2pi || x < -_2pi) continue; - ASSERT_MPFR_MATCH(mpfr::Operation::Cos, x, __llvm_libc::cos(x), 1.0); + ASSERT_MPFR_MATCH(mpfr::Operation::Cos, x, LIBC_NAMESPACE::cos(x), 1.0); } } diff --git a/libc/test/src/math/cosf_test.cpp b/libc/test/src/math/cosf_test.cpp index e9a7ea5..7b2fdf9 100644 --- a/libc/test/src/math/cosf_test.cpp +++ b/libc/test/src/math/cosf_test.cpp @@ -18,29 +18,29 @@ #include <errno.h> #include <stdint.h> -using __llvm_libc::testing::SDCOMP26094_VALUES; -using FPBits = __llvm_libc::fputil::FPBits<float>; +using LIBC_NAMESPACE::testing::SDCOMP26094_VALUES; +using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>; -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcCosfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ(aNaN, __llvm_libc::cosf(aNaN)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::cosf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(1.0f, __llvm_libc::cosf(0.0f)); + EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::cosf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(1.0f, __llvm_libc::cosf(-0.0f)); + EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::cosf(-0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(aNaN, __llvm_libc::cosf(inf)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::cosf(inf)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ(aNaN, __llvm_libc::cosf(neg_inf)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::cosf(neg_inf)); EXPECT_MATH_ERRNO(EDOM); } @@ -52,7 +52,7 @@ TEST(LlvmLibcCosfTest, InFloatRange) { if (isnan(x) || isinf(x)) continue; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Cos, x, - __llvm_libc::cosf(x), 0.5); + LIBC_NAMESPACE::cosf(x), 0.5); } } @@ -106,9 +106,9 @@ TEST(LlvmLibcCosfTest, SpecificBitPatterns) { for (int i = 0; i < N; ++i) { float x = float(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Cos, x, - __llvm_libc::cosf(x), 0.5); + LIBC_NAMESPACE::cosf(x), 0.5); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Cos, -x, - __llvm_libc::cosf(-x), 0.5); + LIBC_NAMESPACE::cosf(-x), 0.5); } } @@ -117,6 +117,6 @@ TEST(LlvmLibcCosfTest, SpecificBitPatterns) { TEST(LlvmLibcCosfTest, SDCOMP_26094) { for (uint32_t v : SDCOMP26094_VALUES) { float x = float(FPBits(v)); - ASSERT_MPFR_MATCH(mpfr::Operation::Cos, x, __llvm_libc::cosf(x), 0.5); + ASSERT_MPFR_MATCH(mpfr::Operation::Cos, x, LIBC_NAMESPACE::cosf(x), 0.5); } } diff --git a/libc/test/src/math/coshf_test.cpp b/libc/test/src/math/coshf_test.cpp index 90ce304..f45f35a 100644 --- a/libc/test/src/math/coshf_test.cpp +++ b/libc/test/src/math/coshf_test.cpp @@ -18,43 +18,43 @@ #include <errno.h> #include <stdint.h> -using FPBits = __llvm_libc::fputil::FPBits<float>; +using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>; -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcCoshfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ(aNaN, __llvm_libc::coshf(aNaN)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::coshf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(inf, __llvm_libc::coshf(inf)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::coshf(inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(inf, __llvm_libc::coshf(neg_inf)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::coshf(neg_inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(1.0f, __llvm_libc::coshf(0.0f)); + EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::coshf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(1.0f, __llvm_libc::coshf(-0.0f)); + EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::coshf(-0.0f)); EXPECT_MATH_ERRNO(0); } TEST(LlvmLibcCoshfTest, Overflow) { libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::coshf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::coshf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::coshf(float(FPBits(0x42cffff8U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::coshf(float(FPBits(0x42cffff8U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::coshf(float(FPBits(0x42d00008U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::coshf(float(FPBits(0x42d00008U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); } @@ -65,18 +65,18 @@ TEST(LlvmLibcCoshfTest, InFloatRange) { float x = float(FPBits(v)); if (isnan(x) || isinf(x)) continue; - ASSERT_MPFR_MATCH(mpfr::Operation::Cosh, x, __llvm_libc::coshf(x), 0.5); + ASSERT_MPFR_MATCH(mpfr::Operation::Cosh, x, LIBC_NAMESPACE::coshf(x), 0.5); } } TEST(LlvmLibcCoshfTest, SmallValues) { float x = float(FPBits(0x17800000U)); - float result = __llvm_libc::coshf(x); + float result = LIBC_NAMESPACE::coshf(x); EXPECT_MPFR_MATCH(mpfr::Operation::Cosh, x, result, 0.5); EXPECT_FP_EQ(1.0f, result); x = float(FPBits(0x0040000U)); - result = __llvm_libc::coshf(x); + result = LIBC_NAMESPACE::coshf(x); EXPECT_MPFR_MATCH(mpfr::Operation::Cosh, x, result, 0.5); EXPECT_FP_EQ(1.0f, result); } diff --git a/libc/test/src/math/differential_testing/BinaryOpSingleOutputDiff.h b/libc/test/src/math/differential_testing/BinaryOpSingleOutputDiff.h index ccab38e..1ea50de 100644 --- a/libc/test/src/math/differential_testing/BinaryOpSingleOutputDiff.h +++ b/libc/test/src/math/differential_testing/BinaryOpSingleOutputDiff.h @@ -11,7 +11,7 @@ #include <fstream> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { template <typename T> class BinaryOpSingleOutputDiff { @@ -141,18 +141,18 @@ public: }; } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #define BINARY_OP_SINGLE_OUTPUT_DIFF(T, myFunc, otherFunc, filename) \ int main() { \ - __llvm_libc::testing::BinaryOpSingleOutputDiff<T>::run_diff( \ + LIBC_NAMESPACE::testing::BinaryOpSingleOutputDiff<T>::run_diff( \ &myFunc, &otherFunc, filename); \ return 0; \ } #define BINARY_OP_SINGLE_OUTPUT_PERF(T, myFunc, otherFunc, filename) \ int main() { \ - __llvm_libc::testing::BinaryOpSingleOutputDiff<T>::run_perf( \ + LIBC_NAMESPACE::testing::BinaryOpSingleOutputDiff<T>::run_perf( \ &myFunc, &otherFunc, filename); \ return 0; \ } diff --git a/libc/test/src/math/differential_testing/SingleInputSingleOutputDiff.h b/libc/test/src/math/differential_testing/SingleInputSingleOutputDiff.h index 4805e1a..c20cf31 100644 --- a/libc/test/src/math/differential_testing/SingleInputSingleOutputDiff.h +++ b/libc/test/src/math/differential_testing/SingleInputSingleOutputDiff.h @@ -11,7 +11,7 @@ #include <fstream> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { template <typename T> class SingleInputSingleOutputDiff { @@ -100,18 +100,18 @@ public: }; } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #define SINGLE_INPUT_SINGLE_OUTPUT_DIFF(T, myFunc, otherFunc, filename) \ int main() { \ - __llvm_libc::testing::SingleInputSingleOutputDiff<T>::runDiff( \ + LIBC_NAMESPACE::testing::SingleInputSingleOutputDiff<T>::runDiff( \ &myFunc, &otherFunc, filename); \ return 0; \ } #define SINGLE_INPUT_SINGLE_OUTPUT_PERF(T, myFunc, otherFunc, filename) \ int main() { \ - __llvm_libc::testing::SingleInputSingleOutputDiff<T>::runPerf( \ + LIBC_NAMESPACE::testing::SingleInputSingleOutputDiff<T>::runPerf( \ &myFunc, &otherFunc, filename); \ return 0; \ } diff --git a/libc/test/src/math/differential_testing/Timer.cpp b/libc/test/src/math/differential_testing/Timer.cpp index 6780389..979196a 100644 --- a/libc/test/src/math/differential_testing/Timer.cpp +++ b/libc/test/src/math/differential_testing/Timer.cpp @@ -11,7 +11,7 @@ #include <chrono> #include <fstream> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { struct TimerImplementation { @@ -39,4 +39,4 @@ uint64_t Timer::nanoseconds() const { } } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/src/math/differential_testing/Timer.h b/libc/test/src/math/differential_testing/Timer.h index 9df13a0..d4acff7 100644 --- a/libc/test/src/math/differential_testing/Timer.h +++ b/libc/test/src/math/differential_testing/Timer.h @@ -11,7 +11,7 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { class Timer { @@ -28,6 +28,6 @@ public: }; } // 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 af911b4..7c0bb1e 100644 --- a/libc/test/src/math/differential_testing/ceilf_diff.cpp +++ b/libc/test/src/math/differential_testing/ceilf_diff.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::ceilf, ::ceilf, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::ceilf, ::ceilf, "ceilf_diff.log") diff --git a/libc/test/src/math/differential_testing/ceilf_perf.cpp b/libc/test/src/math/differential_testing/ceilf_perf.cpp index 2342039..c304231 100644 --- a/libc/test/src/math/differential_testing/ceilf_perf.cpp +++ b/libc/test/src/math/differential_testing/ceilf_perf.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::ceilf, ::ceilf, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::ceilf, ::ceilf, "ceilf_perf.log") diff --git a/libc/test/src/math/differential_testing/cosf_diff.cpp b/libc/test/src/math/differential_testing/cosf_diff.cpp index 232a3ce..ee310238 100644 --- a/libc/test/src/math/differential_testing/cosf_diff.cpp +++ b/libc/test/src/math/differential_testing/cosf_diff.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::cosf, ::cosf, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::cosf, ::cosf, "cosf_diff.log") diff --git a/libc/test/src/math/differential_testing/cosf_perf.cpp b/libc/test/src/math/differential_testing/cosf_perf.cpp index 3107d19..981a941 100644 --- a/libc/test/src/math/differential_testing/cosf_perf.cpp +++ b/libc/test/src/math/differential_testing/cosf_perf.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::cosf, ::cosf, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::cosf, ::cosf, "cosf_perf.log") diff --git a/libc/test/src/math/differential_testing/exp2f_diff.cpp b/libc/test/src/math/differential_testing/exp2f_diff.cpp index c1f279a..545c6de 100644 --- a/libc/test/src/math/differential_testing/exp2f_diff.cpp +++ b/libc/test/src/math/differential_testing/exp2f_diff.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::exp2f, ::exp2f, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::exp2f, ::exp2f, "exp2f_diff.log") diff --git a/libc/test/src/math/differential_testing/exp2f_perf.cpp b/libc/test/src/math/differential_testing/exp2f_perf.cpp index 2ffa593..4aae522 100644 --- a/libc/test/src/math/differential_testing/exp2f_perf.cpp +++ b/libc/test/src/math/differential_testing/exp2f_perf.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::exp2f, ::exp2f, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::exp2f, ::exp2f, "exp2f_perf.log") diff --git a/libc/test/src/math/differential_testing/expf_diff.cpp b/libc/test/src/math/differential_testing/expf_diff.cpp index a69efde..7c2e907 100644 --- a/libc/test/src/math/differential_testing/expf_diff.cpp +++ b/libc/test/src/math/differential_testing/expf_diff.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::expf, ::expf, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::expf, ::expf, "expf_diff.log") diff --git a/libc/test/src/math/differential_testing/expf_perf.cpp b/libc/test/src/math/differential_testing/expf_perf.cpp index 1a28fd1..c34173b 100644 --- a/libc/test/src/math/differential_testing/expf_perf.cpp +++ b/libc/test/src/math/differential_testing/expf_perf.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::expf, ::expf, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::expf, ::expf, "expf_perf.log") diff --git a/libc/test/src/math/differential_testing/expm1f_diff.cpp b/libc/test/src/math/differential_testing/expm1f_diff.cpp index e12072e..3cbd8a9 100644 --- a/libc/test/src/math/differential_testing/expm1f_diff.cpp +++ b/libc/test/src/math/differential_testing/expm1f_diff.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::expm1f, ::expm1f, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::expm1f, ::expm1f, "expm1f_diff.log") diff --git a/libc/test/src/math/differential_testing/expm1f_perf.cpp b/libc/test/src/math/differential_testing/expm1f_perf.cpp index 9e8e2df..3c25ef8 100644 --- a/libc/test/src/math/differential_testing/expm1f_perf.cpp +++ b/libc/test/src/math/differential_testing/expm1f_perf.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::expm1f, ::expm1f, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::expm1f, ::expm1f, "expm1f_perf.log") diff --git a/libc/test/src/math/differential_testing/fabsf_diff.cpp b/libc/test/src/math/differential_testing/fabsf_diff.cpp index 6bf11f6..9bf9eff 100644 --- a/libc/test/src/math/differential_testing/fabsf_diff.cpp +++ b/libc/test/src/math/differential_testing/fabsf_diff.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::fabsf, ::fabsf, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::fabsf, ::fabsf, "fabsf_diff.log") diff --git a/libc/test/src/math/differential_testing/fabsf_perf.cpp b/libc/test/src/math/differential_testing/fabsf_perf.cpp index 2fcf72d..f9f9cea 100644 --- a/libc/test/src/math/differential_testing/fabsf_perf.cpp +++ b/libc/test/src/math/differential_testing/fabsf_perf.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::fabsf, ::fabsf, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::fabsf, ::fabsf, "fabsf_perf.log") diff --git a/libc/test/src/math/differential_testing/floorf_diff.cpp b/libc/test/src/math/differential_testing/floorf_diff.cpp index 788214f..6d72927 100644 --- a/libc/test/src/math/differential_testing/floorf_diff.cpp +++ b/libc/test/src/math/differential_testing/floorf_diff.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::floorf, ::floorf, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::floorf, ::floorf, "floorf_diff.log") diff --git a/libc/test/src/math/differential_testing/floorf_perf.cpp b/libc/test/src/math/differential_testing/floorf_perf.cpp index 498cdc9..abd1cd7 100644 --- a/libc/test/src/math/differential_testing/floorf_perf.cpp +++ b/libc/test/src/math/differential_testing/floorf_perf.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::floorf, ::floorf, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::floorf, ::floorf, "floorf_perf.log") diff --git a/libc/test/src/math/differential_testing/fmod_diff.cpp b/libc/test/src/math/differential_testing/fmod_diff.cpp index c20a7c5..026e529 100644 --- a/libc/test/src/math/differential_testing/fmod_diff.cpp +++ b/libc/test/src/math/differential_testing/fmod_diff.cpp @@ -12,4 +12,5 @@ #include <math.h> -BINARY_OP_SINGLE_OUTPUT_DIFF(double, __llvm_libc::fmod, ::fmod, "fmod_diff.log") +BINARY_OP_SINGLE_OUTPUT_DIFF(double, LIBC_NAMESPACE::fmod, ::fmod, + "fmod_diff.log") diff --git a/libc/test/src/math/differential_testing/fmod_perf.cpp b/libc/test/src/math/differential_testing/fmod_perf.cpp index 37878be..219ee78 100644 --- a/libc/test/src/math/differential_testing/fmod_perf.cpp +++ b/libc/test/src/math/differential_testing/fmod_perf.cpp @@ -12,4 +12,5 @@ #include <math.h> -BINARY_OP_SINGLE_OUTPUT_PERF(double, __llvm_libc::fmod, ::fmod, "fmod_perf.log") +BINARY_OP_SINGLE_OUTPUT_PERF(double, LIBC_NAMESPACE::fmod, ::fmod, + "fmod_perf.log") diff --git a/libc/test/src/math/differential_testing/fmodf_diff.cpp b/libc/test/src/math/differential_testing/fmodf_diff.cpp index 634c639..7029b1e 100644 --- a/libc/test/src/math/differential_testing/fmodf_diff.cpp +++ b/libc/test/src/math/differential_testing/fmodf_diff.cpp @@ -12,5 +12,5 @@ #include <math.h> -BINARY_OP_SINGLE_OUTPUT_DIFF(float, __llvm_libc::fmodf, ::fmodf, +BINARY_OP_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::fmodf, ::fmodf, "fmodf_diff.log") diff --git a/libc/test/src/math/differential_testing/fmodf_perf.cpp b/libc/test/src/math/differential_testing/fmodf_perf.cpp index 36d0fe5..c2927bb 100644 --- a/libc/test/src/math/differential_testing/fmodf_perf.cpp +++ b/libc/test/src/math/differential_testing/fmodf_perf.cpp @@ -12,5 +12,5 @@ #include <math.h> -BINARY_OP_SINGLE_OUTPUT_PERF(float, __llvm_libc::fmodf, ::fmodf, +BINARY_OP_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::fmodf, ::fmodf, "fmodf_perf.log") diff --git a/libc/test/src/math/differential_testing/hypot_diff.cpp b/libc/test/src/math/differential_testing/hypot_diff.cpp index 28dbd2b..c61e589 100644 --- a/libc/test/src/math/differential_testing/hypot_diff.cpp +++ b/libc/test/src/math/differential_testing/hypot_diff.cpp @@ -12,5 +12,5 @@ #include <math.h> -BINARY_OP_SINGLE_OUTPUT_DIFF(double, __llvm_libc::hypot, ::hypot, +BINARY_OP_SINGLE_OUTPUT_DIFF(double, LIBC_NAMESPACE::hypot, ::hypot, "hypot_diff.log") diff --git a/libc/test/src/math/differential_testing/hypot_perf.cpp b/libc/test/src/math/differential_testing/hypot_perf.cpp index f906054..01a72e6 100644 --- a/libc/test/src/math/differential_testing/hypot_perf.cpp +++ b/libc/test/src/math/differential_testing/hypot_perf.cpp @@ -12,5 +12,5 @@ #include <math.h> -BINARY_OP_SINGLE_OUTPUT_PERF(double, __llvm_libc::hypot, ::hypot, +BINARY_OP_SINGLE_OUTPUT_PERF(double, LIBC_NAMESPACE::hypot, ::hypot, "hypot_perf.log") diff --git a/libc/test/src/math/differential_testing/hypotf_diff.cpp b/libc/test/src/math/differential_testing/hypotf_diff.cpp index e1ee9f2..d1c70fc 100644 --- a/libc/test/src/math/differential_testing/hypotf_diff.cpp +++ b/libc/test/src/math/differential_testing/hypotf_diff.cpp @@ -12,5 +12,5 @@ #include <math.h> -BINARY_OP_SINGLE_OUTPUT_DIFF(float, __llvm_libc::hypotf, ::hypotf, +BINARY_OP_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::hypotf, ::hypotf, "hypotf_diff.log") diff --git a/libc/test/src/math/differential_testing/hypotf_perf.cpp b/libc/test/src/math/differential_testing/hypotf_perf.cpp index 75c61cb..ed57b18 100644 --- a/libc/test/src/math/differential_testing/hypotf_perf.cpp +++ b/libc/test/src/math/differential_testing/hypotf_perf.cpp @@ -12,5 +12,5 @@ #include <math.h> -BINARY_OP_SINGLE_OUTPUT_PERF(float, __llvm_libc::hypotf, ::hypotf, +BINARY_OP_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::hypotf, ::hypotf, "hypotf_perf.log") diff --git a/libc/test/src/math/differential_testing/log10f_perf.cpp b/libc/test/src/math/differential_testing/log10f_perf.cpp index e890d03..60c1161 100644 --- a/libc/test/src/math/differential_testing/log10f_perf.cpp +++ b/libc/test/src/math/differential_testing/log10f_perf.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::log10f, ::log10f, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::log10f, ::log10f, "log10f_perf.log") diff --git a/libc/test/src/math/differential_testing/log1pf_perf.cpp b/libc/test/src/math/differential_testing/log1pf_perf.cpp index 9904aba..5cd523d 100644 --- a/libc/test/src/math/differential_testing/log1pf_perf.cpp +++ b/libc/test/src/math/differential_testing/log1pf_perf.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::log1pf, ::log1pf, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::log1pf, ::log1pf, "log1pf_perf.log") diff --git a/libc/test/src/math/differential_testing/log2f_diff.cpp b/libc/test/src/math/differential_testing/log2f_diff.cpp index 48aec5c..aef431d 100644 --- a/libc/test/src/math/differential_testing/log2f_diff.cpp +++ b/libc/test/src/math/differential_testing/log2f_diff.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::log2f, ::log2f, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::log2f, ::log2f, "log2f_diff.log") diff --git a/libc/test/src/math/differential_testing/log2f_perf.cpp b/libc/test/src/math/differential_testing/log2f_perf.cpp index 5bab271..ee89939 100644 --- a/libc/test/src/math/differential_testing/log2f_perf.cpp +++ b/libc/test/src/math/differential_testing/log2f_perf.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::log2f, ::log2f, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::log2f, ::log2f, "log2f_perf.log") diff --git a/libc/test/src/math/differential_testing/logbf_diff.cpp b/libc/test/src/math/differential_testing/logbf_diff.cpp index 93439c7..37441eb 100644 --- a/libc/test/src/math/differential_testing/logbf_diff.cpp +++ b/libc/test/src/math/differential_testing/logbf_diff.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::logbf, ::logbf, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::logbf, ::logbf, "logbf_diff.log") diff --git a/libc/test/src/math/differential_testing/logbf_perf.cpp b/libc/test/src/math/differential_testing/logbf_perf.cpp index 38fa331..89d5bd1 100644 --- a/libc/test/src/math/differential_testing/logbf_perf.cpp +++ b/libc/test/src/math/differential_testing/logbf_perf.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::logbf, ::logbf, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::logbf, ::logbf, "logbf_perf.log") diff --git a/libc/test/src/math/differential_testing/logf_diff.cpp b/libc/test/src/math/differential_testing/logf_diff.cpp index 6f5c1ef..4ed1307 100644 --- a/libc/test/src/math/differential_testing/logf_diff.cpp +++ b/libc/test/src/math/differential_testing/logf_diff.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::logf, ::logf, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::logf, ::logf, "logf_diff.log") diff --git a/libc/test/src/math/differential_testing/logf_perf.cpp b/libc/test/src/math/differential_testing/logf_perf.cpp index ed907ed..f1b3f98 100644 --- a/libc/test/src/math/differential_testing/logf_perf.cpp +++ b/libc/test/src/math/differential_testing/logf_perf.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::logf, ::logf, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::logf, ::logf, "logf_perf.log") diff --git a/libc/test/src/math/differential_testing/nearbyintf_diff.cpp b/libc/test/src/math/differential_testing/nearbyintf_diff.cpp index dfcf2fd..1420011 100644 --- a/libc/test/src/math/differential_testing/nearbyintf_diff.cpp +++ b/libc/test/src/math/differential_testing/nearbyintf_diff.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::nearbyintf, ::nearbyintf, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::nearbyintf, ::nearbyintf, "nearbyintf_diff.log") diff --git a/libc/test/src/math/differential_testing/nearbyintf_perf.cpp b/libc/test/src/math/differential_testing/nearbyintf_perf.cpp index 6ee98a9..9c5736f 100644 --- a/libc/test/src/math/differential_testing/nearbyintf_perf.cpp +++ b/libc/test/src/math/differential_testing/nearbyintf_perf.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::nearbyintf, ::nearbyintf, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::nearbyintf, ::nearbyintf, "nearbyintf_perf.log") diff --git a/libc/test/src/math/differential_testing/rintf_diff.cpp b/libc/test/src/math/differential_testing/rintf_diff.cpp index 2ed954d..e60f660 100644 --- a/libc/test/src/math/differential_testing/rintf_diff.cpp +++ b/libc/test/src/math/differential_testing/rintf_diff.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::rintf, ::rintf, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::rintf, ::rintf, "rintf_diff.log") diff --git a/libc/test/src/math/differential_testing/rintf_perf.cpp b/libc/test/src/math/differential_testing/rintf_perf.cpp index 517f04b..432e5da 100644 --- a/libc/test/src/math/differential_testing/rintf_perf.cpp +++ b/libc/test/src/math/differential_testing/rintf_perf.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::rintf, ::rintf, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::rintf, ::rintf, "rintf_perf.log") diff --git a/libc/test/src/math/differential_testing/roundf_diff.cpp b/libc/test/src/math/differential_testing/roundf_diff.cpp index 803566a..e1401a0 100644 --- a/libc/test/src/math/differential_testing/roundf_diff.cpp +++ b/libc/test/src/math/differential_testing/roundf_diff.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::roundf, ::roundf, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::roundf, ::roundf, "roundf_diff.log") diff --git a/libc/test/src/math/differential_testing/roundf_perf.cpp b/libc/test/src/math/differential_testing/roundf_perf.cpp index 51be6f1..091c7b2 100644 --- a/libc/test/src/math/differential_testing/roundf_perf.cpp +++ b/libc/test/src/math/differential_testing/roundf_perf.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::roundf, ::roundf, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::roundf, ::roundf, "roundf_perf.log") diff --git a/libc/test/src/math/differential_testing/sinf_diff.cpp b/libc/test/src/math/differential_testing/sinf_diff.cpp index d69db9b..cb4557e 100644 --- a/libc/test/src/math/differential_testing/sinf_diff.cpp +++ b/libc/test/src/math/differential_testing/sinf_diff.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::sinf, ::sinf, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::sinf, ::sinf, "sinf_diff.log") diff --git a/libc/test/src/math/differential_testing/sinf_perf.cpp b/libc/test/src/math/differential_testing/sinf_perf.cpp index b32821a..7247bca 100644 --- a/libc/test/src/math/differential_testing/sinf_perf.cpp +++ b/libc/test/src/math/differential_testing/sinf_perf.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::sinf, ::sinf, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::sinf, ::sinf, "sinf_perf.log") diff --git a/libc/test/src/math/differential_testing/sqrtf_diff.cpp b/libc/test/src/math/differential_testing/sqrtf_diff.cpp index 3fdcf93..22ddeaa 100644 --- a/libc/test/src/math/differential_testing/sqrtf_diff.cpp +++ b/libc/test/src/math/differential_testing/sqrtf_diff.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::sqrtf, ::sqrtf, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::sqrtf, ::sqrtf, "sqrtf_diff.log") diff --git a/libc/test/src/math/differential_testing/sqrtf_perf.cpp b/libc/test/src/math/differential_testing/sqrtf_perf.cpp index d3ceb9d..5ae586b 100644 --- a/libc/test/src/math/differential_testing/sqrtf_perf.cpp +++ b/libc/test/src/math/differential_testing/sqrtf_perf.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::sqrtf, ::sqrtf, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::sqrtf, ::sqrtf, "sqrtf_perf.log") diff --git a/libc/test/src/math/differential_testing/truncf_diff.cpp b/libc/test/src/math/differential_testing/truncf_diff.cpp index 30ed0fa..7f6ac4e 100644 --- a/libc/test/src/math/differential_testing/truncf_diff.cpp +++ b/libc/test/src/math/differential_testing/truncf_diff.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::truncf, ::truncf, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::truncf, ::truncf, "truncf_diff.log") diff --git a/libc/test/src/math/differential_testing/truncf_perf.cpp b/libc/test/src/math/differential_testing/truncf_perf.cpp index f5cee93..e07db13 100644 --- a/libc/test/src/math/differential_testing/truncf_perf.cpp +++ b/libc/test/src/math/differential_testing/truncf_perf.cpp @@ -12,5 +12,5 @@ #include <math.h> -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::truncf, ::truncf, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::truncf, ::truncf, "truncf_perf.log") diff --git a/libc/test/src/math/erff_test.cpp b/libc/test/src/math/erff_test.cpp index a25ac6f..3cb2477 100644 --- a/libc/test/src/math/erff_test.cpp +++ b/libc/test/src/math/erff_test.cpp @@ -16,17 +16,17 @@ #include <errno.h> #include <stdint.h> -namespace mpfr = __llvm_libc::testing::mpfr; -using __llvm_libc::testing::tlog; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcErffTest, SpecialNumbers) { - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::erff(aNaN)); - EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::erff(inf)); - EXPECT_FP_EQ_ALL_ROUNDING(-1.0f, __llvm_libc::erff(neg_inf)); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::erff(zero)); - EXPECT_FP_EQ_ALL_ROUNDING(neg_zero, __llvm_libc::erff(neg_zero)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::erff(aNaN)); + EXPECT_FP_EQ_ALL_ROUNDING(1.0f, LIBC_NAMESPACE::erff(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(-1.0f, LIBC_NAMESPACE::erff(neg_inf)); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::erff(zero)); + EXPECT_FP_EQ_ALL_ROUNDING(neg_zero, LIBC_NAMESPACE::erff(neg_zero)); } TEST(LlvmLibcErffTest, TrickyInputs) { @@ -38,9 +38,9 @@ TEST(LlvmLibcErffTest, TrickyInputs) { for (int i = 0; i < N; ++i) { float x = float(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Erf, x, - __llvm_libc::erff(x), 0.5); + LIBC_NAMESPACE::erff(x), 0.5); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Erf, -x, - __llvm_libc::erff(-x), 0.5); + LIBC_NAMESPACE::erff(-x), 0.5); } } @@ -67,7 +67,7 @@ TEST(LlvmLibcErffTest, InFloatRange) { if (isnan(x)) continue; - float result = __llvm_libc::erff(x); + float result = LIBC_NAMESPACE::erff(x); ++cc; if (isnan(result)) continue; diff --git a/libc/test/src/math/exhaustive/acosf_test.cpp b/libc/test/src/math/exhaustive/acosf_test.cpp index 4cece0b..df4adae 100644 --- a/libc/test/src/math/exhaustive/acosf_test.cpp +++ b/libc/test/src/math/exhaustive/acosf_test.cpp @@ -10,11 +10,11 @@ #include "src/math/acosf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcAcosfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Acos, - __llvm_libc::acosf>; + LIBC_NAMESPACE::acosf>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/acoshf_test.cpp b/libc/test/src/math/exhaustive/acoshf_test.cpp index 1dd993c..eff8b64 100644 --- a/libc/test/src/math/exhaustive/acoshf_test.cpp +++ b/libc/test/src/math/exhaustive/acoshf_test.cpp @@ -10,11 +10,11 @@ #include "src/math/acoshf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcAcoshfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Acosh, - __llvm_libc::acoshf>; + LIBC_NAMESPACE::acoshf>; // Range: [1, Inf]; static constexpr uint32_t POS_START = 0x3f80'0000U; diff --git a/libc/test/src/math/exhaustive/asinf_test.cpp b/libc/test/src/math/exhaustive/asinf_test.cpp index 5dcb625..f88d254 100644 --- a/libc/test/src/math/exhaustive/asinf_test.cpp +++ b/libc/test/src/math/exhaustive/asinf_test.cpp @@ -10,11 +10,11 @@ #include "src/math/asinf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcAsinfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Asin, - __llvm_libc::asinf>; + LIBC_NAMESPACE::asinf>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/asinhf_test.cpp b/libc/test/src/math/exhaustive/asinhf_test.cpp index 6af0ec0..8bc62bd 100644 --- a/libc/test/src/math/exhaustive/asinhf_test.cpp +++ b/libc/test/src/math/exhaustive/asinhf_test.cpp @@ -10,11 +10,11 @@ #include "src/math/asinhf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcAsinhfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Asinh, - __llvm_libc::asinhf>; + LIBC_NAMESPACE::asinhf>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/atanf_test.cpp b/libc/test/src/math/exhaustive/atanf_test.cpp index c7c891e..508c288 100644 --- a/libc/test/src/math/exhaustive/atanf_test.cpp +++ b/libc/test/src/math/exhaustive/atanf_test.cpp @@ -10,11 +10,11 @@ #include "src/math/atanf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcAtanfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Atan, - __llvm_libc::atanf>; + LIBC_NAMESPACE::atanf>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/atanhf_test.cpp b/libc/test/src/math/exhaustive/atanhf_test.cpp index 17bd6ec..d2e63b3 100644 --- a/libc/test/src/math/exhaustive/atanhf_test.cpp +++ b/libc/test/src/math/exhaustive/atanhf_test.cpp @@ -11,11 +11,11 @@ #include "src/math/atanhf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -using FPBits = __llvm_libc::fputil::FPBits<float>; +using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>; using LlvmLibcAtanhfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Atanh, - __llvm_libc::atanhf>; + LIBC_NAMESPACE::atanhf>; // Range: [0, 1.0]; static const uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/cosf_test.cpp b/libc/test/src/math/exhaustive/cosf_test.cpp index 465d824..89b7519 100644 --- a/libc/test/src/math/exhaustive/cosf_test.cpp +++ b/libc/test/src/math/exhaustive/cosf_test.cpp @@ -10,11 +10,11 @@ #include "src/math/cosf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcCosfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Cos, - __llvm_libc::cosf>; + LIBC_NAMESPACE::cosf>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/coshf_test.cpp b/libc/test/src/math/exhaustive/coshf_test.cpp index 5fb4856..cbfa654 100644 --- a/libc/test/src/math/exhaustive/coshf_test.cpp +++ b/libc/test/src/math/exhaustive/coshf_test.cpp @@ -10,11 +10,11 @@ #include "src/math/coshf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcCoshfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Cosh, - __llvm_libc::coshf>; + LIBC_NAMESPACE::coshf>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/erff_test.cpp b/libc/test/src/math/exhaustive/erff_test.cpp index f8e1a1b..5b8884a 100644 --- a/libc/test/src/math/exhaustive/erff_test.cpp +++ b/libc/test/src/math/exhaustive/erff_test.cpp @@ -10,11 +10,11 @@ #include "src/math/erff.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcErffExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Erf, - __llvm_libc::erff>; + LIBC_NAMESPACE::erff>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/exhaustive_test.h b/libc/test/src/math/exhaustive/exhaustive_test.h index 00dad03..c4e68d4 100644 --- a/libc/test/src/math/exhaustive/exhaustive_test.h +++ b/libc/test/src/math/exhaustive/exhaustive_test.h @@ -33,14 +33,14 @@ // or test_full_range_all_roundings(start, stop). // * For single input single output math function, use the convenient template: // LlvmLibcUnaryOpExhaustiveMathTest<FloatType, Op, Func>. -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; template <typename T> using UnaryOp = T(T); template <typename T, mpfr::Operation Op, UnaryOp<T> Func> -struct UnaryOpChecker : public virtual __llvm_libc::testing::Test { +struct UnaryOpChecker : public virtual LIBC_NAMESPACE::testing::Test { using FloatType = T; - using FPBits = __llvm_libc::fputil::FPBits<FloatType>; + using FPBits = LIBC_NAMESPACE::fputil::FPBits<FloatType>; using UIntType = typename FPBits::UIntType; static constexpr UnaryOp<FloatType> *FUNC = Func; @@ -67,11 +67,12 @@ struct UnaryOpChecker : public virtual __llvm_libc::testing::Test { } }; -// Checker class needs inherit from __llvm_libc::testing::Test and provide +// Checker class needs inherit from LIBC_NAMESPACE::testing::Test and provide // UIntType and check method. template <typename Checker> -struct LlvmLibcExhaustiveMathTest : public virtual __llvm_libc::testing::Test, - public Checker { +struct LlvmLibcExhaustiveMathTest + : public virtual LIBC_NAMESPACE::testing::Test, + public Checker { using FloatType = typename Checker::FloatType; using FPBits = typename Checker::FPBits; using UIntType = typename Checker::UIntType; diff --git a/libc/test/src/math/exhaustive/exp10f_test.cpp b/libc/test/src/math/exhaustive/exp10f_test.cpp index eba0f65..0daad67 100644 --- a/libc/test/src/math/exhaustive/exp10f_test.cpp +++ b/libc/test/src/math/exhaustive/exp10f_test.cpp @@ -10,11 +10,11 @@ #include "src/math/exp10f.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcExp10fExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Exp10, - __llvm_libc::exp10f>; + LIBC_NAMESPACE::exp10f>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/exp2f_test.cpp b/libc/test/src/math/exhaustive/exp2f_test.cpp index 8c9b889..6b91c36 100644 --- a/libc/test/src/math/exhaustive/exp2f_test.cpp +++ b/libc/test/src/math/exhaustive/exp2f_test.cpp @@ -10,11 +10,11 @@ #include "src/math/exp2f.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcExp2fExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Exp2, - __llvm_libc::exp2f>; + LIBC_NAMESPACE::exp2f>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/expf_test.cpp b/libc/test/src/math/exhaustive/expf_test.cpp index 75002a2..79ab794 100644 --- a/libc/test/src/math/exhaustive/expf_test.cpp +++ b/libc/test/src/math/exhaustive/expf_test.cpp @@ -10,11 +10,11 @@ #include "src/math/expf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcExpfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Exp, - __llvm_libc::expf>; + LIBC_NAMESPACE::expf>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/expm1f_test.cpp b/libc/test/src/math/exhaustive/expm1f_test.cpp index 2cd27f1..9c50f1a 100644 --- a/libc/test/src/math/exhaustive/expm1f_test.cpp +++ b/libc/test/src/math/exhaustive/expm1f_test.cpp @@ -10,11 +10,11 @@ #include "src/math/expm1f.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcExpm1fExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Expm1, - __llvm_libc::expm1f>; + LIBC_NAMESPACE::expm1f>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/fmod_generic_impl_test.cpp b/libc/test/src/math/exhaustive/fmod_generic_impl_test.cpp index 1273cf0..b47d24c 100644 --- a/libc/test/src/math/exhaustive/fmod_generic_impl_test.cpp +++ b/libc/test/src/math/exhaustive/fmod_generic_impl_test.cpp @@ -14,15 +14,15 @@ #include <array> #include <limits> -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; template <typename T, bool InverseMultiplication> -class LlvmLibcFModTest : public __llvm_libc::testing::Test { +class LlvmLibcFModTest : public LIBC_NAMESPACE::testing::Test { - using DivisionHelper = __llvm_libc::cpp::conditional_t< + using DivisionHelper = LIBC_NAMESPACE::cpp::conditional_t< InverseMultiplication, - __llvm_libc::fputil::generic::FModDivisionInvMultHelper<T>, - __llvm_libc::fputil::generic::FModDivisionSimpleHelper<T>>; + LIBC_NAMESPACE::fputil::generic::FModDivisionInvMultHelper<T>, + LIBC_NAMESPACE::fputil::generic::FModDivisionSimpleHelper<T>>; static constexpr std::array<T, 11> test_bases = { T(0.0), @@ -39,8 +39,8 @@ class LlvmLibcFModTest : public __llvm_libc::testing::Test { public: void testExtensive() { - using FMod = __llvm_libc::fputil::generic::FMod< - T, __llvm_libc::fputil::generic::FModFastMathWrapper<T>, + using FMod = LIBC_NAMESPACE::fputil::generic::FMod< + T, LIBC_NAMESPACE::fputil::generic::FModFastMathWrapper<T>, DivisionHelper>; using nl = std::numeric_limits<T>; int min2 = nl::min_exponent - nl::digits - 5; diff --git a/libc/test/src/math/exhaustive/hypotf_test.cpp b/libc/test/src/math/exhaustive/hypotf_test.cpp index c45e741..8812f0e 100644 --- a/libc/test/src/math/exhaustive/hypotf_test.cpp +++ b/libc/test/src/math/exhaustive/hypotf_test.cpp @@ -13,11 +13,11 @@ #include "test/UnitTest/FPMatcher.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -struct HypotfChecker : public virtual __llvm_libc::testing::Test { +struct HypotfChecker : public virtual LIBC_NAMESPACE::testing::Test { using FloatType = float; - using FPBits = __llvm_libc::fputil::FPBits<float>; + using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>; using UIntType = typename FPBits::UIntType; uint64_t check(uint32_t start, uint32_t stop, mpfr::RoundingMode rounding) { @@ -35,12 +35,12 @@ struct HypotfChecker : public virtual __llvm_libc::testing::Test { uint32_t ybits = Y_START; do { float y = float(FPBits(ybits)); - bool correct = TEST_FP_EQ(__llvm_libc::fputil::hypot(x, y), - __llvm_libc::hypotf(x, y)); + bool correct = TEST_FP_EQ(LIBC_NAMESPACE::fputil::hypot(x, y), + LIBC_NAMESPACE::hypotf(x, y)); // Using MPFR will be much slower. // mpfr::BinaryInput<float> input{x, y}; // bool correct = TEST_MPFR_MATCH_ROUNDING_SILENTLY( - // mpfr::Operation::Hypot, input, __llvm_libc::hypotf(x, y), 0.5, + // mpfr::Operation::Hypot, input, LIBC_NAMESPACE::hypotf(x, y), 0.5, // rounding); failed += (!correct); } while (ybits++ < Y_STOP); diff --git a/libc/test/src/math/exhaustive/log10f_test.cpp b/libc/test/src/math/exhaustive/log10f_test.cpp index 912fda1..d626df0 100644 --- a/libc/test/src/math/exhaustive/log10f_test.cpp +++ b/libc/test/src/math/exhaustive/log10f_test.cpp @@ -10,11 +10,11 @@ #include "src/math/log10f.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcLog10fExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Log10, - __llvm_libc::log10f>; + LIBC_NAMESPACE::log10f>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/log1pf_test.cpp b/libc/test/src/math/exhaustive/log1pf_test.cpp index 9927815..698e08e 100644 --- a/libc/test/src/math/exhaustive/log1pf_test.cpp +++ b/libc/test/src/math/exhaustive/log1pf_test.cpp @@ -10,11 +10,11 @@ #include "src/math/log1pf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcLog1pfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Log1p, - __llvm_libc::log1pf>; + LIBC_NAMESPACE::log1pf>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/log2f_test.cpp b/libc/test/src/math/exhaustive/log2f_test.cpp index 249ea2e..a84b096 100644 --- a/libc/test/src/math/exhaustive/log2f_test.cpp +++ b/libc/test/src/math/exhaustive/log2f_test.cpp @@ -10,11 +10,11 @@ #include "src/math/log2f.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcLog2fExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Log2, - __llvm_libc::log2f>; + LIBC_NAMESPACE::log2f>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/logf_test.cpp b/libc/test/src/math/exhaustive/logf_test.cpp index cf54ba5..2f0ff20 100644 --- a/libc/test/src/math/exhaustive/logf_test.cpp +++ b/libc/test/src/math/exhaustive/logf_test.cpp @@ -10,11 +10,11 @@ #include "src/math/logf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcLogfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Log, - __llvm_libc::logf>; + LIBC_NAMESPACE::logf>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/sincosf_test.cpp b/libc/test/src/math/exhaustive/sincosf_test.cpp index 1917924..f73a1a6 100644 --- a/libc/test/src/math/exhaustive/sincosf_test.cpp +++ b/libc/test/src/math/exhaustive/sincosf_test.cpp @@ -10,11 +10,11 @@ #include "src/math/sincosf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -struct SincosfChecker : public virtual __llvm_libc::testing::Test { +struct SincosfChecker : public virtual LIBC_NAMESPACE::testing::Test { using FloatType = float; - using FPBits = __llvm_libc::fputil::FPBits<float>; + using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>; using UIntType = uint32_t; uint64_t check(UIntType start, UIntType stop, mpfr::RoundingMode rounding) { @@ -27,7 +27,7 @@ struct SincosfChecker : public virtual __llvm_libc::testing::Test { FPBits xbits(bits); FloatType x = FloatType(xbits); FloatType sinx, cosx; - __llvm_libc::sincosf(x, &sinx, &cosx); + LIBC_NAMESPACE::sincosf(x, &sinx, &cosx); bool correct = TEST_MPFR_MATCH_ROUNDING_SILENTLY(mpfr::Operation::Sin, x, sinx, 0.5, rounding); diff --git a/libc/test/src/math/exhaustive/sinf_test.cpp b/libc/test/src/math/exhaustive/sinf_test.cpp index 1c0ce56..72255ae 100644 --- a/libc/test/src/math/exhaustive/sinf_test.cpp +++ b/libc/test/src/math/exhaustive/sinf_test.cpp @@ -10,11 +10,11 @@ #include "src/math/sinf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcSinfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Sin, - __llvm_libc::sinf>; + LIBC_NAMESPACE::sinf>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/sinhf_test.cpp b/libc/test/src/math/exhaustive/sinhf_test.cpp index 50f1094..51505af 100644 --- a/libc/test/src/math/exhaustive/sinhf_test.cpp +++ b/libc/test/src/math/exhaustive/sinhf_test.cpp @@ -10,11 +10,11 @@ #include "src/math/sinhf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcSinhfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Sinh, - __llvm_libc::sinhf>; + LIBC_NAMESPACE::sinhf>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/sqrtf_test.cpp b/libc/test/src/math/exhaustive/sqrtf_test.cpp index e475182..6f76132 100644 --- a/libc/test/src/math/exhaustive/sqrtf_test.cpp +++ b/libc/test/src/math/exhaustive/sqrtf_test.cpp @@ -10,11 +10,11 @@ #include "src/math/sqrtf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcSqrtfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Sqrt, - __llvm_libc::sqrtf>; + LIBC_NAMESPACE::sqrtf>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/tanf_test.cpp b/libc/test/src/math/exhaustive/tanf_test.cpp index 9e1278b4..09e63ea 100644 --- a/libc/test/src/math/exhaustive/tanf_test.cpp +++ b/libc/test/src/math/exhaustive/tanf_test.cpp @@ -11,11 +11,11 @@ #include "src/math/tanf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcTanfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Tan, - __llvm_libc::tanf>; + LIBC_NAMESPACE::tanf>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/tanhf_test.cpp b/libc/test/src/math/exhaustive/tanhf_test.cpp index 3c3951c..e341064 100644 --- a/libc/test/src/math/exhaustive/tanhf_test.cpp +++ b/libc/test/src/math/exhaustive/tanhf_test.cpp @@ -10,11 +10,11 @@ #include "src/math/tanhf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcTanhfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest<float, mpfr::Operation::Tanh, - __llvm_libc::tanhf>; + LIBC_NAMESPACE::tanhf>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exp10_test.cpp b/libc/test/src/math/exp10_test.cpp index 2b4c5cc..86d902e 100644 --- a/libc/test/src/math/exp10_test.cpp +++ b/libc/test/src/math/exp10_test.cpp @@ -17,20 +17,21 @@ #include <errno.h> #include <stdint.h> -namespace mpfr = __llvm_libc::testing::mpfr; -using __llvm_libc::testing::tlog; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(double) TEST(LlvmLibcExp10Test, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::exp10(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::exp10(inf)); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::exp10(neg_inf)); - EXPECT_FP_EQ_WITH_EXCEPTION(zero, __llvm_libc::exp10(-0x1.0p20), + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp10(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::exp10(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::exp10(neg_inf)); + EXPECT_FP_EQ_WITH_EXCEPTION(zero, LIBC_NAMESPACE::exp10(-0x1.0p20), FE_UNDERFLOW); - EXPECT_FP_EQ_WITH_EXCEPTION(inf, __llvm_libc::exp10(0x1.0p20), FE_OVERFLOW); - EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp10(0.0)); - EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp10(-0.0)); + EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp10(0x1.0p20), + FE_OVERFLOW); + EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp10(0.0)); + EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp10(-0.0)); } TEST(LlvmLibcExp10Test, TrickyInputs) { @@ -80,14 +81,14 @@ TEST(LlvmLibcExp10Test, TrickyInputs) { for (int i = 0; i < N; ++i) { double x = double(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp10, x, - __llvm_libc::exp10(x), 0.5); + LIBC_NAMESPACE::exp10(x), 0.5); } } TEST(LlvmLibcExp10Test, InDoubleRange) { constexpr uint64_t COUNT = 1'231; - uint64_t START = __llvm_libc::fputil::FPBits<double>(0.25).uintval(); - uint64_t STOP = __llvm_libc::fputil::FPBits<double>(4.0).uintval(); + uint64_t START = LIBC_NAMESPACE::fputil::FPBits<double>(0.25).uintval(); + uint64_t STOP = LIBC_NAMESPACE::fputil::FPBits<double>(4.0).uintval(); uint64_t STEP = (STOP - START) / COUNT; auto test = [&](mpfr::RoundingMode rounding_mode) { @@ -106,7 +107,7 @@ TEST(LlvmLibcExp10Test, InDoubleRange) { if (isnan(x) || isinf(x) || x < 0.0) continue; libc_errno = 0; - double result = __llvm_libc::exp10(x); + double result = LIBC_NAMESPACE::exp10(x); ++cc; if (isnan(result) || isinf(result)) continue; diff --git a/libc/test/src/math/exp10f_test.cpp b/libc/test/src/math/exp10f_test.cpp index 384f906..ac8f551 100644 --- a/libc/test/src/math/exp10f_test.cpp +++ b/libc/test/src/math/exp10f_test.cpp @@ -16,58 +16,58 @@ #include <stdint.h> -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcExp10fTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ(aNaN, __llvm_libc::exp10f(aNaN)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp10f(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(inf, __llvm_libc::exp10f(inf)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::exp10f(inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(0.0f, __llvm_libc::exp10f(neg_inf)); + EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::exp10f(neg_inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(1.0f, __llvm_libc::exp10f(0.0f)); + EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::exp10f(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(1.0f, __llvm_libc::exp10f(-0.0f)); + EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::exp10f(-0.0f)); EXPECT_MATH_ERRNO(0); } TEST(LlvmLibcExp10fTest, Overflow) { libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::exp10f(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::exp10f(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::exp10f(float(FPBits(0x43000000U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::exp10f(float(FPBits(0x43000000U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::exp10f(float(FPBits(0x43000001U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::exp10f(float(FPBits(0x43000001U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); } TEST(LlvmLibcExp10fTest, Underflow) { libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( - 0.0f, __llvm_libc::exp10f(float(FPBits(0xff7fffffU))), FE_UNDERFLOW); + 0.0f, LIBC_NAMESPACE::exp10f(float(FPBits(0xff7fffffU))), FE_UNDERFLOW); EXPECT_MATH_ERRNO(ERANGE); float x = float(FPBits(0xc2cffff8U)); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp10, x, - __llvm_libc::exp10f(x), 0.5); + LIBC_NAMESPACE::exp10f(x), 0.5); EXPECT_MATH_ERRNO(ERANGE); x = float(FPBits(0xc2d00008U)); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp10, x, - __llvm_libc::exp10f(x), 0.5); + LIBC_NAMESPACE::exp10f(x), 0.5); EXPECT_MATH_ERRNO(ERANGE); } @@ -99,9 +99,9 @@ TEST(LlvmLibcExp10fTest, TrickyInputs) { libc_errno = 0; float x = float(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp10, x, - __llvm_libc::exp10f(x), 0.5); + LIBC_NAMESPACE::exp10f(x), 0.5); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp10, -x, - __llvm_libc::exp10f(-x), 0.5); + LIBC_NAMESPACE::exp10f(-x), 0.5); } } @@ -113,7 +113,7 @@ TEST(LlvmLibcExp10fTest, InFloatRange) { if (isnan(x) || isinf(x)) continue; libc_errno = 0; - float result = __llvm_libc::exp10f(x); + float result = LIBC_NAMESPACE::exp10f(x); // If the computation resulted in an error or did not produce valid result // in the single-precision floating point range, then ignore comparing with @@ -122,6 +122,6 @@ TEST(LlvmLibcExp10fTest, InFloatRange) { if (isnan(result) || isinf(result) || libc_errno != 0) continue; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp10, x, - __llvm_libc::exp10f(x), 0.5); + LIBC_NAMESPACE::exp10f(x), 0.5); } } diff --git a/libc/test/src/math/exp2_test.cpp b/libc/test/src/math/exp2_test.cpp index 6108169..6a90c9ba9 100644 --- a/libc/test/src/math/exp2_test.cpp +++ b/libc/test/src/math/exp2_test.cpp @@ -17,19 +17,20 @@ #include <errno.h> #include <stdint.h> -namespace mpfr = __llvm_libc::testing::mpfr; -using __llvm_libc::testing::tlog; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(double) TEST(LlvmLibcExp2Test, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::exp2(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::exp2(inf)); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::exp2(neg_inf)); - EXPECT_FP_EQ_WITH_EXCEPTION(zero, __llvm_libc::exp2(-0x1.0p20), FE_UNDERFLOW); - EXPECT_FP_EQ_WITH_EXCEPTION(inf, __llvm_libc::exp2(0x1.0p20), FE_OVERFLOW); - EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp2(0.0)); - EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp2(-0.0)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp2(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::exp2(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::exp2(neg_inf)); + EXPECT_FP_EQ_WITH_EXCEPTION(zero, LIBC_NAMESPACE::exp2(-0x1.0p20), + FE_UNDERFLOW); + EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp2(0x1.0p20), FE_OVERFLOW); + EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp2(0.0)); + EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp2(-0.0)); } TEST(LlvmLibcExp2Test, TrickyInputs) { @@ -55,14 +56,14 @@ TEST(LlvmLibcExp2Test, TrickyInputs) { for (int i = 0; i < N; ++i) { double x = double(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp2, x, - __llvm_libc::exp2(x), 0.5); + LIBC_NAMESPACE::exp2(x), 0.5); } } TEST(LlvmLibcExp2Test, InDoubleRange) { constexpr uint64_t COUNT = 1'231; - uint64_t START = __llvm_libc::fputil::FPBits<double>(0.25).uintval(); - uint64_t STOP = __llvm_libc::fputil::FPBits<double>(4.0).uintval(); + uint64_t START = LIBC_NAMESPACE::fputil::FPBits<double>(0.25).uintval(); + uint64_t STOP = LIBC_NAMESPACE::fputil::FPBits<double>(4.0).uintval(); uint64_t STEP = (STOP - START) / COUNT; auto test = [&](mpfr::RoundingMode rounding_mode) { @@ -81,7 +82,7 @@ TEST(LlvmLibcExp2Test, InDoubleRange) { if (isnan(x) || isinf(x) || x < 0.0) continue; libc_errno = 0; - double result = __llvm_libc::exp2(x); + double result = LIBC_NAMESPACE::exp2(x); ++cc; if (isnan(result) || isinf(result)) continue; diff --git a/libc/test/src/math/exp2f_test.cpp b/libc/test/src/math/exp2f_test.cpp index afd2c0f..987e1b9 100644 --- a/libc/test/src/math/exp2f_test.cpp +++ b/libc/test/src/math/exp2f_test.cpp @@ -17,41 +17,41 @@ #include <stdint.h> -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcExp2fTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ(aNaN, __llvm_libc::exp2f(aNaN)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp2f(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(inf, __llvm_libc::exp2f(inf)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::exp2f(inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(0.0f, __llvm_libc::exp2f(neg_inf)); + EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::exp2f(neg_inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(1.0f, __llvm_libc::exp2f(0.0f)); + EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::exp2f(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(1.0f, __llvm_libc::exp2f(-0.0f)); + EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::exp2f(-0.0f)); EXPECT_MATH_ERRNO(0); } TEST(LlvmLibcExp2fTest, Overflow) { libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::exp2f(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::exp2f(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::exp2f(float(FPBits(0x43000000U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::exp2f(float(FPBits(0x43000000U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::exp2f(float(FPBits(0x43000001U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::exp2f(float(FPBits(0x43000001U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); } @@ -75,7 +75,7 @@ TEST(LlvmLibcExp2fTest, TrickyInputs) { libc_errno = 0; float x = float(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp2, x, - __llvm_libc::exp2f(x), 0.5); + LIBC_NAMESPACE::exp2f(x), 0.5); EXPECT_MATH_ERRNO(0); } } @@ -83,22 +83,22 @@ TEST(LlvmLibcExp2fTest, TrickyInputs) { TEST(LlvmLibcExp2fTest, Underflow) { libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( - 0.0f, __llvm_libc::exp2f(float(FPBits(0xff7fffffU))), FE_UNDERFLOW); + 0.0f, LIBC_NAMESPACE::exp2f(float(FPBits(0xff7fffffU))), FE_UNDERFLOW); EXPECT_MATH_ERRNO(ERANGE); float x = float(FPBits(0xc3158000U)); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp2, x, - __llvm_libc::exp2f(x), 0.5); + LIBC_NAMESPACE::exp2f(x), 0.5); EXPECT_MATH_ERRNO(0); x = float(FPBits(0xc3160000U)); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp2, x, - __llvm_libc::exp2f(x), 0.5); + LIBC_NAMESPACE::exp2f(x), 0.5); EXPECT_MATH_ERRNO(ERANGE); x = float(FPBits(0xc3165432U)); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp2, x, - __llvm_libc::exp2f(x), 0.5); + LIBC_NAMESPACE::exp2f(x), 0.5); EXPECT_MATH_ERRNO(ERANGE); } @@ -110,7 +110,7 @@ TEST(LlvmLibcExp2fTest, InFloatRange) { if (isnan(x) || isinf(x)) continue; libc_errno = 0; - float result = __llvm_libc::exp2f(x); + float result = LIBC_NAMESPACE::exp2f(x); // If the computation resulted in an error or did not produce valid result // in the single-precision floating point range, then ignore comparing with @@ -119,6 +119,6 @@ TEST(LlvmLibcExp2fTest, InFloatRange) { if (isnan(result) || isinf(result) || libc_errno != 0) continue; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp2, x, - __llvm_libc::exp2f(x), 0.5); + LIBC_NAMESPACE::exp2f(x), 0.5); } } diff --git a/libc/test/src/math/exp_test.cpp b/libc/test/src/math/exp_test.cpp index 7ff149a..06894bc 100644 --- a/libc/test/src/math/exp_test.cpp +++ b/libc/test/src/math/exp_test.cpp @@ -17,19 +17,20 @@ #include <errno.h> #include <stdint.h> -namespace mpfr = __llvm_libc::testing::mpfr; -using __llvm_libc::testing::tlog; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(double) TEST(LlvmLibcExpTest, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::exp(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::exp(inf)); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::exp(neg_inf)); - EXPECT_FP_EQ_WITH_EXCEPTION(zero, __llvm_libc::exp(-0x1.0p20), FE_UNDERFLOW); - EXPECT_FP_EQ_WITH_EXCEPTION(inf, __llvm_libc::exp(0x1.0p20), FE_OVERFLOW); - EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp(0.0)); - EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp(-0.0)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::exp(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::exp(neg_inf)); + EXPECT_FP_EQ_WITH_EXCEPTION(zero, LIBC_NAMESPACE::exp(-0x1.0p20), + FE_UNDERFLOW); + EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp(0x1.0p20), FE_OVERFLOW); + EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp(0.0)); + EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp(-0.0)); } TEST(LlvmLibcExpTest, TrickyInputs) { @@ -52,15 +53,15 @@ TEST(LlvmLibcExpTest, TrickyInputs) { }; for (int i = 0; i < N; ++i) { double x = double(FPBits(INPUTS[i])); - EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, __llvm_libc::exp(x), - 0.5); + EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, + LIBC_NAMESPACE::exp(x), 0.5); } } TEST(LlvmLibcExpTest, InDoubleRange) { constexpr uint64_t COUNT = 1'231; - uint64_t START = __llvm_libc::fputil::FPBits<double>(0.25).uintval(); - uint64_t STOP = __llvm_libc::fputil::FPBits<double>(4.0).uintval(); + uint64_t START = LIBC_NAMESPACE::fputil::FPBits<double>(0.25).uintval(); + uint64_t STOP = LIBC_NAMESPACE::fputil::FPBits<double>(4.0).uintval(); uint64_t STEP = (STOP - START) / COUNT; auto test = [&](mpfr::RoundingMode rounding_mode) { @@ -79,7 +80,7 @@ TEST(LlvmLibcExpTest, InDoubleRange) { if (isnan(x) || isinf(x) || x < 0.0) continue; libc_errno = 0; - double result = __llvm_libc::exp(x); + double result = LIBC_NAMESPACE::exp(x); ++cc; if (isnan(result) || isinf(result)) continue; diff --git a/libc/test/src/math/expf_test.cpp b/libc/test/src/math/expf_test.cpp index acc0e64..f015e46 100644 --- a/libc/test/src/math/expf_test.cpp +++ b/libc/test/src/math/expf_test.cpp @@ -16,58 +16,58 @@ #include <stdint.h> -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcExpfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ(aNaN, __llvm_libc::expf(aNaN)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::expf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(inf, __llvm_libc::expf(inf)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::expf(inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(0.0f, __llvm_libc::expf(neg_inf)); + EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::expf(neg_inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(1.0f, __llvm_libc::expf(0.0f)); + EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::expf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(1.0f, __llvm_libc::expf(-0.0f)); + EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::expf(-0.0f)); EXPECT_MATH_ERRNO(0); } TEST(LlvmLibcExpfTest, Overflow) { libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::expf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::expf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::expf(float(FPBits(0x42cffff8U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::expf(float(FPBits(0x42cffff8U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::expf(float(FPBits(0x42d00008U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::expf(float(FPBits(0x42d00008U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); } TEST(LlvmLibcExpfTest, Underflow) { libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( - 0.0f, __llvm_libc::expf(float(FPBits(0xff7fffffU))), FE_UNDERFLOW); + 0.0f, LIBC_NAMESPACE::expf(float(FPBits(0xff7fffffU))), FE_UNDERFLOW); EXPECT_MATH_ERRNO(ERANGE); float x = float(FPBits(0xc2cffff8U)); - EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, __llvm_libc::expf(x), - 0.5); + EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, + LIBC_NAMESPACE::expf(x), 0.5); EXPECT_MATH_ERRNO(ERANGE); x = float(FPBits(0xc2d00008U)); - EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, __llvm_libc::expf(x), - 0.5); + EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, + LIBC_NAMESPACE::expf(x), 0.5); EXPECT_MATH_ERRNO(ERANGE); } @@ -78,28 +78,28 @@ TEST(LlvmLibcExpfTest, Borderline) { libc_errno = 0; x = float(FPBits(0x42affff8U)); - ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, __llvm_libc::expf(x), - 0.5); + ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, + LIBC_NAMESPACE::expf(x), 0.5); EXPECT_MATH_ERRNO(0); x = float(FPBits(0x42b00008U)); - ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, __llvm_libc::expf(x), - 0.5); + ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, + LIBC_NAMESPACE::expf(x), 0.5); EXPECT_MATH_ERRNO(0); x = float(FPBits(0xc2affff8U)); - ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, __llvm_libc::expf(x), - 0.5); + ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, + LIBC_NAMESPACE::expf(x), 0.5); EXPECT_MATH_ERRNO(0); x = float(FPBits(0xc2b00008U)); - ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, __llvm_libc::expf(x), - 0.5); + ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, + LIBC_NAMESPACE::expf(x), 0.5); EXPECT_MATH_ERRNO(0); x = float(FPBits(0xc236bd8cU)); - EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, __llvm_libc::expf(x), - 0.5); + EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, + LIBC_NAMESPACE::expf(x), 0.5); EXPECT_MATH_ERRNO(0); } @@ -111,7 +111,7 @@ TEST(LlvmLibcExpfTest, InFloatRange) { if (isnan(x) || isinf(x)) continue; libc_errno = 0; - float result = __llvm_libc::expf(x); + float result = LIBC_NAMESPACE::expf(x); // If the computation resulted in an error or did not produce valid result // in the single-precision floating point range, then ignore comparing with @@ -120,6 +120,6 @@ TEST(LlvmLibcExpfTest, InFloatRange) { if (isnan(result) || isinf(result) || libc_errno != 0) continue; EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, - __llvm_libc::expf(x), 0.5); + LIBC_NAMESPACE::expf(x), 0.5); } } diff --git a/libc/test/src/math/explogxf_test.cpp b/libc/test/src/math/explogxf_test.cpp index d6d646d..7b402e1 100644 --- a/libc/test/src/math/explogxf_test.cpp +++ b/libc/test/src/math/explogxf_test.cpp @@ -14,7 +14,7 @@ #include "utils/MPFRWrapper/MPFRUtils.h" #include <math.h> -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) @@ -27,8 +27,8 @@ auto f_normal = [](float x) -> bool { TEST(LlvmLibcExpxfTest, InFloatRange) { auto fx = [](float x) -> float { - auto result = __llvm_libc::exp_b_range_reduc<__llvm_libc::ExpBase>(x); - double r = __llvm_libc::ExpBase::powb_lo(result.lo); + auto result = LIBC_NAMESPACE::exp_b_range_reduc<LIBC_NAMESPACE::ExpBase>(x); + double r = LIBC_NAMESPACE::ExpBase::powb_lo(result.lo); return static_cast<float>(result.mh * r); }; auto f_check = [](float x) -> bool { @@ -40,11 +40,11 @@ TEST(LlvmLibcExpxfTest, InFloatRange) { } TEST(LlvmLibcLog2xfTest, InFloatRange) { - CHECK_DATA(0.0f, inf, mpfr::Operation::Log2, __llvm_libc::log2_eval, f_normal, - def_count, def_prec); + CHECK_DATA(0.0f, inf, mpfr::Operation::Log2, LIBC_NAMESPACE::log2_eval, + f_normal, def_count, def_prec); } TEST(LlvmLibcLogxfTest, InFloatRange) { - CHECK_DATA(0.0f, inf, mpfr::Operation::Log, __llvm_libc::log_eval, f_normal, - def_count, def_prec); + CHECK_DATA(0.0f, inf, mpfr::Operation::Log, LIBC_NAMESPACE::log_eval, + f_normal, def_count, def_prec); } diff --git a/libc/test/src/math/expm1f_test.cpp b/libc/test/src/math/expm1f_test.cpp index c05edf8..f63c9f4 100644 --- a/libc/test/src/math/expm1f_test.cpp +++ b/libc/test/src/math/expm1f_test.cpp @@ -16,53 +16,53 @@ #include <stdint.h> -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcExpm1fTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ(aNaN, __llvm_libc::expm1f(aNaN)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::expm1f(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(inf, __llvm_libc::expm1f(inf)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::expm1f(inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(-1.0f, __llvm_libc::expm1f(neg_inf)); + EXPECT_FP_EQ(-1.0f, LIBC_NAMESPACE::expm1f(neg_inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(0.0f, __llvm_libc::expm1f(0.0f)); + EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::expm1f(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(-0.0f, __llvm_libc::expm1f(-0.0f)); + EXPECT_FP_EQ(-0.0f, LIBC_NAMESPACE::expm1f(-0.0f)); EXPECT_MATH_ERRNO(0); } TEST(LlvmLibcExpm1fTest, Overflow) { libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::expm1f(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::expm1f(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::expm1f(float(FPBits(0x42cffff8U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::expm1f(float(FPBits(0x42cffff8U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::expm1f(float(FPBits(0x42d00008U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::expm1f(float(FPBits(0x42d00008U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); } TEST(LlvmLibcExpm1fTest, Underflow) { libc_errno = 0; - EXPECT_FP_EQ(-1.0f, __llvm_libc::expm1f(float(FPBits(0xff7fffffU)))); + EXPECT_FP_EQ(-1.0f, LIBC_NAMESPACE::expm1f(float(FPBits(0xff7fffffU)))); float x = float(FPBits(0xc2cffff8U)); - EXPECT_FP_EQ(-1.0f, __llvm_libc::expm1f(x)); + EXPECT_FP_EQ(-1.0f, LIBC_NAMESPACE::expm1f(x)); x = float(FPBits(0xc2d00008U)); - EXPECT_FP_EQ(-1.0f, __llvm_libc::expm1f(x)); + EXPECT_FP_EQ(-1.0f, LIBC_NAMESPACE::expm1f(x)); } // Test with inputs which are the borders of underflow/overflow but still @@ -73,42 +73,42 @@ TEST(LlvmLibcExpm1fTest, Borderline) { libc_errno = 0; x = float(FPBits(0x42affff8U)); ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x, - __llvm_libc::expm1f(x), 0.5); + LIBC_NAMESPACE::expm1f(x), 0.5); EXPECT_MATH_ERRNO(0); x = float(FPBits(0x42b00008U)); ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x, - __llvm_libc::expm1f(x), 0.5); + LIBC_NAMESPACE::expm1f(x), 0.5); EXPECT_MATH_ERRNO(0); x = float(FPBits(0xc2affff8U)); ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x, - __llvm_libc::expm1f(x), 0.5); + LIBC_NAMESPACE::expm1f(x), 0.5); EXPECT_MATH_ERRNO(0); x = float(FPBits(0xc2b00008U)); ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x, - __llvm_libc::expm1f(x), 0.5); + LIBC_NAMESPACE::expm1f(x), 0.5); EXPECT_MATH_ERRNO(0); x = float(FPBits(0x3dc252ddU)); ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x, - __llvm_libc::expm1f(x), 0.5); + LIBC_NAMESPACE::expm1f(x), 0.5); EXPECT_MATH_ERRNO(0); x = float(FPBits(0x3e35bec5U)); ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x, - __llvm_libc::expm1f(x), 0.5); + LIBC_NAMESPACE::expm1f(x), 0.5); EXPECT_MATH_ERRNO(0); x = float(FPBits(0x942ed494U)); ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x, - __llvm_libc::expm1f(x), 0.5); + LIBC_NAMESPACE::expm1f(x), 0.5); EXPECT_MATH_ERRNO(0); x = float(FPBits(0xbdc1c6cbU)); ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x, - __llvm_libc::expm1f(x), 0.5); + LIBC_NAMESPACE::expm1f(x), 0.5); EXPECT_MATH_ERRNO(0); } @@ -120,7 +120,7 @@ TEST(LlvmLibcExpm1fTest, InFloatRange) { if (isnan(x) || isinf(x)) continue; libc_errno = 0; - float result = __llvm_libc::expm1f(x); + float result = LIBC_NAMESPACE::expm1f(x); // If the computation resulted in an error or did not produce valid result // in the single-precision floating point range, then ignore comparing with @@ -129,6 +129,6 @@ TEST(LlvmLibcExpm1fTest, InFloatRange) { if (isnan(result) || isinf(result) || libc_errno != 0) continue; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x, - __llvm_libc::expm1f(x), 0.5); + LIBC_NAMESPACE::expm1f(x), 0.5); } } diff --git a/libc/test/src/math/fabs_test.cpp b/libc/test/src/math/fabs_test.cpp index 2bf0ddd..0447040 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 6374a10..9f1e2a6 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 ff13202..37d2b54 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 80174b7..2f00a30 100644 --- a/libc/test/src/math/fdim_test.cpp +++ b/libc/test/src/math/fdim_test.cpp @@ -16,16 +16,18 @@ using LlvmLibcFDimTest = FDimTestTemplate<double>; -TEST_F(LlvmLibcFDimTest, NaNArg_fdim) { test_na_n_arg(&__llvm_libc::fdim); } +TEST_F(LlvmLibcFDimTest, NaNArg_fdim) { test_na_n_arg(&LIBC_NAMESPACE::fdim); } -TEST_F(LlvmLibcFDimTest, InfArg_fdim) { test_inf_arg(&__llvm_libc::fdim); } +TEST_F(LlvmLibcFDimTest, InfArg_fdim) { test_inf_arg(&LIBC_NAMESPACE::fdim); } TEST_F(LlvmLibcFDimTest, NegInfArg_fdim) { - test_neg_inf_arg(&__llvm_libc::fdim); + test_neg_inf_arg(&LIBC_NAMESPACE::fdim); } -TEST_F(LlvmLibcFDimTest, BothZero_fdim) { test_both_zero(&__llvm_libc::fdim); } +TEST_F(LlvmLibcFDimTest, BothZero_fdim) { + test_both_zero(&LIBC_NAMESPACE::fdim); +} TEST_F(LlvmLibcFDimTest, InDoubleRange_fdim) { - test_in_range(&__llvm_libc::fdim); + test_in_range(&LIBC_NAMESPACE::fdim); } diff --git a/libc/test/src/math/fdimf_test.cpp b/libc/test/src/math/fdimf_test.cpp index 531b89b..27511ba 100644 --- a/libc/test/src/math/fdimf_test.cpp +++ b/libc/test/src/math/fdimf_test.cpp @@ -16,18 +16,20 @@ using LlvmLibcFDimTest = FDimTestTemplate<float>; -TEST_F(LlvmLibcFDimTest, NaNArg_fdimf) { test_na_n_arg(&__llvm_libc::fdimf); } +TEST_F(LlvmLibcFDimTest, NaNArg_fdimf) { + test_na_n_arg(&LIBC_NAMESPACE::fdimf); +} -TEST_F(LlvmLibcFDimTest, InfArg_fdimf) { test_inf_arg(&__llvm_libc::fdimf); } +TEST_F(LlvmLibcFDimTest, InfArg_fdimf) { test_inf_arg(&LIBC_NAMESPACE::fdimf); } TEST_F(LlvmLibcFDimTest, NegInfArg_fdimf) { - test_neg_inf_arg(&__llvm_libc::fdimf); + test_neg_inf_arg(&LIBC_NAMESPACE::fdimf); } TEST_F(LlvmLibcFDimTest, BothZero_fdimf) { - test_both_zero(&__llvm_libc::fdimf); + test_both_zero(&LIBC_NAMESPACE::fdimf); } TEST_F(LlvmLibcFDimTest, InFloatRange_fdimf) { - test_in_range(&__llvm_libc::fdimf); + test_in_range(&LIBC_NAMESPACE::fdimf); } diff --git a/libc/test/src/math/fdiml_test.cpp b/libc/test/src/math/fdiml_test.cpp index bb6c54d..45aedb0 100644 --- a/libc/test/src/math/fdiml_test.cpp +++ b/libc/test/src/math/fdiml_test.cpp @@ -16,18 +16,20 @@ using LlvmLibcFDimTest = FDimTestTemplate<long double>; -TEST_F(LlvmLibcFDimTest, NaNArg_fdiml) { test_na_n_arg(&__llvm_libc::fdiml); } +TEST_F(LlvmLibcFDimTest, NaNArg_fdiml) { + test_na_n_arg(&LIBC_NAMESPACE::fdiml); +} -TEST_F(LlvmLibcFDimTest, InfArg_fdiml) { test_inf_arg(&__llvm_libc::fdiml); } +TEST_F(LlvmLibcFDimTest, InfArg_fdiml) { test_inf_arg(&LIBC_NAMESPACE::fdiml); } TEST_F(LlvmLibcFDimTest, NegInfArg_fdiml) { - test_neg_inf_arg(&__llvm_libc::fdiml); + test_neg_inf_arg(&LIBC_NAMESPACE::fdiml); } TEST_F(LlvmLibcFDimTest, BothZero_fdiml) { - test_both_zero(&__llvm_libc::fdiml); + test_both_zero(&LIBC_NAMESPACE::fdiml); } TEST_F(LlvmLibcFDimTest, InLongDoubleRange_fdiml) { - test_in_range(&__llvm_libc::fdiml); + test_in_range(&LIBC_NAMESPACE::fdiml); } diff --git a/libc/test/src/math/floor_test.cpp b/libc/test/src/math/floor_test.cpp index e68ed3e..9231d07 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 f0538f7..cbb11f3 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 1b244fd..26f6a770 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 be6b138..20224d9 100644 --- a/libc/test/src/math/fma_test.cpp +++ b/libc/test/src/math/fma_test.cpp @@ -270,20 +270,22 @@ struct LlvmLibcFmaTest : public FmaTestTemplate<double> { double c = (signs & 1) ? -INPUTS[i].c : INPUTS[i].c; mpfr::TernaryInput<double> input{a, b, c}; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Fma, input, - __llvm_libc::fma(a, b, c), 0.5); + LIBC_NAMESPACE::fma(a, b, c), 0.5); } } } }; TEST_F(LlvmLibcFmaTest, SpecialNumbers) { - test_special_numbers(&__llvm_libc::fma); + test_special_numbers(&LIBC_NAMESPACE::fma); } TEST_F(LlvmLibcFmaTest, SubnormalRange) { - test_subnormal_range(&__llvm_libc::fma); + test_subnormal_range(&LIBC_NAMESPACE::fma); } -TEST_F(LlvmLibcFmaTest, NormalRange) { test_normal_range(&__llvm_libc::fma); } +TEST_F(LlvmLibcFmaTest, NormalRange) { + test_normal_range(&LIBC_NAMESPACE::fma); +} TEST_F(LlvmLibcFmaTest, ExtraValues) { test_more_values(); } diff --git a/libc/test/src/math/fmaf_test.cpp b/libc/test/src/math/fmaf_test.cpp index 8d1cf25..b607d4a 100644 --- a/libc/test/src/math/fmaf_test.cpp +++ b/libc/test/src/math/fmaf_test.cpp @@ -13,11 +13,13 @@ using LlvmLibcFmafTest = FmaTestTemplate<float>; TEST_F(LlvmLibcFmafTest, SpecialNumbers) { - test_special_numbers(&__llvm_libc::fmaf); + test_special_numbers(&LIBC_NAMESPACE::fmaf); } TEST_F(LlvmLibcFmafTest, SubnormalRange) { - test_subnormal_range(&__llvm_libc::fmaf); + test_subnormal_range(&LIBC_NAMESPACE::fmaf); } -TEST_F(LlvmLibcFmafTest, NormalRange) { test_normal_range(&__llvm_libc::fmaf); } +TEST_F(LlvmLibcFmafTest, NormalRange) { + test_normal_range(&LIBC_NAMESPACE::fmaf); +} diff --git a/libc/test/src/math/fmax_test.cpp b/libc/test/src/math/fmax_test.cpp index 9c81c09..6800939 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 cf337d4..25c6f73 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 636bc42..9ac986c 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 3515f97..5d241519 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 1a76247..1af5b79 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 ce8b705..0791f8c 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 03790e4..ec39e05 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 2b13379..5c3c628 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 a44aefc..4d078ba 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 5d78f94..577eb96 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 4904ccd..e5184cd 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 cecfc0e..d0ab31f 100644 --- a/libc/test/src/math/generic_sqrt_test.cpp +++ b/libc/test/src/math/generic_sqrt_test.cpp @@ -10,4 +10,4 @@ #include "src/__support/FPUtil/generic/sqrt.h" -LIST_SQRT_TESTS(double, __llvm_libc::fputil::sqrt<double>) +LIST_SQRT_TESTS(double, LIBC_NAMESPACE::fputil::sqrt<double>) diff --git a/libc/test/src/math/generic_sqrtf_test.cpp b/libc/test/src/math/generic_sqrtf_test.cpp index 64bf921..f22ac88 100644 --- a/libc/test/src/math/generic_sqrtf_test.cpp +++ b/libc/test/src/math/generic_sqrtf_test.cpp @@ -10,4 +10,4 @@ #include "src/__support/FPUtil/generic/sqrt.h" -LIST_SQRT_TESTS(float, __llvm_libc::fputil::sqrt<float>) +LIST_SQRT_TESTS(float, LIBC_NAMESPACE::fputil::sqrt<float>) diff --git a/libc/test/src/math/generic_sqrtl_test.cpp b/libc/test/src/math/generic_sqrtl_test.cpp index 6b68aae..ddc6a23 100644 --- a/libc/test/src/math/generic_sqrtl_test.cpp +++ b/libc/test/src/math/generic_sqrtl_test.cpp @@ -10,4 +10,4 @@ #include "src/__support/FPUtil/generic/sqrt.h" -LIST_SQRT_TESTS(long double, __llvm_libc::fputil::sqrt<long double>) +LIST_SQRT_TESTS(long double, LIBC_NAMESPACE::fputil::sqrt<long double>) diff --git a/libc/test/src/math/hypot_test.cpp b/libc/test/src/math/hypot_test.cpp index 2d7b640..8f560f0 100644 --- a/libc/test/src/math/hypot_test.cpp +++ b/libc/test/src/math/hypot_test.cpp @@ -13,13 +13,13 @@ using LlvmLibcHypotTest = HypotTestTemplate<double>; TEST_F(LlvmLibcHypotTest, SpecialNumbers) { - test_special_numbers(&__llvm_libc::hypot); + test_special_numbers(&LIBC_NAMESPACE::hypot); } TEST_F(LlvmLibcHypotTest, SubnormalRange) { - test_subnormal_range(&__llvm_libc::hypot); + test_subnormal_range(&LIBC_NAMESPACE::hypot); } TEST_F(LlvmLibcHypotTest, NormalRange) { - test_normal_range(&__llvm_libc::hypot); + test_normal_range(&LIBC_NAMESPACE::hypot); } diff --git a/libc/test/src/math/hypotf_hard_to_round.h b/libc/test/src/math/hypotf_hard_to_round.h index 1b2abfd..f85be91 100644 --- a/libc/test/src/math/hypotf_hard_to_round.h +++ b/libc/test/src/math/hypotf_hard_to_round.h @@ -11,7 +11,7 @@ #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; constexpr int N_HARD_TO_ROUND = 1217; constexpr mpfr::BinaryInput<float> HYPOTF_HARD_TO_ROUND[N_HARD_TO_ROUND] = { diff --git a/libc/test/src/math/hypotf_test.cpp b/libc/test/src/math/hypotf_test.cpp index 437e0fc..ee16e3d 100644 --- a/libc/test/src/math/hypotf_test.cpp +++ b/libc/test/src/math/hypotf_test.cpp @@ -14,17 +14,18 @@ using LlvmLibcHypotfTest = HypotTestTemplate<float>; TEST_F(LlvmLibcHypotfTest, SpecialNumbers) { - test_special_numbers(&__llvm_libc::hypotf); + test_special_numbers(&LIBC_NAMESPACE::hypotf); } TEST_F(LlvmLibcHypotfTest, SubnormalRange) { - test_subnormal_range(&__llvm_libc::hypotf); + test_subnormal_range(&LIBC_NAMESPACE::hypotf); } TEST_F(LlvmLibcHypotfTest, NormalRange) { - test_normal_range(&__llvm_libc::hypotf); + test_normal_range(&LIBC_NAMESPACE::hypotf); } TEST_F(LlvmLibcHypotfTest, TrickyInputs) { - test_input_list(&__llvm_libc::hypotf, N_HARD_TO_ROUND, HYPOTF_HARD_TO_ROUND); + test_input_list(&LIBC_NAMESPACE::hypotf, N_HARD_TO_ROUND, + HYPOTF_HARD_TO_ROUND); } diff --git a/libc/test/src/math/ilogb_test.cpp b/libc/test/src/math/ilogb_test.cpp index a77adec..7011c43 100644 --- a/libc/test/src/math/ilogb_test.cpp +++ b/libc/test/src/math/ilogb_test.cpp @@ -16,21 +16,21 @@ #include <math.h> TEST_F(LlvmLibcILogbTest, SpecialNumbers_ilogb) { - test_special_numbers<double>(&__llvm_libc::ilogb); + test_special_numbers<double>(&LIBC_NAMESPACE::ilogb); } TEST_F(LlvmLibcILogbTest, PowersOfTwo_ilogb) { - test_powers_of_two<double>(&__llvm_libc::ilogb); + test_powers_of_two<double>(&LIBC_NAMESPACE::ilogb); } TEST_F(LlvmLibcILogbTest, SomeIntegers_ilogb) { - test_some_integers<double>(&__llvm_libc::ilogb); + test_some_integers<double>(&LIBC_NAMESPACE::ilogb); } TEST_F(LlvmLibcILogbTest, SubnormalRange_ilogb) { - test_subnormal_range<double>(&__llvm_libc::ilogb); + test_subnormal_range<double>(&LIBC_NAMESPACE::ilogb); } TEST_F(LlvmLibcILogbTest, NormalRange_ilogb) { - test_normal_range<double>(&__llvm_libc::ilogb); + test_normal_range<double>(&LIBC_NAMESPACE::ilogb); } diff --git a/libc/test/src/math/ilogbf_test.cpp b/libc/test/src/math/ilogbf_test.cpp index 20904a1..dcff8ee 100644 --- a/libc/test/src/math/ilogbf_test.cpp +++ b/libc/test/src/math/ilogbf_test.cpp @@ -16,21 +16,21 @@ #include <math.h> TEST_F(LlvmLibcILogbTest, SpecialNumbers_ilogbf) { - test_special_numbers<float>(&__llvm_libc::ilogbf); + test_special_numbers<float>(&LIBC_NAMESPACE::ilogbf); } TEST_F(LlvmLibcILogbTest, PowersOfTwo_ilogbf) { - test_powers_of_two<float>(&__llvm_libc::ilogbf); + test_powers_of_two<float>(&LIBC_NAMESPACE::ilogbf); } TEST_F(LlvmLibcILogbTest, SomeIntegers_ilogbf) { - test_some_integers<float>(&__llvm_libc::ilogbf); + test_some_integers<float>(&LIBC_NAMESPACE::ilogbf); } TEST_F(LlvmLibcILogbTest, SubnormalRange_ilogbf) { - test_subnormal_range<float>(&__llvm_libc::ilogbf); + test_subnormal_range<float>(&LIBC_NAMESPACE::ilogbf); } TEST_F(LlvmLibcILogbTest, NormalRange_ilogbf) { - test_normal_range<float>(&__llvm_libc::ilogbf); + test_normal_range<float>(&LIBC_NAMESPACE::ilogbf); } diff --git a/libc/test/src/math/ilogbl_test.cpp b/libc/test/src/math/ilogbl_test.cpp index 9647f23..29a221a 100644 --- a/libc/test/src/math/ilogbl_test.cpp +++ b/libc/test/src/math/ilogbl_test.cpp @@ -16,21 +16,21 @@ #include <math.h> TEST_F(LlvmLibcILogbTest, SpecialNumbers_ilogbl) { - test_special_numbers<long double>(&__llvm_libc::ilogbl); + test_special_numbers<long double>(&LIBC_NAMESPACE::ilogbl); } TEST_F(LlvmLibcILogbTest, PowersOfTwo_ilogbl) { - test_powers_of_two<long double>(&__llvm_libc::ilogbl); + test_powers_of_two<long double>(&LIBC_NAMESPACE::ilogbl); } TEST_F(LlvmLibcILogbTest, SomeIntegers_ilogbl) { - test_some_integers<long double>(&__llvm_libc::ilogbl); + test_some_integers<long double>(&LIBC_NAMESPACE::ilogbl); } TEST_F(LlvmLibcILogbTest, SubnormalRange_ilogbl) { - test_subnormal_range<long double>(&__llvm_libc::ilogbl); + test_subnormal_range<long double>(&LIBC_NAMESPACE::ilogbl); } TEST_F(LlvmLibcILogbTest, NormalRange_ilogbl) { - test_normal_range<long double>(&__llvm_libc::ilogbl); + test_normal_range<long double>(&LIBC_NAMESPACE::ilogbl); } diff --git a/libc/test/src/math/inv_trigf_utils_test.cpp b/libc/test/src/math/inv_trigf_utils_test.cpp index ffcca5c..4f50027 100644 --- a/libc/test/src/math/inv_trigf_utils_test.cpp +++ b/libc/test/src/math/inv_trigf_utils_test.cpp @@ -14,7 +14,7 @@ #include "utils/MPFRWrapper/MPFRUtils.h" #include <math.h> -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) @@ -24,11 +24,11 @@ constexpr float def_prec = 0.500001f; auto f_normal = [](float x) -> bool { return !(isnan(x) || isinf(x)); }; TEST(LlvmLibcAtanfPosTest, InFloatRange) { - CHECK_DATA(0.0f, inf, mpfr::Operation::Atan, __llvm_libc::atan_eval, f_normal, - def_count, def_prec); + CHECK_DATA(0.0f, inf, mpfr::Operation::Atan, LIBC_NAMESPACE::atan_eval, + f_normal, def_count, def_prec); } TEST(LlvmLibcAtanfNegTest, InFloatRange) { - CHECK_DATA(-0.0f, neg_inf, mpfr::Operation::Atan, __llvm_libc::atan_eval, + CHECK_DATA(-0.0f, neg_inf, mpfr::Operation::Atan, LIBC_NAMESPACE::atan_eval, f_normal, def_count, def_prec); } diff --git a/libc/test/src/math/ldexp_test.cpp b/libc/test/src/math/ldexp_test.cpp index c078aa4..aad580f 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 4fe80fc..f4cce37 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 5e6e6e7..405e533 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 8027004..8cf7d92 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 9ad710e..0d9d3c4 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 948e961..1ceb9fe 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 c86095d..bda2fca6 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 5e36258..a35b5fa 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 8fbc840..e43d49f 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 f841fbe..46458c3 100644 --- a/libc/test/src/math/log10_test.cpp +++ b/libc/test/src/math/log10_test.cpp @@ -17,19 +17,21 @@ #include <errno.h> #include <stdint.h> -namespace mpfr = __llvm_libc::testing::mpfr; -using __llvm_libc::testing::tlog; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(double) TEST(LlvmLibcLog10Test, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::log10(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::log10(inf)); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log10(neg_inf), FE_INVALID); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log10(0.0), FE_DIVBYZERO); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log10(-0.0), FE_DIVBYZERO); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log10(-1.0), FE_INVALID); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log10(1.0)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log10(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log10(inf)); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log10(neg_inf), FE_INVALID); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log10(0.0), + FE_DIVBYZERO); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log10(-0.0), + FE_DIVBYZERO); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log10(-1.0), FE_INVALID); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log10(1.0)); } TEST(LlvmLibcLog10Test, TrickyInputs) { @@ -66,7 +68,7 @@ TEST(LlvmLibcLog10Test, TrickyInputs) { for (int i = 0; i < N; ++i) { double x = double(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log10, x, - __llvm_libc::log10(x), 0.5); + LIBC_NAMESPACE::log10(x), 0.5); } } @@ -74,7 +76,7 @@ TEST(LlvmLibcLog10Test, AllExponents) { double x = 0x1.0p-1074; for (int i = -1074; i < 1024; ++i, x *= 2.0) { ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log10, x, - __llvm_libc::log10(x), 0.5); + LIBC_NAMESPACE::log10(x), 0.5); } } @@ -101,7 +103,7 @@ TEST(LlvmLibcLog10Test, InDoubleRange) { if (isnan(x) || isinf(x) || x < 0.0) continue; libc_errno = 0; - double result = __llvm_libc::log10(x); + double result = LIBC_NAMESPACE::log10(x); ++cc; if (isnan(result) || isinf(result)) continue; diff --git a/libc/test/src/math/log10f_test.cpp b/libc/test/src/math/log10f_test.cpp index 444a742..05c42b9 100644 --- a/libc/test/src/math/log10f_test.cpp +++ b/libc/test/src/math/log10f_test.cpp @@ -16,19 +16,20 @@ #include <errno.h> #include <stdint.h> -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcLog10fTest, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::log10f(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::log10f(inf)); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log10f(neg_inf), FE_INVALID); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log10f(0.0f), FE_DIVBYZERO); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log10f(-0.0f), + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log10f(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log10f(inf)); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log10f(neg_inf), FE_INVALID); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log10f(0.0f), FE_DIVBYZERO); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log10f(-1.0f), FE_INVALID); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log10f(1.0f)); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log10f(-0.0f), + FE_DIVBYZERO); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log10f(-1.0f), FE_INVALID); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log10f(1.0f)); } TEST(LlvmLibcLog10fTest, TrickyInputs) { @@ -60,7 +61,7 @@ TEST(LlvmLibcLog10fTest, TrickyInputs) { for (int i = 0; i < N; ++i) { float x = float(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log10, x, - __llvm_libc::log10f(x), 0.5); + LIBC_NAMESPACE::log10f(x), 0.5); } } @@ -70,6 +71,6 @@ TEST(LlvmLibcLog10fTest, InFloatRange) { for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) { float x = float(FPBits(v)); ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log10, x, - __llvm_libc::log10f(x), 0.5); + LIBC_NAMESPACE::log10f(x), 0.5); } } diff --git a/libc/test/src/math/log1p_test.cpp b/libc/test/src/math/log1p_test.cpp index c128c5e..b677e7b 100644 --- a/libc/test/src/math/log1p_test.cpp +++ b/libc/test/src/math/log1p_test.cpp @@ -17,19 +17,20 @@ #include <errno.h> #include <stdint.h> -namespace mpfr = __llvm_libc::testing::mpfr; -using __llvm_libc::testing::tlog; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(double) TEST(LlvmLibcLog1pTest, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::log1p(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::log1p(inf)); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log1p(neg_inf), FE_INVALID); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log1p(-2.0), FE_INVALID); - EXPECT_FP_EQ(zero, __llvm_libc::log1p(0.0)); - EXPECT_FP_EQ(neg_zero, __llvm_libc::log1p(-0.0)); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log1p(-1.0), FE_DIVBYZERO); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log1p(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log1p(inf)); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log1p(neg_inf), FE_INVALID); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log1p(-2.0), FE_INVALID); + EXPECT_FP_EQ(zero, LIBC_NAMESPACE::log1p(0.0)); + EXPECT_FP_EQ(neg_zero, LIBC_NAMESPACE::log1p(-0.0)); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log1p(-1.0), + FE_DIVBYZERO); } TEST(LlvmLibcLog1pTest, TrickyInputs) { @@ -68,7 +69,7 @@ TEST(LlvmLibcLog1pTest, TrickyInputs) { for (int i = 0; i < N; ++i) { double x = double(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log1p, x, - __llvm_libc::log1p(x), 0.5); + LIBC_NAMESPACE::log1p(x), 0.5); } } @@ -76,7 +77,7 @@ TEST(LlvmLibcLog1pTest, AllExponents) { double x = 0x1.0p-1074; for (int i = -1074; i < 1024; ++i, x *= 2.0) { ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log1p, x, - __llvm_libc::log1p(x), 0.5); + LIBC_NAMESPACE::log1p(x), 0.5); } } @@ -102,7 +103,7 @@ TEST(LlvmLibcLog1pTest, InDoubleRange) { if (isnan(x) || isinf(x) || x < 0.0) continue; libc_errno = 0; - double result = __llvm_libc::log1p(x); + double result = LIBC_NAMESPACE::log1p(x); ++cc; if (isnan(result) || isinf(result)) continue; diff --git a/libc/test/src/math/log1pf_test.cpp b/libc/test/src/math/log1pf_test.cpp index 264687d..d8132e4 100644 --- a/libc/test/src/math/log1pf_test.cpp +++ b/libc/test/src/math/log1pf_test.cpp @@ -17,17 +17,17 @@ #include <errno.h> #include <stdint.h> -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibclog1pfTest, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::log1pf(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::log1pf(inf)); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log1pf(neg_inf), FE_INVALID); - EXPECT_FP_EQ(zero, __llvm_libc::log1pf(0.0f)); - EXPECT_FP_EQ(neg_zero, __llvm_libc::log1pf(-0.0f)); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log1pf(-1.0f), + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log1pf(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log1pf(inf)); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log1pf(neg_inf), FE_INVALID); + EXPECT_FP_EQ(zero, LIBC_NAMESPACE::log1pf(0.0f)); + EXPECT_FP_EQ(neg_zero, LIBC_NAMESPACE::log1pf(-0.0f)); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log1pf(-1.0f), FE_DIVBYZERO); } @@ -65,7 +65,7 @@ TEST(LlvmLibclog1pfTest, TrickyInputs) { for (int i = 0; i < N; ++i) { float x = float(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log1p, x, - __llvm_libc::log1pf(x), 0.5); + LIBC_NAMESPACE::log1pf(x), 0.5); } } @@ -78,6 +78,6 @@ TEST(LlvmLibclog1pfTest, InFloatRange) { continue; libc_errno = 0; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log1p, x, - __llvm_libc::log1pf(x), 0.5); + LIBC_NAMESPACE::log1pf(x), 0.5); } } diff --git a/libc/test/src/math/log2_test.cpp b/libc/test/src/math/log2_test.cpp index c475687..42643fa 100644 --- a/libc/test/src/math/log2_test.cpp +++ b/libc/test/src/math/log2_test.cpp @@ -17,19 +17,20 @@ #include <errno.h> #include <stdint.h> -namespace mpfr = __llvm_libc::testing::mpfr; -using __llvm_libc::testing::tlog; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(double) TEST(LlvmLibcLog2Test, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::log2(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::log2(inf)); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log2(neg_inf), FE_INVALID); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log2(0.0), FE_DIVBYZERO); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log2(-0.0), FE_DIVBYZERO); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log2(-1.0), FE_INVALID); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log2(1.0)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log2(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log2(inf)); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log2(neg_inf), FE_INVALID); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log2(0.0), FE_DIVBYZERO); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log2(-0.0), + FE_DIVBYZERO); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log2(-1.0), FE_INVALID); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log2(1.0)); } TEST(LlvmLibcLog2Test, TrickyInputs) { @@ -65,7 +66,7 @@ TEST(LlvmLibcLog2Test, TrickyInputs) { for (int i = 0; i < N; ++i) { double x = double(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log2, x, - __llvm_libc::log2(x), 0.5); + LIBC_NAMESPACE::log2(x), 0.5); } } @@ -73,7 +74,7 @@ TEST(LlvmLibcLog2Test, AllExponents) { double x = 0x1.0p-1074; for (int i = -1074; i < 1024; ++i, x *= 2.0) { ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log2, x, - __llvm_libc::log2(x), 0.5); + LIBC_NAMESPACE::log2(x), 0.5); } } @@ -101,7 +102,7 @@ TEST(LlvmLibcLog2Test, InDoubleRange) { if (isnan(x) || isinf(x) || x < 0.0) continue; libc_errno = 0; - double result = __llvm_libc::log2(x); + double result = LIBC_NAMESPACE::log2(x); ++cc; if (isnan(result) || isinf(result)) continue; diff --git a/libc/test/src/math/log2f_test.cpp b/libc/test/src/math/log2f_test.cpp index afc7a74..d4f4b93 100644 --- a/libc/test/src/math/log2f_test.cpp +++ b/libc/test/src/math/log2f_test.cpp @@ -16,18 +16,20 @@ #include <stdint.h> -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcLog2fTest, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::log2f(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::log2f(inf)); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log2f(neg_inf), FE_INVALID); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log2f(0.0f), FE_DIVBYZERO); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log2f(-0.0f), FE_DIVBYZERO); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log2f(-1.0f), FE_INVALID); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log2f(1.0f)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log2f(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log2f(inf)); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log2f(neg_inf), FE_INVALID); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log2f(0.0f), + FE_DIVBYZERO); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log2f(-0.0f), + FE_DIVBYZERO); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log2f(-1.0f), FE_INVALID); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log2f(1.0f)); } TEST(LlvmLibcLog2fTest, TrickyInputs) { @@ -39,7 +41,7 @@ TEST(LlvmLibcLog2fTest, TrickyInputs) { for (int i = 0; i < N; ++i) { float x = float(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log2, x, - __llvm_libc::log2f(x), 0.5); + LIBC_NAMESPACE::log2f(x), 0.5); } } @@ -51,7 +53,7 @@ TEST(LlvmLibcLog2fTest, InFloatRange) { if (isnan(x) || isinf(x)) continue; libc_errno = 0; - float result = __llvm_libc::log2f(x); + float result = LIBC_NAMESPACE::log2f(x); // If the computation resulted in an error or did not produce valid result // in the single-precision floating point range, then ignore comparing with // MPFR result as MPFR can still produce valid results because of its @@ -59,6 +61,6 @@ TEST(LlvmLibcLog2fTest, InFloatRange) { if (isnan(result) || isinf(result) || libc_errno != 0) continue; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log2, x, - __llvm_libc::log2f(x), 0.5); + LIBC_NAMESPACE::log2f(x), 0.5); } } diff --git a/libc/test/src/math/log_test.cpp b/libc/test/src/math/log_test.cpp index 5b66253..caa2748 100644 --- a/libc/test/src/math/log_test.cpp +++ b/libc/test/src/math/log_test.cpp @@ -17,19 +17,19 @@ #include <errno.h> #include <stdint.h> -namespace mpfr = __llvm_libc::testing::mpfr; -using __llvm_libc::testing::tlog; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(double) TEST(LlvmLibcLogTest, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::log(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::log(inf)); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log(neg_inf), FE_INVALID); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log(0.0), FE_DIVBYZERO); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log(-0.0), FE_DIVBYZERO); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log(-1.0), FE_INVALID); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log(1.0)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log(inf)); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log(neg_inf), FE_INVALID); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log(0.0), FE_DIVBYZERO); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log(-0.0), FE_DIVBYZERO); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log(-1.0), FE_INVALID); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log(1.0)); } TEST(LlvmLibcLogTest, TrickyInputs) { @@ -64,16 +64,16 @@ TEST(LlvmLibcLogTest, TrickyInputs) { }; for (int i = 0; i < N; ++i) { double x = double(FPBits(INPUTS[i])); - EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log, x, __llvm_libc::log(x), - 0.5); + EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log, x, + LIBC_NAMESPACE::log(x), 0.5); } } TEST(LlvmLibcLogTest, AllExponents) { double x = 0x1.0p-1074; for (int i = -1074; i < 1024; ++i, x *= 2.0) { - ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log, x, __llvm_libc::log(x), - 0.5); + ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log, x, + LIBC_NAMESPACE::log(x), 0.5); } } @@ -101,7 +101,7 @@ TEST(LlvmLibcLogTest, InDoubleRange) { if (isnan(x) || isinf(x) || x < 0.0) continue; libc_errno = 0; - double result = __llvm_libc::log(x); + double result = LIBC_NAMESPACE::log(x); ++cc; if (isnan(result) || isinf(result)) continue; diff --git a/libc/test/src/math/logb_test.cpp b/libc/test/src/math/logb_test.cpp index b903485..2dc56c2 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 727eeff..c25485c 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 1c7b0d4..b26cee6 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 6f8983c..832bdd2 100644 --- a/libc/test/src/math/logf_test.cpp +++ b/libc/test/src/math/logf_test.cpp @@ -15,18 +15,20 @@ #include <stdint.h> -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcLogfTest, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::logf(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::logf(inf)); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::logf(neg_inf), FE_INVALID); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::logf(0.0f), FE_DIVBYZERO); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::logf(-0.0f), FE_DIVBYZERO); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::logf(-1.0f), FE_INVALID); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::logf(1.0f)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::logf(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::logf(inf)); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::logf(neg_inf), FE_INVALID); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::logf(0.0f), + FE_DIVBYZERO); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::logf(-0.0f), + FE_DIVBYZERO); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::logf(-1.0f), FE_INVALID); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::logf(1.0f)); } TEST(LlvmLibcLogfTest, TrickyInputs) { @@ -71,7 +73,7 @@ TEST(LlvmLibcLogfTest, TrickyInputs) { for (int i = 0; i < N; ++i) { float x = float(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log, x, - __llvm_libc::logf(x), 0.5); + LIBC_NAMESPACE::logf(x), 0.5); } } @@ -83,6 +85,6 @@ TEST(LlvmLibcLogfTest, InFloatRange) { if (isnan(x) || isinf(x)) continue; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log, x, - __llvm_libc::logf(x), 0.5); + LIBC_NAMESPACE::logf(x), 0.5); } } diff --git a/libc/test/src/math/lrint_test.cpp b/libc/test/src/math/lrint_test.cpp index 0dbfa3d..9cff266 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 407813a..9c696a3 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 a4551c3..e44dd30 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 0ee580f..1fb2fc7 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 7a2aad2..38fe5c7 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 c0ea339..8a29ba9 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 ff89517..b4b03ba 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 440304a..068dbc3 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 c98678b..ae8a726 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 2dde48c..998b19f 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 14234c7..31770bc 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 db85d83..4c8577f 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 8efec39..4358331 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 1af4ba4..590b4ff 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 e4438e8..ae2db44 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 eafa1a7..9c89b7a 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 c15a697..f875bab 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 6c50873..458ca05 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 87ce079..dbcb567 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 0a182dd..053596a 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 32cf724..2a2a213 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 d4d60bf..413a239 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 cbf2e7e..e97781c 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 197887b..b0e0053 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 284578b..4a77b2a 100644 --- a/libc/test/src/math/sdcomp26094.h +++ b/libc/test/src/math/sdcomp26094.h @@ -13,15 +13,15 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { -static constexpr __llvm_libc::cpp::array<uint32_t, 10> SDCOMP26094_VALUES{ +static constexpr LIBC_NAMESPACE::cpp::array<uint32_t, 10> SDCOMP26094_VALUES{ 0x46427f1b, 0x4647e568, 0x46428bac, 0x4647f1f9, 0x4647fe8a, 0x45d8d7f1, 0x45d371a4, 0x45ce0b57, 0x45d35882, 0x45cdf235, }; } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_TEST_SRC_MATH_SDCOMP26094_H diff --git a/libc/test/src/math/sin_test.cpp b/libc/test/src/math/sin_test.cpp index d92bd85..ee8451f5 100644 --- a/libc/test/src/math/sin_test.cpp +++ b/libc/test/src/math/sin_test.cpp @@ -14,7 +14,7 @@ #include <math.h> -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(double) @@ -28,6 +28,6 @@ TEST(LlvmLibcSinTest, Range) { if (isnan(x) || isinf(x) || x > _2pi || x < -_2pi) continue; - ASSERT_MPFR_MATCH(mpfr::Operation::Sin, x, __llvm_libc::sin(x), 1.0); + ASSERT_MPFR_MATCH(mpfr::Operation::Sin, x, LIBC_NAMESPACE::sin(x), 1.0); } } diff --git a/libc/test/src/math/sincosf_test.cpp b/libc/test/src/math/sincosf_test.cpp index 3a5bdd1..f67fba1 100644 --- a/libc/test/src/math/sincosf_test.cpp +++ b/libc/test/src/math/sincosf_test.cpp @@ -18,10 +18,10 @@ #include <errno.h> #include <stdint.h> -using __llvm_libc::testing::SDCOMP26094_VALUES; -using FPBits = __llvm_libc::fputil::FPBits<float>; +using LIBC_NAMESPACE::testing::SDCOMP26094_VALUES; +using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>; -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) @@ -29,27 +29,27 @@ TEST(LlvmLibcSinCosfTest, SpecialNumbers) { libc_errno = 0; float sin, cos; - __llvm_libc::sincosf(aNaN, &sin, &cos); + LIBC_NAMESPACE::sincosf(aNaN, &sin, &cos); EXPECT_FP_EQ(aNaN, cos); EXPECT_FP_EQ(aNaN, sin); EXPECT_MATH_ERRNO(0); - __llvm_libc::sincosf(0.0f, &sin, &cos); + LIBC_NAMESPACE::sincosf(0.0f, &sin, &cos); EXPECT_FP_EQ(1.0f, cos); EXPECT_FP_EQ(0.0f, sin); EXPECT_MATH_ERRNO(0); - __llvm_libc::sincosf(-0.0f, &sin, &cos); + LIBC_NAMESPACE::sincosf(-0.0f, &sin, &cos); EXPECT_FP_EQ(1.0f, cos); EXPECT_FP_EQ(-0.0f, sin); EXPECT_MATH_ERRNO(0); - __llvm_libc::sincosf(inf, &sin, &cos); + LIBC_NAMESPACE::sincosf(inf, &sin, &cos); EXPECT_FP_EQ(aNaN, cos); EXPECT_FP_EQ(aNaN, sin); EXPECT_MATH_ERRNO(EDOM); - __llvm_libc::sincosf(neg_inf, &sin, &cos); + LIBC_NAMESPACE::sincosf(neg_inf, &sin, &cos); EXPECT_FP_EQ(aNaN, cos); EXPECT_FP_EQ(aNaN, sin); EXPECT_MATH_ERRNO(EDOM); @@ -58,11 +58,11 @@ TEST(LlvmLibcSinCosfTest, SpecialNumbers) { #define EXPECT_SINCOS_MATCH_ALL_ROUNDING(input) \ { \ float sin, cos; \ - namespace mpfr = __llvm_libc::testing::mpfr; \ + namespace mpfr = LIBC_NAMESPACE::testing::mpfr; \ \ mpfr::ForceRoundingMode __r1(mpfr::RoundingMode::Nearest); \ if (__r1.success) { \ - __llvm_libc::sincosf(input, &sin, &cos); \ + LIBC_NAMESPACE::sincosf(input, &sin, &cos); \ EXPECT_MPFR_MATCH(mpfr::Operation::Sin, input, sin, 0.5, \ mpfr::RoundingMode::Nearest); \ EXPECT_MPFR_MATCH(mpfr::Operation::Cos, input, cos, 0.5, \ @@ -71,7 +71,7 @@ TEST(LlvmLibcSinCosfTest, SpecialNumbers) { \ mpfr::ForceRoundingMode __r2(mpfr::RoundingMode::Upward); \ if (__r2.success) { \ - __llvm_libc::sincosf(input, &sin, &cos); \ + LIBC_NAMESPACE::sincosf(input, &sin, &cos); \ EXPECT_MPFR_MATCH(mpfr::Operation::Sin, input, sin, 0.5, \ mpfr::RoundingMode::Upward); \ EXPECT_MPFR_MATCH(mpfr::Operation::Cos, input, cos, 0.5, \ @@ -80,7 +80,7 @@ TEST(LlvmLibcSinCosfTest, SpecialNumbers) { \ mpfr::ForceRoundingMode __r3(mpfr::RoundingMode::Downward); \ if (__r3.success) { \ - __llvm_libc::sincosf(input, &sin, &cos); \ + LIBC_NAMESPACE::sincosf(input, &sin, &cos); \ EXPECT_MPFR_MATCH(mpfr::Operation::Sin, input, sin, 0.5, \ mpfr::RoundingMode::Downward); \ EXPECT_MPFR_MATCH(mpfr::Operation::Cos, input, cos, 0.5, \ @@ -89,7 +89,7 @@ TEST(LlvmLibcSinCosfTest, SpecialNumbers) { \ mpfr::ForceRoundingMode __r4(mpfr::RoundingMode::TowardZero); \ if (__r4.success) { \ - __llvm_libc::sincosf(input, &sin, &cos); \ + LIBC_NAMESPACE::sincosf(input, &sin, &cos); \ EXPECT_MPFR_MATCH(mpfr::Operation::Sin, input, sin, 0.5, \ mpfr::RoundingMode::TowardZero); \ EXPECT_MPFR_MATCH(mpfr::Operation::Cos, input, cos, 0.5, \ diff --git a/libc/test/src/math/sinf_test.cpp b/libc/test/src/math/sinf_test.cpp index 3c94ae8..2425110 100644 --- a/libc/test/src/math/sinf_test.cpp +++ b/libc/test/src/math/sinf_test.cpp @@ -18,29 +18,29 @@ #include <errno.h> #include <stdint.h> -using __llvm_libc::testing::SDCOMP26094_VALUES; -using FPBits = __llvm_libc::fputil::FPBits<float>; +using LIBC_NAMESPACE::testing::SDCOMP26094_VALUES; +using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>; -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcSinfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ(aNaN, __llvm_libc::sinf(aNaN)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(0.0f, __llvm_libc::sinf(0.0f)); + EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::sinf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(-0.0f, __llvm_libc::sinf(-0.0f)); + EXPECT_FP_EQ(-0.0f, LIBC_NAMESPACE::sinf(-0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(aNaN, __llvm_libc::sinf(inf)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinf(inf)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ(aNaN, __llvm_libc::sinf(neg_inf)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinf(neg_inf)); EXPECT_MATH_ERRNO(EDOM); } @@ -52,7 +52,7 @@ TEST(LlvmLibcSinfTest, InFloatRange) { if (isnan(x) || isinf(x)) continue; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sin, x, - __llvm_libc::sinf(x), 0.5); + LIBC_NAMESPACE::sinf(x), 0.5); } } @@ -100,21 +100,21 @@ TEST(LlvmLibcSinfTest, SpecificBitPatterns) { for (int i = 0; i < N; ++i) { float x = float(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sin, x, - __llvm_libc::sinf(x), 0.5); + LIBC_NAMESPACE::sinf(x), 0.5); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sin, -x, - __llvm_libc::sinf(-x), 0.5); + LIBC_NAMESPACE::sinf(-x), 0.5); } } // For small values, sin(x) is x. TEST(LlvmLibcSinfTest, SmallValues) { float x = float(FPBits(0x1780'0000U)); - EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sin, x, __llvm_libc::sinf(x), - 0.5); + EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sin, x, + LIBC_NAMESPACE::sinf(x), 0.5); x = float(FPBits(0x0040'0000U)); - EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sin, x, __llvm_libc::sinf(x), - 0.5); + EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sin, x, + LIBC_NAMESPACE::sinf(x), 0.5); } // SDCOMP-26094: check sinf in the cases for which the range reducer @@ -123,6 +123,6 @@ TEST(LlvmLibcSinfTest, SDCOMP_26094) { for (uint32_t v : SDCOMP26094_VALUES) { float x = float(FPBits((v))); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sin, x, - __llvm_libc::sinf(x), 0.5); + LIBC_NAMESPACE::sinf(x), 0.5); } } diff --git a/libc/test/src/math/sinhf_test.cpp b/libc/test/src/math/sinhf_test.cpp index f42b831..92284ca 100644 --- a/libc/test/src/math/sinhf_test.cpp +++ b/libc/test/src/math/sinhf_test.cpp @@ -18,28 +18,28 @@ #include <errno.h> #include <stdint.h> -using FPBits = __llvm_libc::fputil::FPBits<float>; +using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>; -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcSinhfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ(aNaN, __llvm_libc::sinhf(aNaN)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinhf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(0.0f, __llvm_libc::sinhf(0.0f)); + EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::sinhf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(-0.0f, __llvm_libc::sinhf(-0.0f)); + EXPECT_FP_EQ(-0.0f, LIBC_NAMESPACE::sinhf(-0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(inf, __llvm_libc::sinhf(inf)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::sinhf(inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(neg_inf, __llvm_libc::sinhf(neg_inf)); + EXPECT_FP_EQ(neg_inf, LIBC_NAMESPACE::sinhf(neg_inf)); EXPECT_MATH_ERRNO(0); } @@ -50,19 +50,19 @@ TEST(LlvmLibcSinhfTest, InFloatRange) { float x = float(FPBits(v)); if (isnan(x) || isinf(x)) continue; - ASSERT_MPFR_MATCH(mpfr::Operation::Sinh, x, __llvm_libc::sinhf(x), 0.5); + ASSERT_MPFR_MATCH(mpfr::Operation::Sinh, x, LIBC_NAMESPACE::sinhf(x), 0.5); } } // For small values, sinh(x) is x. TEST(LlvmLibcSinhfTest, SmallValues) { float x = float(FPBits(uint32_t(0x17800000))); - float result = __llvm_libc::sinhf(x); + float result = LIBC_NAMESPACE::sinhf(x); EXPECT_MPFR_MATCH(mpfr::Operation::Sinh, x, result, 0.5); EXPECT_FP_EQ(x, result); x = float(FPBits(uint32_t(0x00400000))); - result = __llvm_libc::sinhf(x); + result = LIBC_NAMESPACE::sinhf(x); EXPECT_MPFR_MATCH(mpfr::Operation::Sinh, x, result, 0.5); EXPECT_FP_EQ(x, result); } @@ -70,24 +70,24 @@ TEST(LlvmLibcSinhfTest, SmallValues) { TEST(LlvmLibcSinhfTest, Overflow) { libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::sinhf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::sinhf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::sinhf(float(FPBits(0x42cffff8U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::sinhf(float(FPBits(0x42cffff8U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::sinhf(float(FPBits(0x42d00008U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::sinhf(float(FPBits(0x42d00008U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); } TEST(LlvmLibcSinhfTest, ExceptionalValues) { float x = float(FPBits(uint32_t(0x3a12'85ffU))); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sinh, x, - __llvm_libc::sinhf(x), 0.5); + LIBC_NAMESPACE::sinhf(x), 0.5); x = -float(FPBits(uint32_t(0x3a12'85ffU))); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sinh, x, - __llvm_libc::sinhf(x), 0.5); + LIBC_NAMESPACE::sinhf(x), 0.5); } diff --git a/libc/test/src/math/smoke/CeilTest.h b/libc/test/src/math/smoke/CeilTest.h index 0532183..c10fd28 100644 --- a/libc/test/src/math/smoke/CeilTest.h +++ b/libc/test/src/math/smoke/CeilTest.h @@ -11,7 +11,7 @@ #include <math.h> -template <typename T> class CeilTest : public __llvm_libc::testing::Test { +template <typename T> class CeilTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/smoke/CopySignTest.h b/libc/test/src/math/smoke/CopySignTest.h index 2d50dd4..c33f780 100644 --- a/libc/test/src/math/smoke/CopySignTest.h +++ b/libc/test/src/math/smoke/CopySignTest.h @@ -11,7 +11,8 @@ #include <math.h> -template <typename T> class CopySignTest : public __llvm_libc::testing::Test { +template <typename T> +class CopySignTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/smoke/FAbsTest.h b/libc/test/src/math/smoke/FAbsTest.h index df79703..7d905bae 100644 --- a/libc/test/src/math/smoke/FAbsTest.h +++ b/libc/test/src/math/smoke/FAbsTest.h @@ -11,7 +11,7 @@ #include <math.h> -template <typename T> class FAbsTest : public __llvm_libc::testing::Test { +template <typename T> class FAbsTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/smoke/FDimTest.h b/libc/test/src/math/smoke/FDimTest.h index c0dbda1..3118c36 100644 --- a/libc/test/src/math/smoke/FDimTest.h +++ b/libc/test/src/math/smoke/FDimTest.h @@ -13,10 +13,10 @@ #include <math.h> template <typename T> -class FDimTestTemplate : public __llvm_libc::testing::Test { +class FDimTestTemplate : public LIBC_NAMESPACE::testing::Test { public: using FuncPtr = T (*)(T, T); - using FPBits = __llvm_libc::fputil::FPBits<T>; + using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>; using UIntType = typename FPBits::UIntType; void test_na_n_arg(FuncPtr func) { @@ -74,9 +74,9 @@ public: private: // constexpr does not work on FPBits yet, so we cannot have these constants as // static. - const T nan = T(__llvm_libc::fputil::FPBits<T>::build_quiet_nan(1)); - const T inf = T(__llvm_libc::fputil::FPBits<T>::inf()); - const T neg_inf = T(__llvm_libc::fputil::FPBits<T>::neg_inf()); - const T zero = T(__llvm_libc::fputil::FPBits<T>::zero()); - const T neg_zero = T(__llvm_libc::fputil::FPBits<T>::neg_zero()); + const T nan = T(LIBC_NAMESPACE::fputil::FPBits<T>::build_quiet_nan(1)); + const T inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::inf()); + const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_inf()); + const T zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::zero()); + const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_zero()); }; diff --git a/libc/test/src/math/smoke/FMaxTest.h b/libc/test/src/math/smoke/FMaxTest.h index 5c353a6..e1192a4 100644 --- a/libc/test/src/math/smoke/FMaxTest.h +++ b/libc/test/src/math/smoke/FMaxTest.h @@ -11,7 +11,7 @@ #include <math.h> -template <typename T> class FMaxTest : public __llvm_libc::testing::Test { +template <typename T> class FMaxTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/smoke/FMinTest.h b/libc/test/src/math/smoke/FMinTest.h index 071ab75..f0764ec 100644 --- a/libc/test/src/math/smoke/FMinTest.h +++ b/libc/test/src/math/smoke/FMinTest.h @@ -11,7 +11,7 @@ #include <math.h> -template <typename T> class FMinTest : public __llvm_libc::testing::Test { +template <typename T> class FMinTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/smoke/FModTest.h b/libc/test/src/math/smoke/FModTest.h index 6bff888..5fc0ebf 100644 --- a/libc/test/src/math/smoke/FModTest.h +++ b/libc/test/src/math/smoke/FModTest.h @@ -21,11 +21,11 @@ EXPECT_FP_EQ(expected, f(x, y)); \ EXPECT_MATH_ERRNO((dom_err) ? EDOM : 0); \ EXPECT_FP_EXCEPTION(expected_exception); \ - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT) + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT) #define TEST_REGULAR(x, y, expected) TEST_SPECIAL(x, y, expected, false, 0) -template <typename T> class FmodTest : public __llvm_libc::testing::Test { +template <typename T> class FmodTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/smoke/FloorTest.h b/libc/test/src/math/smoke/FloorTest.h index b1125b0..1c1b62c 100644 --- a/libc/test/src/math/smoke/FloorTest.h +++ b/libc/test/src/math/smoke/FloorTest.h @@ -11,7 +11,7 @@ #include <math.h> -template <typename T> class FloorTest : public __llvm_libc::testing::Test { +template <typename T> class FloorTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/smoke/FmaTest.h b/libc/test/src/math/smoke/FmaTest.h index d276dba..3c1c120 100644 --- a/libc/test/src/math/smoke/FmaTest.h +++ b/libc/test/src/math/smoke/FmaTest.h @@ -14,16 +14,16 @@ #include "test/UnitTest/Test.h" template <typename T> -class FmaTestTemplate : public __llvm_libc::testing::Test { +class FmaTestTemplate : public LIBC_NAMESPACE::testing::Test { private: using Func = T (*)(T, T, T); - using FPBits = __llvm_libc::fputil::FPBits<T>; + using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>; using UIntType = typename FPBits::UIntType; - const T nan = T(__llvm_libc::fputil::FPBits<T>::build_quiet_nan(1)); - const T inf = T(__llvm_libc::fputil::FPBits<T>::inf()); - const T neg_inf = T(__llvm_libc::fputil::FPBits<T>::neg_inf()); - const T zero = T(__llvm_libc::fputil::FPBits<T>::zero()); - const T neg_zero = T(__llvm_libc::fputil::FPBits<T>::neg_zero()); + const T nan = T(LIBC_NAMESPACE::fputil::FPBits<T>::build_quiet_nan(1)); + const T inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::inf()); + const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_inf()); + const T zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::zero()); + const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_zero()); public: void test_special_numbers(Func func) { diff --git a/libc/test/src/math/smoke/FrexpTest.h b/libc/test/src/math/smoke/FrexpTest.h index 7a3a948..1740770 100644 --- a/libc/test/src/math/smoke/FrexpTest.h +++ b/libc/test/src/math/smoke/FrexpTest.h @@ -12,12 +12,12 @@ #include <math.h> -template <typename T> class FrexpTest : public __llvm_libc::testing::Test { +template <typename T> class FrexpTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) static constexpr UIntType HIDDEN_BIT = - UIntType(1) << __llvm_libc::fputil::MantissaWidth<T>::VALUE; + UIntType(1) << LIBC_NAMESPACE::fputil::MantissaWidth<T>::VALUE; public: typedef T (*FrexpFunc)(T, int *); diff --git a/libc/test/src/math/smoke/HypotTest.h b/libc/test/src/math/smoke/HypotTest.h index 084dbc4..22c2fe4 100644 --- a/libc/test/src/math/smoke/HypotTest.h +++ b/libc/test/src/math/smoke/HypotTest.h @@ -16,10 +16,10 @@ #include <math.h> template <typename T> -class HypotTestTemplate : public __llvm_libc::testing::Test { +class HypotTestTemplate : public LIBC_NAMESPACE::testing::Test { private: using Func = T (*)(T, T); - using FPBits = __llvm_libc::fputil::FPBits<T>; + using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>; using UIntType = typename FPBits::UIntType; const T nan = T(FPBits::build_quiet_nan(1)); const T inf = T(FPBits::inf()); diff --git a/libc/test/src/math/smoke/ILogbTest.h b/libc/test/src/math/smoke/ILogbTest.h index 6ad5eb0..e51a5d7 100644 --- a/libc/test/src/math/smoke/ILogbTest.h +++ b/libc/test/src/math/smoke/ILogbTest.h @@ -16,7 +16,7 @@ #include <limits.h> -class LlvmLibcILogbTest : public __llvm_libc::testing::Test { +class LlvmLibcILogbTest : public LIBC_NAMESPACE::testing::Test { public: template <typename T> struct ILogbFunc { typedef int (*Func)(T); @@ -24,14 +24,15 @@ public: template <typename T> void test_special_numbers(typename ILogbFunc<T>::Func func) { - EXPECT_EQ(FP_ILOGB0, func(T(__llvm_libc::fputil::FPBits<T>::zero()))); - EXPECT_EQ(FP_ILOGB0, func(T(__llvm_libc::fputil::FPBits<T>::neg_zero()))); + EXPECT_EQ(FP_ILOGB0, func(T(LIBC_NAMESPACE::fputil::FPBits<T>::zero()))); + EXPECT_EQ(FP_ILOGB0, + func(T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_zero()))); EXPECT_EQ(FP_ILOGBNAN, - func(T(__llvm_libc::fputil::FPBits<T>::build_quiet_nan(1)))); + func(T(LIBC_NAMESPACE::fputil::FPBits<T>::build_quiet_nan(1)))); - EXPECT_EQ(INT_MAX, func(T(__llvm_libc::fputil::FPBits<T>::inf()))); - EXPECT_EQ(INT_MAX, func(T(__llvm_libc::fputil::FPBits<T>::neg_inf()))); + EXPECT_EQ(INT_MAX, func(T(LIBC_NAMESPACE::fputil::FPBits<T>::inf()))); + EXPECT_EQ(INT_MAX, func(T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_inf()))); } template <typename T> @@ -75,7 +76,7 @@ public: template <typename T> void test_subnormal_range(typename ILogbFunc<T>::Func func) { - using FPBits = __llvm_libc::fputil::FPBits<T>; + using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>; using UIntType = typename FPBits::UIntType; constexpr UIntType COUNT = 10'001; constexpr UIntType STEP = @@ -88,14 +89,14 @@ public: continue; int exponent; - __llvm_libc::fputil::frexp(x, exponent); + LIBC_NAMESPACE::fputil::frexp(x, exponent); ASSERT_EQ(exponent, func(x) + 1); } } template <typename T> void test_normal_range(typename ILogbFunc<T>::Func func) { - using FPBits = __llvm_libc::fputil::FPBits<T>; + using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>; using UIntType = typename FPBits::UIntType; constexpr UIntType COUNT = 10'001; constexpr UIntType STEP = @@ -106,7 +107,7 @@ public: 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 2e59299..bffa733 100644 --- a/libc/test/src/math/smoke/LdExpTest.h +++ b/libc/test/src/math/smoke/LdExpTest.h @@ -19,20 +19,20 @@ #include <stdint.h> template <typename T> -class LdExpTestTemplate : public __llvm_libc::testing::Test { - using FPBits = __llvm_libc::fputil::FPBits<T>; - using NormalFloat = __llvm_libc::fputil::NormalFloat<T>; +class LdExpTestTemplate : public LIBC_NAMESPACE::testing::Test { + using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>; + using NormalFloat = LIBC_NAMESPACE::fputil::NormalFloat<T>; using UIntType = typename FPBits::UIntType; static constexpr UIntType MANTISSA_WIDTH = - __llvm_libc::fputil::MantissaWidth<T>::VALUE; + LIBC_NAMESPACE::fputil::MantissaWidth<T>::VALUE; // A normalized mantissa to be used with tests. static constexpr UIntType MANTISSA = NormalFloat::ONE + 0x1234; - const T zero = T(__llvm_libc::fputil::FPBits<T>::zero()); - const T neg_zero = T(__llvm_libc::fputil::FPBits<T>::neg_zero()); - const T inf = T(__llvm_libc::fputil::FPBits<T>::inf()); - const T neg_inf = T(__llvm_libc::fputil::FPBits<T>::neg_inf()); - const T nan = T(__llvm_libc::fputil::FPBits<T>::build_quiet_nan(1)); + const T zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::zero()); + const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_zero()); + const T inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::inf()); + const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_inf()); + const T nan = T(LIBC_NAMESPACE::fputil::FPBits<T>::build_quiet_nan(1)); public: typedef T (*LdExpFunc)(T, int); diff --git a/libc/test/src/math/smoke/LogbTest.h b/libc/test/src/math/smoke/LogbTest.h index 885bd7c..34cf92c 100644 --- a/libc/test/src/math/smoke/LogbTest.h +++ b/libc/test/src/math/smoke/LogbTest.h @@ -12,12 +12,12 @@ #include <math.h> -template <typename T> class LogbTest : public __llvm_libc::testing::Test { +template <typename T> class LogbTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) static constexpr UIntType HIDDEN_BIT = - UIntType(1) << __llvm_libc::fputil::MantissaWidth<T>::VALUE; + UIntType(1) << LIBC_NAMESPACE::fputil::MantissaWidth<T>::VALUE; public: typedef T (*LogbFunc)(T); @@ -77,7 +77,7 @@ public: 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 687d0dd..012a324 100644 --- a/libc/test/src/math/smoke/ModfTest.h +++ b/libc/test/src/math/smoke/ModfTest.h @@ -13,7 +13,7 @@ #include <math.h> -template <typename T> class ModfTest : public __llvm_libc::testing::Test { +template <typename T> class ModfTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) @@ -90,8 +90,8 @@ public: 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 e6de941..4e450cf 100644 --- a/libc/test/src/math/smoke/NextAfterTest.h +++ b/libc/test/src/math/smoke/NextAfterTest.h @@ -18,13 +18,13 @@ #include <math.h> template <typename T> -class NextAfterTestTemplate : public __llvm_libc::testing::Test { - using FPBits = __llvm_libc::fputil::FPBits<T>; - using MantissaWidth = __llvm_libc::fputil::MantissaWidth<T>; +class NextAfterTestTemplate : public LIBC_NAMESPACE::testing::Test { + using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>; + using MantissaWidth = LIBC_NAMESPACE::fputil::MantissaWidth<T>; using UIntType = typename FPBits::UIntType; static constexpr int BIT_WIDTH_OF_TYPE = - __llvm_libc::fputil::FloatProperties<T>::BIT_WIDTH; + LIBC_NAMESPACE::fputil::FloatProperties<T>::BIT_WIDTH; const T zero = T(FPBits::zero()); const T neg_zero = T(FPBits::neg_zero()); @@ -52,54 +52,54 @@ public: T x = zero; T result = func(x, T(1)); UIntType expected_bits = 1; - T expected = __llvm_libc::cpp::bit_cast<T>(expected_bits); + T expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits); ASSERT_FP_EQ(result, expected); result = func(x, T(-1)); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + 1; - expected = __llvm_libc::cpp::bit_cast<T>(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits); ASSERT_FP_EQ(result, expected); x = neg_zero; result = func(x, 1); expected_bits = 1; - expected = __llvm_libc::cpp::bit_cast<T>(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits); ASSERT_FP_EQ(result, expected); result = func(x, -1); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + 1; - expected = __llvm_libc::cpp::bit_cast<T>(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits); ASSERT_FP_EQ(result, expected); // 'from' is max subnormal value. - x = __llvm_libc::cpp::bit_cast<T>(max_subnormal); + x = LIBC_NAMESPACE::cpp::bit_cast<T>(max_subnormal); result = func(x, 1); - expected = __llvm_libc::cpp::bit_cast<T>(min_normal); + expected = LIBC_NAMESPACE::cpp::bit_cast<T>(min_normal); ASSERT_FP_EQ(result, expected); result = func(x, 0); expected_bits = max_subnormal - 1; - expected = __llvm_libc::cpp::bit_cast<T>(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits); ASSERT_FP_EQ(result, expected); x = -x; result = func(x, -1); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + min_normal; - expected = __llvm_libc::cpp::bit_cast<T>(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits); ASSERT_FP_EQ(result, expected); result = func(x, 0); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + max_subnormal - 1; - expected = __llvm_libc::cpp::bit_cast<T>(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits); ASSERT_FP_EQ(result, expected); // 'from' is min subnormal value. - x = __llvm_libc::cpp::bit_cast<T>(min_subnormal); + x = LIBC_NAMESPACE::cpp::bit_cast<T>(min_subnormal); result = func(x, 1); expected_bits = min_subnormal + 1; - expected = __llvm_libc::cpp::bit_cast<T>(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits); ASSERT_FP_EQ(result, expected); ASSERT_FP_EQ(func(x, 0), 0); @@ -107,35 +107,35 @@ public: result = func(x, -1); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + min_subnormal + 1; - expected = __llvm_libc::cpp::bit_cast<T>(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits); ASSERT_FP_EQ(result, expected); ASSERT_FP_EQ(func(x, 0), T(-0.0)); // 'from' is min normal. - x = __llvm_libc::cpp::bit_cast<T>(min_normal); + x = LIBC_NAMESPACE::cpp::bit_cast<T>(min_normal); result = func(x, 0); expected_bits = max_subnormal; - expected = __llvm_libc::cpp::bit_cast<T>(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits); ASSERT_FP_EQ(result, expected); result = func(x, inf); expected_bits = min_normal + 1; - expected = __llvm_libc::cpp::bit_cast<T>(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits); ASSERT_FP_EQ(result, expected); x = -x; result = func(x, 0); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + max_subnormal; - expected = __llvm_libc::cpp::bit_cast<T>(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits); ASSERT_FP_EQ(result, expected); result = func(x, -inf); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + min_normal + 1; - expected = __llvm_libc::cpp::bit_cast<T>(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits); ASSERT_FP_EQ(result, expected); // 'from' is max normal and 'to' is infinity. - x = __llvm_libc::cpp::bit_cast<T>(max_normal); + x = LIBC_NAMESPACE::cpp::bit_cast<T>(max_normal); result = func(x, inf); ASSERT_FP_EQ(result, inf); @@ -146,14 +146,14 @@ public: x = inf; result = func(x, 0); expected_bits = max_normal; - expected = __llvm_libc::cpp::bit_cast<T>(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits); ASSERT_FP_EQ(result, expected); ASSERT_FP_EQ(func(x, inf), inf); x = neg_inf; result = func(x, 0); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + max_normal; - expected = __llvm_libc::cpp::bit_cast<T>(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast<T>(expected_bits); ASSERT_FP_EQ(result, expected); ASSERT_FP_EQ(func(x, neg_inf), neg_inf); diff --git a/libc/test/src/math/smoke/RIntTest.h b/libc/test/src/math/smoke/RIntTest.h index 7a6d5c7..839240f 100644 --- a/libc/test/src/math/smoke/RIntTest.h +++ b/libc/test/src/math/smoke/RIntTest.h @@ -22,12 +22,12 @@ static constexpr int ROUNDING_MODES[4] = {FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO, FE_TONEAREST}; template <typename T> -class RIntTestTemplate : public __llvm_libc::testing::Test { +class RIntTestTemplate : public LIBC_NAMESPACE::testing::Test { public: typedef T (*RIntFunc)(T); private: - using FPBits = __llvm_libc::fputil::FPBits<T>; + using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>; using UIntType = typename FPBits::UIntType; const T zero = T(FPBits::zero()); @@ -39,7 +39,7 @@ private: 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 4d49fd7..5a5d143 100644 --- a/libc/test/src/math/smoke/RemQuoTest.h +++ b/libc/test/src/math/smoke/RemQuoTest.h @@ -16,15 +16,15 @@ #include <math.h> template <typename T> -class RemQuoTestTemplate : public __llvm_libc::testing::Test { - using FPBits = __llvm_libc::fputil::FPBits<T>; +class RemQuoTestTemplate : public LIBC_NAMESPACE::testing::Test { + using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>; using UIntType = typename FPBits::UIntType; - const T zero = T(__llvm_libc::fputil::FPBits<T>::zero()); - const T neg_zero = T(__llvm_libc::fputil::FPBits<T>::neg_zero()); - const T inf = T(__llvm_libc::fputil::FPBits<T>::inf()); - const T neg_inf = T(__llvm_libc::fputil::FPBits<T>::neg_inf()); - const T nan = T(__llvm_libc::fputil::FPBits<T>::build_quiet_nan(1)); + const T zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::zero()); + const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_zero()); + const T inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::inf()); + const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits<T>::neg_inf()); + const T nan = T(LIBC_NAMESPACE::fputil::FPBits<T>::build_quiet_nan(1)); public: typedef T (*RemQuoFunc)(T, T, int *); diff --git a/libc/test/src/math/smoke/RoundTest.h b/libc/test/src/math/smoke/RoundTest.h index c67f1ce..2e95f18 100644 --- a/libc/test/src/math/smoke/RoundTest.h +++ b/libc/test/src/math/smoke/RoundTest.h @@ -11,7 +11,7 @@ #include <math.h> -template <typename T> class RoundTest : public __llvm_libc::testing::Test { +template <typename T> class RoundTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/smoke/RoundToIntegerTest.h b/libc/test/src/math/smoke/RoundToIntegerTest.h index c37186b..31ce852 100644 --- a/libc/test/src/math/smoke/RoundToIntegerTest.h +++ b/libc/test/src/math/smoke/RoundToIntegerTest.h @@ -21,26 +21,26 @@ static constexpr int ROUNDING_MODES[4] = {FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO, FE_TONEAREST}; template <typename F, typename I, bool TestModes = false> -class RoundToIntegerTestTemplate : public __llvm_libc::testing::Test { +class RoundToIntegerTestTemplate : public LIBC_NAMESPACE::testing::Test { public: typedef I (*RoundToIntegerFunc)(F); private: - using FPBits = __llvm_libc::fputil::FPBits<F>; + using FPBits = LIBC_NAMESPACE::fputil::FPBits<F>; using UIntType = typename FPBits::UIntType; - const F zero = F(__llvm_libc::fputil::FPBits<F>::zero()); - const F neg_zero = F(__llvm_libc::fputil::FPBits<F>::neg_zero()); - const F inf = F(__llvm_libc::fputil::FPBits<F>::inf()); - const F neg_inf = F(__llvm_libc::fputil::FPBits<F>::neg_inf()); - const F nan = F(__llvm_libc::fputil::FPBits<F>::build_quiet_nan(1)); + const F zero = F(LIBC_NAMESPACE::fputil::FPBits<F>::zero()); + const F neg_zero = F(LIBC_NAMESPACE::fputil::FPBits<F>::neg_zero()); + const F inf = F(LIBC_NAMESPACE::fputil::FPBits<F>::inf()); + const F neg_inf = F(LIBC_NAMESPACE::fputil::FPBits<F>::neg_inf()); + const F nan = F(LIBC_NAMESPACE::fputil::FPBits<F>::build_quiet_nan(1)); static constexpr I INTEGER_MIN = I(1) << (sizeof(I) * 8 - 1); static constexpr I INTEGER_MAX = -(INTEGER_MIN + 1); void test_one_input(RoundToIntegerFunc func, F input, I expected, bool expectError) { libc_errno = 0; - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); ASSERT_EQ(func(input), expected); @@ -59,7 +59,7 @@ public: // 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 @@ public: 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 @@ public: 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 @@ public: // 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 c3896e3..d4b2f9d 100644 --- a/libc/test/src/math/smoke/SqrtTest.h +++ b/libc/test/src/math/smoke/SqrtTest.h @@ -12,12 +12,12 @@ #include <math.h> -template <typename T> class SqrtTest : public __llvm_libc::testing::Test { +template <typename T> class SqrtTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) static constexpr UIntType HIDDEN_BIT = - UIntType(1) << __llvm_libc::fputil::MantissaWidth<T>::VALUE; + UIntType(1) << LIBC_NAMESPACE::fputil::MantissaWidth<T>::VALUE; public: typedef T (*SqrtFunc)(T); diff --git a/libc/test/src/math/smoke/TruncTest.h b/libc/test/src/math/smoke/TruncTest.h index 32b5503..8334a7b 100644 --- a/libc/test/src/math/smoke/TruncTest.h +++ b/libc/test/src/math/smoke/TruncTest.h @@ -11,7 +11,7 @@ #include <math.h> -template <typename T> class TruncTest : public __llvm_libc::testing::Test { +template <typename T> class TruncTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/smoke/acosf_test.cpp b/libc/test/src/math/smoke/acosf_test.cpp index 0fc2097..b8ba3d5 100644 --- a/libc/test/src/math/smoke/acosf_test.cpp +++ b/libc/test/src/math/smoke/acosf_test.cpp @@ -16,28 +16,28 @@ #include <errno.h> #include <stdint.h> -using FPBits = __llvm_libc::fputil::FPBits<float>; +using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcAcosfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(aNaN)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(inf)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(neg_inf)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(neg_inf)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::acosf(1.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::acosf(1.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(2.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(2.0f)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(-2.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(-2.0f)); EXPECT_MATH_ERRNO(EDOM); } diff --git a/libc/test/src/math/smoke/acoshf_test.cpp b/libc/test/src/math/smoke/acoshf_test.cpp index ac3021f..b8d7453 100644 --- a/libc/test/src/math/smoke/acoshf_test.cpp +++ b/libc/test/src/math/smoke/acoshf_test.cpp @@ -16,25 +16,25 @@ #include <errno.h> #include <stdint.h> -using FPBits_t = __llvm_libc::fputil::FPBits<float>; +using FPBits_t = LIBC_NAMESPACE::fputil::FPBits<float>; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcAcoshfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acoshf(aNaN)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acoshf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acoshf(0.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acoshf(0.0f)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::acoshf(1.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::acoshf(1.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::acoshf(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(inf, LIBC_NAMESPACE::acoshf(inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acoshf(neg_inf)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acoshf(neg_inf)); EXPECT_MATH_ERRNO(EDOM); } diff --git a/libc/test/src/math/smoke/asinf_test.cpp b/libc/test/src/math/smoke/asinf_test.cpp index f645547..e2eca35 100644 --- a/libc/test/src/math/smoke/asinf_test.cpp +++ b/libc/test/src/math/smoke/asinf_test.cpp @@ -16,31 +16,31 @@ #include <errno.h> #include <stdint.h> -using FPBits = __llvm_libc::fputil::FPBits<float>; +using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcAsinfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinf(aNaN)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::asinf(0.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::asinf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, __llvm_libc::asinf(-0.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, LIBC_NAMESPACE::asinf(-0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinf(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinf(inf)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinf(neg_inf)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinf(neg_inf)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinf(2.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinf(2.0f)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinf(-2.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinf(-2.0f)); EXPECT_MATH_ERRNO(EDOM); } diff --git a/libc/test/src/math/smoke/asinhf_test.cpp b/libc/test/src/math/smoke/asinhf_test.cpp index 6b5f943..f10cf93 100644 --- a/libc/test/src/math/smoke/asinhf_test.cpp +++ b/libc/test/src/math/smoke/asinhf_test.cpp @@ -16,25 +16,25 @@ #include <errno.h> #include <stdint.h> -using FPBits_t = __llvm_libc::fputil::FPBits<float>; +using FPBits_t = LIBC_NAMESPACE::fputil::FPBits<float>; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcAsinhfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinhf(aNaN)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinhf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::asinhf(0.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::asinhf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, __llvm_libc::asinhf(-0.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, LIBC_NAMESPACE::asinhf(-0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::asinhf(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(inf, LIBC_NAMESPACE::asinhf(inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(neg_inf, __llvm_libc::asinhf(neg_inf)); + EXPECT_FP_EQ_ALL_ROUNDING(neg_inf, LIBC_NAMESPACE::asinhf(neg_inf)); EXPECT_MATH_ERRNO(0); } diff --git a/libc/test/src/math/smoke/atanf_test.cpp b/libc/test/src/math/smoke/atanf_test.cpp index 7d3f386..6e6f854 100644 --- a/libc/test/src/math/smoke/atanf_test.cpp +++ b/libc/test/src/math/smoke/atanf_test.cpp @@ -16,25 +16,25 @@ #include <errno.h> #include <stdint.h> -using FPBits = __llvm_libc::fputil::FPBits<float>; +using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcAtanfTest, SpecialNumbers) { libc_errno = 0; - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanf(aNaN)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanf(aNaN)); EXPECT_FP_EXCEPTION(0); EXPECT_MATH_ERRNO(0); - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::atanf(0.0f)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::atanf(0.0f)); EXPECT_FP_EXCEPTION(0); EXPECT_MATH_ERRNO(0); - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, __llvm_libc::atanf(-0.0f)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, LIBC_NAMESPACE::atanf(-0.0f)); EXPECT_FP_EXCEPTION(0); EXPECT_MATH_ERRNO(0); } diff --git a/libc/test/src/math/smoke/atanhf_test.cpp b/libc/test/src/math/smoke/atanhf_test.cpp index ac2d47b..841cb88 100644 --- a/libc/test/src/math/smoke/atanhf_test.cpp +++ b/libc/test/src/math/smoke/atanhf_test.cpp @@ -16,57 +16,57 @@ #include <errno.h> #include <stdint.h> -using FPBits = __llvm_libc::fputil::FPBits<float>; +using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcAtanhfTest, SpecialNumbers) { libc_errno = 0; - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanhf(aNaN)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf(aNaN)); EXPECT_FP_EXCEPTION(0); EXPECT_MATH_ERRNO(0); - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::atanhf(0.0f)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::atanhf(0.0f)); EXPECT_FP_EXCEPTION(0); EXPECT_MATH_ERRNO(0); - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, __llvm_libc::atanhf(-0.0f)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, LIBC_NAMESPACE::atanhf(-0.0f)); EXPECT_FP_EXCEPTION(0); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_WITH_EXCEPTION(inf, __llvm_libc::atanhf(1.0f), FE_DIVBYZERO); + EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::atanhf(1.0f), FE_DIVBYZERO); EXPECT_MATH_ERRNO(ERANGE); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::atanhf(-1.0f), + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::atanhf(-1.0f), FE_DIVBYZERO); EXPECT_MATH_ERRNO(ERANGE); auto bt = FPBits(1.0f); bt.bits += 1; - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::atanhf(bt.get_val()), + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::atanhf(bt.get_val()), FE_INVALID); EXPECT_MATH_ERRNO(EDOM); bt.set_sign(true); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::atanhf(bt.get_val()), + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::atanhf(bt.get_val()), FE_INVALID); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::atanhf(2.0f), FE_INVALID); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::atanhf(2.0f), FE_INVALID); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::atanhf(-2.0f), FE_INVALID); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::atanhf(-2.0f), FE_INVALID); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::atanhf(inf), FE_INVALID); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::atanhf(inf), FE_INVALID); EXPECT_MATH_ERRNO(EDOM); bt.set_sign(true); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::atanhf(neg_inf), FE_INVALID); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::atanhf(neg_inf), FE_INVALID); EXPECT_MATH_ERRNO(EDOM); } diff --git a/libc/test/src/math/smoke/ceil_test.cpp b/libc/test/src/math/smoke/ceil_test.cpp index 2a592e3..800452a 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 cfa8cb2..2a25042 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 6fe3046..0f76660 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 37bfa0d..5b3d812 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 fec283c..344ffee 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 d1de911..bed6067 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 4ef9667..6a2c6a5 100644 --- a/libc/test/src/math/smoke/cosf_test.cpp +++ b/libc/test/src/math/smoke/cosf_test.cpp @@ -16,25 +16,25 @@ #include <errno.h> #include <stdint.h> -using FPBits = __llvm_libc::fputil::FPBits<float>; +using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcCosfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::cosf(aNaN)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::cosf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::cosf(0.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(1.0f, LIBC_NAMESPACE::cosf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::cosf(-0.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(1.0f, LIBC_NAMESPACE::cosf(-0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::cosf(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::cosf(inf)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::cosf(neg_inf)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::cosf(neg_inf)); EXPECT_MATH_ERRNO(EDOM); } diff --git a/libc/test/src/math/smoke/coshf_test.cpp b/libc/test/src/math/smoke/coshf_test.cpp index 7198aa2..dd08f19 100644 --- a/libc/test/src/math/smoke/coshf_test.cpp +++ b/libc/test/src/math/smoke/coshf_test.cpp @@ -17,40 +17,40 @@ #include <errno.h> #include <stdint.h> -using FPBits = __llvm_libc::fputil::FPBits<float>; +using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcCoshfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::coshf(aNaN)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::coshf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::coshf(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(inf, LIBC_NAMESPACE::coshf(inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::coshf(neg_inf)); + EXPECT_FP_EQ_ALL_ROUNDING(inf, LIBC_NAMESPACE::coshf(neg_inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::coshf(0.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(1.0f, LIBC_NAMESPACE::coshf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::coshf(-0.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(1.0f, LIBC_NAMESPACE::coshf(-0.0f)); EXPECT_MATH_ERRNO(0); } TEST(LlvmLibcCoshfTest, Overflow) { libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::coshf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::coshf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::coshf(float(FPBits(0x42cffff8U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::coshf(float(FPBits(0x42cffff8U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::coshf(float(FPBits(0x42d00008U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::coshf(float(FPBits(0x42d00008U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); } diff --git a/libc/test/src/math/smoke/erff_test.cpp b/libc/test/src/math/smoke/erff_test.cpp index c2a247b..9c91051 100644 --- a/libc/test/src/math/smoke/erff_test.cpp +++ b/libc/test/src/math/smoke/erff_test.cpp @@ -15,14 +15,14 @@ #include <errno.h> #include <stdint.h> -using __llvm_libc::testing::tlog; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcErffTest, SpecialNumbers) { - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::erff(aNaN)); - EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::erff(inf)); - EXPECT_FP_EQ_ALL_ROUNDING(-1.0f, __llvm_libc::erff(neg_inf)); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::erff(zero)); - EXPECT_FP_EQ_ALL_ROUNDING(neg_zero, __llvm_libc::erff(neg_zero)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::erff(aNaN)); + EXPECT_FP_EQ_ALL_ROUNDING(1.0f, LIBC_NAMESPACE::erff(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(-1.0f, LIBC_NAMESPACE::erff(neg_inf)); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::erff(zero)); + EXPECT_FP_EQ_ALL_ROUNDING(neg_zero, LIBC_NAMESPACE::erff(neg_zero)); } diff --git a/libc/test/src/math/smoke/exp10_test.cpp b/libc/test/src/math/smoke/exp10_test.cpp index 21ba51d..cf699ba 100644 --- a/libc/test/src/math/smoke/exp10_test.cpp +++ b/libc/test/src/math/smoke/exp10_test.cpp @@ -16,21 +16,22 @@ #include <errno.h> #include <stdint.h> -using __llvm_libc::testing::tlog; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(double) TEST(LlvmLibcExp10Test, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::exp10(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::exp10(inf)); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::exp10(neg_inf)); - EXPECT_FP_EQ_WITH_EXCEPTION(zero, __llvm_libc::exp10(-0x1.0p20), + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp10(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::exp10(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::exp10(neg_inf)); + EXPECT_FP_EQ_WITH_EXCEPTION(zero, LIBC_NAMESPACE::exp10(-0x1.0p20), FE_UNDERFLOW); - EXPECT_FP_EQ_WITH_EXCEPTION(inf, __llvm_libc::exp10(0x1.0p20), FE_OVERFLOW); - EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp10(0.0)); - EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp10(-0.0)); + EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp10(0x1.0p20), + FE_OVERFLOW); + EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp10(0.0)); + EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp10(-0.0)); - EXPECT_FP_EQ_ALL_ROUNDING(10.0, __llvm_libc::exp10(1.0)); - EXPECT_FP_EQ_ALL_ROUNDING(100.0, __llvm_libc::exp10(2.0)); - EXPECT_FP_EQ_ALL_ROUNDING(1000.0, __llvm_libc::exp10(3.0)); + EXPECT_FP_EQ_ALL_ROUNDING(10.0, LIBC_NAMESPACE::exp10(1.0)); + EXPECT_FP_EQ_ALL_ROUNDING(100.0, LIBC_NAMESPACE::exp10(2.0)); + EXPECT_FP_EQ_ALL_ROUNDING(1000.0, LIBC_NAMESPACE::exp10(3.0)); } diff --git a/libc/test/src/math/smoke/exp10f_test.cpp b/libc/test/src/math/smoke/exp10f_test.cpp index 4de0074..c4d3cb6 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 13b24b0..ec076c1 100644 --- a/libc/test/src/math/smoke/exp2_test.cpp +++ b/libc/test/src/math/smoke/exp2_test.cpp @@ -16,20 +16,21 @@ #include <errno.h> #include <stdint.h> -using __llvm_libc::testing::tlog; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(double) TEST(LlvmLibcExp2Test, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::exp2(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::exp2(inf)); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::exp2(neg_inf)); - EXPECT_FP_EQ_WITH_EXCEPTION(zero, __llvm_libc::exp2(-0x1.0p20), FE_UNDERFLOW); - EXPECT_FP_EQ_WITH_EXCEPTION(inf, __llvm_libc::exp2(0x1.0p20), FE_OVERFLOW); - EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp2(0.0)); - EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp2(-0.0)); - EXPECT_FP_EQ_ALL_ROUNDING(2.0, __llvm_libc::exp2(1.0)); - EXPECT_FP_EQ_ALL_ROUNDING(0.5, __llvm_libc::exp2(-1.0)); - EXPECT_FP_EQ_ALL_ROUNDING(4.0, __llvm_libc::exp2(2.0)); - EXPECT_FP_EQ_ALL_ROUNDING(0.25, __llvm_libc::exp2(-2.0)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp2(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::exp2(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::exp2(neg_inf)); + EXPECT_FP_EQ_WITH_EXCEPTION(zero, LIBC_NAMESPACE::exp2(-0x1.0p20), + FE_UNDERFLOW); + EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp2(0x1.0p20), FE_OVERFLOW); + EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp2(0.0)); + EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp2(-0.0)); + EXPECT_FP_EQ_ALL_ROUNDING(2.0, LIBC_NAMESPACE::exp2(1.0)); + EXPECT_FP_EQ_ALL_ROUNDING(0.5, LIBC_NAMESPACE::exp2(-1.0)); + EXPECT_FP_EQ_ALL_ROUNDING(4.0, LIBC_NAMESPACE::exp2(2.0)); + EXPECT_FP_EQ_ALL_ROUNDING(0.25, LIBC_NAMESPACE::exp2(-2.0)); } diff --git a/libc/test/src/math/smoke/exp2f_test.cpp b/libc/test/src/math/smoke/exp2f_test.cpp index c22a5eb..f26f155 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 3406f0a..7973c37 100644 --- a/libc/test/src/math/smoke/exp_test.cpp +++ b/libc/test/src/math/smoke/exp_test.cpp @@ -16,16 +16,17 @@ #include <errno.h> #include <stdint.h> -using __llvm_libc::testing::tlog; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(double) TEST(LlvmLibcExpTest, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::exp(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::exp(inf)); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::exp(neg_inf)); - EXPECT_FP_EQ_WITH_EXCEPTION(zero, __llvm_libc::exp(-0x1.0p20), FE_UNDERFLOW); - EXPECT_FP_EQ_WITH_EXCEPTION(inf, __llvm_libc::exp(0x1.0p20), FE_OVERFLOW); - EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp(0.0)); - EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp(-0.0)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::exp(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::exp(neg_inf)); + EXPECT_FP_EQ_WITH_EXCEPTION(zero, LIBC_NAMESPACE::exp(-0x1.0p20), + FE_UNDERFLOW); + EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp(0x1.0p20), FE_OVERFLOW); + EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp(0.0)); + EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp(-0.0)); } diff --git a/libc/test/src/math/smoke/expf_test.cpp b/libc/test/src/math/smoke/expf_test.cpp index 174d580..e5c5afb 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 f345624..03fe141 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 2bf0ddd..0447040 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 6374a10..9f1e2a6 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 ff13202..37d2b54 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 80174b7..2f00a30 100644 --- a/libc/test/src/math/smoke/fdim_test.cpp +++ b/libc/test/src/math/smoke/fdim_test.cpp @@ -16,16 +16,18 @@ using LlvmLibcFDimTest = FDimTestTemplate<double>; -TEST_F(LlvmLibcFDimTest, NaNArg_fdim) { test_na_n_arg(&__llvm_libc::fdim); } +TEST_F(LlvmLibcFDimTest, NaNArg_fdim) { test_na_n_arg(&LIBC_NAMESPACE::fdim); } -TEST_F(LlvmLibcFDimTest, InfArg_fdim) { test_inf_arg(&__llvm_libc::fdim); } +TEST_F(LlvmLibcFDimTest, InfArg_fdim) { test_inf_arg(&LIBC_NAMESPACE::fdim); } TEST_F(LlvmLibcFDimTest, NegInfArg_fdim) { - test_neg_inf_arg(&__llvm_libc::fdim); + test_neg_inf_arg(&LIBC_NAMESPACE::fdim); } -TEST_F(LlvmLibcFDimTest, BothZero_fdim) { test_both_zero(&__llvm_libc::fdim); } +TEST_F(LlvmLibcFDimTest, BothZero_fdim) { + test_both_zero(&LIBC_NAMESPACE::fdim); +} TEST_F(LlvmLibcFDimTest, InDoubleRange_fdim) { - test_in_range(&__llvm_libc::fdim); + test_in_range(&LIBC_NAMESPACE::fdim); } diff --git a/libc/test/src/math/smoke/fdimf_test.cpp b/libc/test/src/math/smoke/fdimf_test.cpp index 531b89b..27511ba 100644 --- a/libc/test/src/math/smoke/fdimf_test.cpp +++ b/libc/test/src/math/smoke/fdimf_test.cpp @@ -16,18 +16,20 @@ using LlvmLibcFDimTest = FDimTestTemplate<float>; -TEST_F(LlvmLibcFDimTest, NaNArg_fdimf) { test_na_n_arg(&__llvm_libc::fdimf); } +TEST_F(LlvmLibcFDimTest, NaNArg_fdimf) { + test_na_n_arg(&LIBC_NAMESPACE::fdimf); +} -TEST_F(LlvmLibcFDimTest, InfArg_fdimf) { test_inf_arg(&__llvm_libc::fdimf); } +TEST_F(LlvmLibcFDimTest, InfArg_fdimf) { test_inf_arg(&LIBC_NAMESPACE::fdimf); } TEST_F(LlvmLibcFDimTest, NegInfArg_fdimf) { - test_neg_inf_arg(&__llvm_libc::fdimf); + test_neg_inf_arg(&LIBC_NAMESPACE::fdimf); } TEST_F(LlvmLibcFDimTest, BothZero_fdimf) { - test_both_zero(&__llvm_libc::fdimf); + test_both_zero(&LIBC_NAMESPACE::fdimf); } TEST_F(LlvmLibcFDimTest, InFloatRange_fdimf) { - test_in_range(&__llvm_libc::fdimf); + test_in_range(&LIBC_NAMESPACE::fdimf); } diff --git a/libc/test/src/math/smoke/fdiml_test.cpp b/libc/test/src/math/smoke/fdiml_test.cpp index bb6c54d..45aedb0 100644 --- a/libc/test/src/math/smoke/fdiml_test.cpp +++ b/libc/test/src/math/smoke/fdiml_test.cpp @@ -16,18 +16,20 @@ using LlvmLibcFDimTest = FDimTestTemplate<long double>; -TEST_F(LlvmLibcFDimTest, NaNArg_fdiml) { test_na_n_arg(&__llvm_libc::fdiml); } +TEST_F(LlvmLibcFDimTest, NaNArg_fdiml) { + test_na_n_arg(&LIBC_NAMESPACE::fdiml); +} -TEST_F(LlvmLibcFDimTest, InfArg_fdiml) { test_inf_arg(&__llvm_libc::fdiml); } +TEST_F(LlvmLibcFDimTest, InfArg_fdiml) { test_inf_arg(&LIBC_NAMESPACE::fdiml); } TEST_F(LlvmLibcFDimTest, NegInfArg_fdiml) { - test_neg_inf_arg(&__llvm_libc::fdiml); + test_neg_inf_arg(&LIBC_NAMESPACE::fdiml); } TEST_F(LlvmLibcFDimTest, BothZero_fdiml) { - test_both_zero(&__llvm_libc::fdiml); + test_both_zero(&LIBC_NAMESPACE::fdiml); } TEST_F(LlvmLibcFDimTest, InLongDoubleRange_fdiml) { - test_in_range(&__llvm_libc::fdiml); + test_in_range(&LIBC_NAMESPACE::fdiml); } diff --git a/libc/test/src/math/smoke/floor_test.cpp b/libc/test/src/math/smoke/floor_test.cpp index e68ed3e..9231d07 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 f0538f7..cbb11f3 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 1b244fd..26f6a770 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 f33860f..4460b80 100644 --- a/libc/test/src/math/smoke/fma_test.cpp +++ b/libc/test/src/math/smoke/fma_test.cpp @@ -13,5 +13,5 @@ using LlvmLibcFmaTest = FmaTestTemplate<double>; TEST_F(LlvmLibcFmaTest, SpecialNumbers) { - test_special_numbers(&__llvm_libc::fma); + test_special_numbers(&LIBC_NAMESPACE::fma); } diff --git a/libc/test/src/math/smoke/fmaf_test.cpp b/libc/test/src/math/smoke/fmaf_test.cpp index 38c2ea3..a645efb 100644 --- a/libc/test/src/math/smoke/fmaf_test.cpp +++ b/libc/test/src/math/smoke/fmaf_test.cpp @@ -13,5 +13,5 @@ using LlvmLibcFmafTest = FmaTestTemplate<float>; TEST_F(LlvmLibcFmafTest, SpecialNumbers) { - test_special_numbers(&__llvm_libc::fmaf); + test_special_numbers(&LIBC_NAMESPACE::fmaf); } diff --git a/libc/test/src/math/smoke/fmax_test.cpp b/libc/test/src/math/smoke/fmax_test.cpp index 9c81c09..6800939 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 cf337d4..25c6f73 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 636bc42..9ac986c 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 3515f97..5d241519 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 1a76247..1af5b79 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 ce8b705..0791f8c 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 03790e4..ec39e05 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 2b13379..5c3c628 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 a44aefc..4d078ba 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 5d78f94..577eb96 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 4904ccd..e5184cd 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 cecfc0e..d0ab31f 100644 --- a/libc/test/src/math/smoke/generic_sqrt_test.cpp +++ b/libc/test/src/math/smoke/generic_sqrt_test.cpp @@ -10,4 +10,4 @@ #include "src/__support/FPUtil/generic/sqrt.h" -LIST_SQRT_TESTS(double, __llvm_libc::fputil::sqrt<double>) +LIST_SQRT_TESTS(double, LIBC_NAMESPACE::fputil::sqrt<double>) diff --git a/libc/test/src/math/smoke/generic_sqrtf_test.cpp b/libc/test/src/math/smoke/generic_sqrtf_test.cpp index 64bf921..f22ac88 100644 --- a/libc/test/src/math/smoke/generic_sqrtf_test.cpp +++ b/libc/test/src/math/smoke/generic_sqrtf_test.cpp @@ -10,4 +10,4 @@ #include "src/__support/FPUtil/generic/sqrt.h" -LIST_SQRT_TESTS(float, __llvm_libc::fputil::sqrt<float>) +LIST_SQRT_TESTS(float, LIBC_NAMESPACE::fputil::sqrt<float>) diff --git a/libc/test/src/math/smoke/generic_sqrtl_test.cpp b/libc/test/src/math/smoke/generic_sqrtl_test.cpp index 6b68aae..ddc6a23 100644 --- a/libc/test/src/math/smoke/generic_sqrtl_test.cpp +++ b/libc/test/src/math/smoke/generic_sqrtl_test.cpp @@ -10,4 +10,4 @@ #include "src/__support/FPUtil/generic/sqrt.h" -LIST_SQRT_TESTS(long double, __llvm_libc::fputil::sqrt<long double>) +LIST_SQRT_TESTS(long double, LIBC_NAMESPACE::fputil::sqrt<long double>) diff --git a/libc/test/src/math/smoke/hypot_test.cpp b/libc/test/src/math/smoke/hypot_test.cpp index f865b9f..dd12790 100644 --- a/libc/test/src/math/smoke/hypot_test.cpp +++ b/libc/test/src/math/smoke/hypot_test.cpp @@ -13,5 +13,5 @@ using LlvmLibcHypotTest = HypotTestTemplate<double>; TEST_F(LlvmLibcHypotTest, SpecialNumbers) { - test_special_numbers(&__llvm_libc::hypot); + test_special_numbers(&LIBC_NAMESPACE::hypot); } diff --git a/libc/test/src/math/smoke/hypotf_test.cpp b/libc/test/src/math/smoke/hypotf_test.cpp index 0c0ee31..768e7f7 100644 --- a/libc/test/src/math/smoke/hypotf_test.cpp +++ b/libc/test/src/math/smoke/hypotf_test.cpp @@ -13,5 +13,5 @@ using LlvmLibcHypotfTest = HypotTestTemplate<float>; TEST_F(LlvmLibcHypotfTest, SpecialNumbers) { - test_special_numbers(&__llvm_libc::hypotf); + test_special_numbers(&LIBC_NAMESPACE::hypotf); } diff --git a/libc/test/src/math/smoke/ilogb_test.cpp b/libc/test/src/math/smoke/ilogb_test.cpp index a77adec..7011c43 100644 --- a/libc/test/src/math/smoke/ilogb_test.cpp +++ b/libc/test/src/math/smoke/ilogb_test.cpp @@ -16,21 +16,21 @@ #include <math.h> TEST_F(LlvmLibcILogbTest, SpecialNumbers_ilogb) { - test_special_numbers<double>(&__llvm_libc::ilogb); + test_special_numbers<double>(&LIBC_NAMESPACE::ilogb); } TEST_F(LlvmLibcILogbTest, PowersOfTwo_ilogb) { - test_powers_of_two<double>(&__llvm_libc::ilogb); + test_powers_of_two<double>(&LIBC_NAMESPACE::ilogb); } TEST_F(LlvmLibcILogbTest, SomeIntegers_ilogb) { - test_some_integers<double>(&__llvm_libc::ilogb); + test_some_integers<double>(&LIBC_NAMESPACE::ilogb); } TEST_F(LlvmLibcILogbTest, SubnormalRange_ilogb) { - test_subnormal_range<double>(&__llvm_libc::ilogb); + test_subnormal_range<double>(&LIBC_NAMESPACE::ilogb); } TEST_F(LlvmLibcILogbTest, NormalRange_ilogb) { - test_normal_range<double>(&__llvm_libc::ilogb); + test_normal_range<double>(&LIBC_NAMESPACE::ilogb); } diff --git a/libc/test/src/math/smoke/ilogbf_test.cpp b/libc/test/src/math/smoke/ilogbf_test.cpp index 20904a1..dcff8ee 100644 --- a/libc/test/src/math/smoke/ilogbf_test.cpp +++ b/libc/test/src/math/smoke/ilogbf_test.cpp @@ -16,21 +16,21 @@ #include <math.h> TEST_F(LlvmLibcILogbTest, SpecialNumbers_ilogbf) { - test_special_numbers<float>(&__llvm_libc::ilogbf); + test_special_numbers<float>(&LIBC_NAMESPACE::ilogbf); } TEST_F(LlvmLibcILogbTest, PowersOfTwo_ilogbf) { - test_powers_of_two<float>(&__llvm_libc::ilogbf); + test_powers_of_two<float>(&LIBC_NAMESPACE::ilogbf); } TEST_F(LlvmLibcILogbTest, SomeIntegers_ilogbf) { - test_some_integers<float>(&__llvm_libc::ilogbf); + test_some_integers<float>(&LIBC_NAMESPACE::ilogbf); } TEST_F(LlvmLibcILogbTest, SubnormalRange_ilogbf) { - test_subnormal_range<float>(&__llvm_libc::ilogbf); + test_subnormal_range<float>(&LIBC_NAMESPACE::ilogbf); } TEST_F(LlvmLibcILogbTest, NormalRange_ilogbf) { - test_normal_range<float>(&__llvm_libc::ilogbf); + test_normal_range<float>(&LIBC_NAMESPACE::ilogbf); } diff --git a/libc/test/src/math/smoke/ilogbl_test.cpp b/libc/test/src/math/smoke/ilogbl_test.cpp index 9647f23..29a221a 100644 --- a/libc/test/src/math/smoke/ilogbl_test.cpp +++ b/libc/test/src/math/smoke/ilogbl_test.cpp @@ -16,21 +16,21 @@ #include <math.h> TEST_F(LlvmLibcILogbTest, SpecialNumbers_ilogbl) { - test_special_numbers<long double>(&__llvm_libc::ilogbl); + test_special_numbers<long double>(&LIBC_NAMESPACE::ilogbl); } TEST_F(LlvmLibcILogbTest, PowersOfTwo_ilogbl) { - test_powers_of_two<long double>(&__llvm_libc::ilogbl); + test_powers_of_two<long double>(&LIBC_NAMESPACE::ilogbl); } TEST_F(LlvmLibcILogbTest, SomeIntegers_ilogbl) { - test_some_integers<long double>(&__llvm_libc::ilogbl); + test_some_integers<long double>(&LIBC_NAMESPACE::ilogbl); } TEST_F(LlvmLibcILogbTest, SubnormalRange_ilogbl) { - test_subnormal_range<long double>(&__llvm_libc::ilogbl); + test_subnormal_range<long double>(&LIBC_NAMESPACE::ilogbl); } TEST_F(LlvmLibcILogbTest, NormalRange_ilogbl) { - test_normal_range<long double>(&__llvm_libc::ilogbl); + test_normal_range<long double>(&LIBC_NAMESPACE::ilogbl); } diff --git a/libc/test/src/math/smoke/ldexp_test.cpp b/libc/test/src/math/smoke/ldexp_test.cpp index c078aa4..aad580f 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 4fe80fc..f4cce37 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 5e6e6e7..405e533 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 8027004..8cf7d92 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 9ad710e..0d9d3c4 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 948e961..1ceb9fe 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 c86095d..bda2fca6 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 5e36258..a35b5fa 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 8fbc840..e43d49f 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 8a21474..be4900a 100644 --- a/libc/test/src/math/smoke/log10_test.cpp +++ b/libc/test/src/math/smoke/log10_test.cpp @@ -16,21 +16,23 @@ #include <errno.h> #include <stdint.h> -using __llvm_libc::testing::tlog; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(double) TEST(LlvmLibcLog10Test, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::log10(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::log10(inf)); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log10(neg_inf), FE_INVALID); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log10(0.0), FE_DIVBYZERO); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log10(-0.0), FE_DIVBYZERO); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log10(-1.0), FE_INVALID); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log10(1.0)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log10(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log10(inf)); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log10(neg_inf), FE_INVALID); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log10(0.0), + FE_DIVBYZERO); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log10(-0.0), + FE_DIVBYZERO); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log10(-1.0), FE_INVALID); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log10(1.0)); double x = 1.0; for (int i = 0; i < 11; ++i, x *= 10.0) { - EXPECT_FP_EQ_ALL_ROUNDING(static_cast<double>(i), __llvm_libc::log10(x)); + EXPECT_FP_EQ_ALL_ROUNDING(static_cast<double>(i), LIBC_NAMESPACE::log10(x)); } } diff --git a/libc/test/src/math/smoke/log10f_test.cpp b/libc/test/src/math/smoke/log10f_test.cpp index d783814..2369ab0 100644 --- a/libc/test/src/math/smoke/log10f_test.cpp +++ b/libc/test/src/math/smoke/log10f_test.cpp @@ -18,17 +18,18 @@ DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcLog10fTest, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::log10f(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::log10f(inf)); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log10f(neg_inf), FE_INVALID); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log10f(0.0f), FE_DIVBYZERO); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log10f(-0.0f), + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log10f(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log10f(inf)); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log10f(neg_inf), FE_INVALID); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log10f(0.0f), FE_DIVBYZERO); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log10f(-1.0f), FE_INVALID); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log10f(1.0f)); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log10f(-0.0f), + FE_DIVBYZERO); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log10f(-1.0f), FE_INVALID); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log10f(1.0f)); float x = 1.0f; for (int i = 0; i < 11; ++i, x *= 10.0f) { - EXPECT_FP_EQ_ALL_ROUNDING(static_cast<float>(i), __llvm_libc::log10f(x)); + EXPECT_FP_EQ_ALL_ROUNDING(static_cast<float>(i), LIBC_NAMESPACE::log10f(x)); } } diff --git a/libc/test/src/math/smoke/log1p_test.cpp b/libc/test/src/math/smoke/log1p_test.cpp index 14e1977..9cb0cf1 100644 --- a/libc/test/src/math/smoke/log1p_test.cpp +++ b/libc/test/src/math/smoke/log1p_test.cpp @@ -16,16 +16,17 @@ #include <errno.h> #include <stdint.h> -using __llvm_libc::testing::tlog; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(double) TEST(LlvmLibcLog1pTest, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::log1p(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::log1p(inf)); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log1p(neg_inf), FE_INVALID); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log1p(-2.0), FE_INVALID); - EXPECT_FP_EQ(zero, __llvm_libc::log1p(0.0)); - EXPECT_FP_EQ(neg_zero, __llvm_libc::log1p(-0.0)); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log1p(-1.0), FE_DIVBYZERO); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log1p(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log1p(inf)); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log1p(neg_inf), FE_INVALID); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log1p(-2.0), FE_INVALID); + EXPECT_FP_EQ(zero, LIBC_NAMESPACE::log1p(0.0)); + EXPECT_FP_EQ(neg_zero, LIBC_NAMESPACE::log1p(-0.0)); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log1p(-1.0), + FE_DIVBYZERO); } diff --git a/libc/test/src/math/smoke/log1pf_test.cpp b/libc/test/src/math/smoke/log1pf_test.cpp index 22043ba..9836010 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 2726a6b..dab8929 100644 --- a/libc/test/src/math/smoke/log2_test.cpp +++ b/libc/test/src/math/smoke/log2_test.cpp @@ -16,16 +16,17 @@ #include <errno.h> #include <stdint.h> -using __llvm_libc::testing::tlog; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(double) TEST(LlvmLibcLog2Test, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::log2(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::log2(inf)); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log2(neg_inf), FE_INVALID); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log2(0.0), FE_DIVBYZERO); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log2(-0.0), FE_DIVBYZERO); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log2(-1.0), FE_INVALID); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log2(1.0)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log2(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log2(inf)); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log2(neg_inf), FE_INVALID); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log2(0.0), FE_DIVBYZERO); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log2(-0.0), + FE_DIVBYZERO); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log2(-1.0), FE_INVALID); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log2(1.0)); } diff --git a/libc/test/src/math/smoke/log2f_test.cpp b/libc/test/src/math/smoke/log2f_test.cpp index 6b05e6c..d388230a 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 4277123..34d608a 100644 --- a/libc/test/src/math/smoke/log_test.cpp +++ b/libc/test/src/math/smoke/log_test.cpp @@ -16,16 +16,16 @@ #include <errno.h> #include <stdint.h> -using __llvm_libc::testing::tlog; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(double) TEST(LlvmLibcLogTest, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::log(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::log(inf)); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log(neg_inf), FE_INVALID); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log(0.0), FE_DIVBYZERO); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log(-0.0), FE_DIVBYZERO); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log(-1.0), FE_INVALID); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log(1.0)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log(inf)); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log(neg_inf), FE_INVALID); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log(0.0), FE_DIVBYZERO); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log(-0.0), FE_DIVBYZERO); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log(-1.0), FE_INVALID); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log(1.0)); } diff --git a/libc/test/src/math/smoke/logb_test.cpp b/libc/test/src/math/smoke/logb_test.cpp index b903485..2dc56c2 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 727eeff..c25485c 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 1c7b0d4..b26cee6 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 20fa517..0edaa8d 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 0dbfa3d..9cff266 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 407813a..9c696a3 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 a4551c3..e44dd30 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 0ee580f..1fb2fc7 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 7a2aad2..38fe5c7 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 c0ea339..8a29ba9 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 ff89517..b4b03ba 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 440304a..068dbc3 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 c98678b..ae8a726 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 2dde48c..998b19f 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 14234c7..31770bc 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 db85d83..4c8577f 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 8efec39..4358331 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 1af4ba4..590b4ff 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 e4438e8..ae2db44 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 eafa1a7..9c89b7a 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 c15a697..f875bab 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 6c50873..458ca05 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 87ce079..dbcb567 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 0a182dd..053596a 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 32cf724..2a2a213 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 d4d60bf..413a239 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 cbf2e7e..e97781c 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 197887b..b0e0053 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 102a50c..4e2b1c6 100644 --- a/libc/test/src/math/smoke/sincosf_test.cpp +++ b/libc/test/src/math/smoke/sincosf_test.cpp @@ -16,7 +16,7 @@ #include <errno.h> #include <stdint.h> -using FPBits = __llvm_libc::fputil::FPBits<float>; +using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>; DECLARE_SPECIAL_CONSTANTS(float) @@ -24,27 +24,27 @@ TEST(LlvmLibcSinCosfTest, SpecialNumbers) { libc_errno = 0; float sin, cos; - __llvm_libc::sincosf(aNaN, &sin, &cos); + LIBC_NAMESPACE::sincosf(aNaN, &sin, &cos); EXPECT_FP_EQ(aNaN, cos); EXPECT_FP_EQ(aNaN, sin); EXPECT_MATH_ERRNO(0); - __llvm_libc::sincosf(0.0f, &sin, &cos); + LIBC_NAMESPACE::sincosf(0.0f, &sin, &cos); EXPECT_FP_EQ(1.0f, cos); EXPECT_FP_EQ(0.0f, sin); EXPECT_MATH_ERRNO(0); - __llvm_libc::sincosf(-0.0f, &sin, &cos); + LIBC_NAMESPACE::sincosf(-0.0f, &sin, &cos); EXPECT_FP_EQ(1.0f, cos); EXPECT_FP_EQ(-0.0f, sin); EXPECT_MATH_ERRNO(0); - __llvm_libc::sincosf(inf, &sin, &cos); + LIBC_NAMESPACE::sincosf(inf, &sin, &cos); EXPECT_FP_EQ(aNaN, cos); EXPECT_FP_EQ(aNaN, sin); EXPECT_MATH_ERRNO(EDOM); - __llvm_libc::sincosf(neg_inf, &sin, &cos); + LIBC_NAMESPACE::sincosf(neg_inf, &sin, &cos); EXPECT_FP_EQ(aNaN, cos); EXPECT_FP_EQ(aNaN, sin); EXPECT_MATH_ERRNO(EDOM); diff --git a/libc/test/src/math/smoke/sinf_test.cpp b/libc/test/src/math/smoke/sinf_test.cpp index e67062d..b93011b 100644 --- a/libc/test/src/math/smoke/sinf_test.cpp +++ b/libc/test/src/math/smoke/sinf_test.cpp @@ -16,25 +16,25 @@ #include <errno.h> #include <stdint.h> -using FPBits = __llvm_libc::fputil::FPBits<float>; +using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcSinfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ(aNaN, __llvm_libc::sinf(aNaN)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(0.0f, __llvm_libc::sinf(0.0f)); + EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::sinf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(-0.0f, __llvm_libc::sinf(-0.0f)); + EXPECT_FP_EQ(-0.0f, LIBC_NAMESPACE::sinf(-0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(aNaN, __llvm_libc::sinf(inf)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinf(inf)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ(aNaN, __llvm_libc::sinf(neg_inf)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinf(neg_inf)); EXPECT_MATH_ERRNO(EDOM); } diff --git a/libc/test/src/math/smoke/sinhf_test.cpp b/libc/test/src/math/smoke/sinhf_test.cpp index 5926ea6..b2b6bdd 100644 --- a/libc/test/src/math/smoke/sinhf_test.cpp +++ b/libc/test/src/math/smoke/sinhf_test.cpp @@ -17,51 +17,51 @@ #include <errno.h> #include <stdint.h> -using FPBits = __llvm_libc::fputil::FPBits<float>; +using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcSinhfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ(aNaN, __llvm_libc::sinhf(aNaN)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinhf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(0.0f, __llvm_libc::sinhf(0.0f)); + EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::sinhf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(-0.0f, __llvm_libc::sinhf(-0.0f)); + EXPECT_FP_EQ(-0.0f, LIBC_NAMESPACE::sinhf(-0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(inf, __llvm_libc::sinhf(inf)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::sinhf(inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(neg_inf, __llvm_libc::sinhf(neg_inf)); + EXPECT_FP_EQ(neg_inf, LIBC_NAMESPACE::sinhf(neg_inf)); EXPECT_MATH_ERRNO(0); } // For small values, sinh(x) is x. TEST(LlvmLibcSinhfTest, SmallValues) { float x = float(FPBits(uint32_t(0x17800000))); - float result = __llvm_libc::sinhf(x); + float result = LIBC_NAMESPACE::sinhf(x); EXPECT_FP_EQ(x, result); x = float(FPBits(uint32_t(0x00400000))); - result = __llvm_libc::sinhf(x); + result = LIBC_NAMESPACE::sinhf(x); EXPECT_FP_EQ(x, result); } TEST(LlvmLibcSinhfTest, Overflow) { libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::sinhf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::sinhf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::sinhf(float(FPBits(0x42cffff8U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::sinhf(float(FPBits(0x42cffff8U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::sinhf(float(FPBits(0x42d00008U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::sinhf(float(FPBits(0x42d00008U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); } diff --git a/libc/test/src/math/smoke/sqrt_test.cpp b/libc/test/src/math/smoke/sqrt_test.cpp index 2372648..1551b31 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 c7681d0..3f2e973 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 c48ebb0..f80bcfb 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 62cc42c..60444b3 100644 --- a/libc/test/src/math/smoke/tanf_test.cpp +++ b/libc/test/src/math/smoke/tanf_test.cpp @@ -16,25 +16,25 @@ #include <errno.h> #include <stdint.h> -using FPBits = __llvm_libc::fputil::FPBits<float>; +using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcTanfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ(aNaN, __llvm_libc::tanf(aNaN)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::tanf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(0.0f, __llvm_libc::tanf(0.0f)); + EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::tanf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(-0.0f, __llvm_libc::tanf(-0.0f)); + EXPECT_FP_EQ(-0.0f, LIBC_NAMESPACE::tanf(-0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(aNaN, __llvm_libc::tanf(inf)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::tanf(inf)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ(aNaN, __llvm_libc::tanf(neg_inf)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::tanf(neg_inf)); EXPECT_MATH_ERRNO(EDOM); } diff --git a/libc/test/src/math/smoke/tanhf_test.cpp b/libc/test/src/math/smoke/tanhf_test.cpp index 0152de2..db20be7 100644 --- a/libc/test/src/math/smoke/tanhf_test.cpp +++ b/libc/test/src/math/smoke/tanhf_test.cpp @@ -16,25 +16,25 @@ #include <errno.h> #include <stdint.h> -using FPBits = __llvm_libc::fputil::FPBits<float>; +using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcTanhfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ(aNaN, __llvm_libc::tanhf(aNaN)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::tanhf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(0.0f, __llvm_libc::tanhf(0.0f)); + EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::tanhf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(-0.0f, __llvm_libc::tanhf(-0.0f)); + EXPECT_FP_EQ(-0.0f, LIBC_NAMESPACE::tanhf(-0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(1.0f, __llvm_libc::tanhf(inf)); + EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::tanhf(inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(-1.0f, __llvm_libc::tanhf(neg_inf)); + EXPECT_FP_EQ(-1.0f, LIBC_NAMESPACE::tanhf(neg_inf)); EXPECT_MATH_ERRNO(0); } diff --git a/libc/test/src/math/smoke/trunc_test.cpp b/libc/test/src/math/smoke/trunc_test.cpp index f0a808d..eb71f23 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 cbd672c..9a85b82 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 0cf9ab8..d296bfe 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 2372648..1551b31 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 c7681d0..3f2e973 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 c48ebb0..f80bcfb 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 b22d49e..a6f7dcb 100644 --- a/libc/test/src/math/tan_test.cpp +++ b/libc/test/src/math/tan_test.cpp @@ -13,7 +13,7 @@ #include <math.h> -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(double) @@ -27,6 +27,6 @@ TEST(LlvmLibctanTest, Range) { if (isnan(x) || isinf(x) || x > _2pi || x < -_2pi) continue; - ASSERT_MPFR_MATCH(mpfr::Operation::Tan, x, __llvm_libc::tan(x), 1.0); + ASSERT_MPFR_MATCH(mpfr::Operation::Tan, x, LIBC_NAMESPACE::tan(x), 1.0); } } diff --git a/libc/test/src/math/tanf_test.cpp b/libc/test/src/math/tanf_test.cpp index 37a1bba..3c3694a 100644 --- a/libc/test/src/math/tanf_test.cpp +++ b/libc/test/src/math/tanf_test.cpp @@ -18,29 +18,29 @@ #include <errno.h> #include <stdint.h> -using __llvm_libc::testing::SDCOMP26094_VALUES; -using FPBits = __llvm_libc::fputil::FPBits<float>; +using LIBC_NAMESPACE::testing::SDCOMP26094_VALUES; +using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>; -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcTanfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ(aNaN, __llvm_libc::tanf(aNaN)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::tanf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(0.0f, __llvm_libc::tanf(0.0f)); + EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::tanf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(-0.0f, __llvm_libc::tanf(-0.0f)); + EXPECT_FP_EQ(-0.0f, LIBC_NAMESPACE::tanf(-0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(aNaN, __llvm_libc::tanf(inf)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::tanf(inf)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ(aNaN, __llvm_libc::tanf(neg_inf)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::tanf(neg_inf)); EXPECT_MATH_ERRNO(EDOM); } @@ -52,7 +52,7 @@ TEST(LlvmLibcTanfTest, InFloatRange) { if (isnan(x) || isinf(x)) continue; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Tan, x, - __llvm_libc::tanf(x), 0.5); + LIBC_NAMESPACE::tanf(x), 0.5); } } @@ -118,9 +118,9 @@ TEST(LlvmLibcTanfTest, SpecificBitPatterns) { for (int i = 0; i < N; ++i) { float x = float(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Tan, x, - __llvm_libc::tanf(x), 0.5); + LIBC_NAMESPACE::tanf(x), 0.5); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Tan, -x, - __llvm_libc::tanf(-x), 0.5); + LIBC_NAMESPACE::tanf(-x), 0.5); } } @@ -129,6 +129,6 @@ TEST(LlvmLibcTanfTest, SpecificBitPatterns) { TEST(LlvmLibcTanfTest, SDCOMP_26094) { for (uint32_t v : SDCOMP26094_VALUES) { float x = float(FPBits(v)); - ASSERT_MPFR_MATCH(mpfr::Operation::Tan, x, __llvm_libc::tanf(x), 0.5); + ASSERT_MPFR_MATCH(mpfr::Operation::Tan, x, LIBC_NAMESPACE::tanf(x), 0.5); } } diff --git a/libc/test/src/math/tanhf_test.cpp b/libc/test/src/math/tanhf_test.cpp index 07afe14..06ad02c 100644 --- a/libc/test/src/math/tanhf_test.cpp +++ b/libc/test/src/math/tanhf_test.cpp @@ -17,28 +17,28 @@ #include <errno.h> #include <stdint.h> -using FPBits = __llvm_libc::fputil::FPBits<float>; +using FPBits = LIBC_NAMESPACE::fputil::FPBits<float>; -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcTanhfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ(aNaN, __llvm_libc::tanhf(aNaN)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::tanhf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(0.0f, __llvm_libc::tanhf(0.0f)); + EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::tanhf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(-0.0f, __llvm_libc::tanhf(-0.0f)); + EXPECT_FP_EQ(-0.0f, LIBC_NAMESPACE::tanhf(-0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(1.0f, __llvm_libc::tanhf(inf)); + EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::tanhf(inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(-1.0f, __llvm_libc::tanhf(neg_inf)); + EXPECT_FP_EQ(-1.0f, LIBC_NAMESPACE::tanhf(neg_inf)); EXPECT_MATH_ERRNO(0); } @@ -50,7 +50,7 @@ TEST(LlvmLibcTanhfTest, InFloatRange) { if (isnan(x) || isinf(x)) continue; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Tanh, x, - __llvm_libc::tanhf(x), 0.5); + LIBC_NAMESPACE::tanhf(x), 0.5); } } @@ -66,8 +66,8 @@ TEST(LlvmLibcTanhfTest, ExceptionalValues) { for (int i = 0; i < N; ++i) { float x = float(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Tanh, x, - __llvm_libc::tanhf(x), 0.5); + LIBC_NAMESPACE::tanhf(x), 0.5); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Tanh, -x, - __llvm_libc::tanhf(-x), 0.5); + LIBC_NAMESPACE::tanhf(-x), 0.5); } } diff --git a/libc/test/src/math/trunc_test.cpp b/libc/test/src/math/trunc_test.cpp index f0a808d..eb71f23 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 cbd672c..9a85b82 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 0cf9ab8..d296bfe 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 a8363d2..d3b930d0 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 f9bd77b..d38fab8 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 bc52a97..b06f8e1 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 f10c246..654a396 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 af9f5d0..1af585a 100644 --- a/libc/test/src/pthread/pthread_attr_test.cpp +++ b/libc/test/src/pthread/pthread_attr_test.cpp @@ -25,89 +25,95 @@ TEST(LlvmLibcPThreadAttrTest, InitAndDestroy) { pthread_attr_t attr; - ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0); int detachstate; - ASSERT_EQ(__llvm_libc::pthread_attr_getdetachstate(&attr, &detachstate), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_getdetachstate(&attr, &detachstate), + 0); ASSERT_EQ(detachstate, int(PTHREAD_CREATE_JOINABLE)); size_t guardsize; - ASSERT_EQ(__llvm_libc::pthread_attr_getguardsize(&attr, &guardsize), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_getguardsize(&attr, &guardsize), 0); ASSERT_EQ(guardsize, size_t(EXEC_PAGESIZE)); - ASSERT_EQ(__llvm_libc::pthread_attr_destroy(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_destroy(&attr), 0); } TEST(LlvmLibcPThreadattrTest, SetAndGetDetachState) { pthread_attr_t attr; - ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0); int detachstate; - __llvm_libc::pthread_attr_getdetachstate(&attr, &detachstate); + LIBC_NAMESPACE::pthread_attr_getdetachstate(&attr, &detachstate); ASSERT_EQ(detachstate, int(PTHREAD_CREATE_JOINABLE)); - ASSERT_EQ( - __llvm_libc::pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED), - 0); - ASSERT_EQ(__llvm_libc::pthread_attr_getdetachstate(&attr, &detachstate), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setdetachstate( + &attr, PTHREAD_CREATE_DETACHED), + 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_getdetachstate(&attr, &detachstate), + 0); ASSERT_EQ(detachstate, int(PTHREAD_CREATE_DETACHED)); - ASSERT_EQ(__llvm_libc::pthread_attr_setdetachstate(&attr, 0xBAD), EINVAL); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setdetachstate(&attr, 0xBAD), EINVAL); - ASSERT_EQ(__llvm_libc::pthread_attr_destroy(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_destroy(&attr), 0); } TEST(LlvmLibcPThreadattrTest, SetAndGetGuardSize) { pthread_attr_t attr; - ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0); size_t guardsize; - ASSERT_EQ(__llvm_libc::pthread_attr_getguardsize(&attr, &guardsize), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_getguardsize(&attr, &guardsize), 0); ASSERT_EQ(guardsize, size_t(EXEC_PAGESIZE)); - ASSERT_EQ(__llvm_libc::pthread_attr_setguardsize(&attr, 2 * EXEC_PAGESIZE), + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setguardsize(&attr, 2 * EXEC_PAGESIZE), 0); - ASSERT_EQ(__llvm_libc::pthread_attr_getguardsize(&attr, &guardsize), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_getguardsize(&attr, &guardsize), 0); ASSERT_EQ(guardsize, size_t(2 * EXEC_PAGESIZE)); - ASSERT_EQ(__llvm_libc::pthread_attr_setguardsize(&attr, EXEC_PAGESIZE / 2), + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setguardsize(&attr, EXEC_PAGESIZE / 2), EINVAL); - ASSERT_EQ(__llvm_libc::pthread_attr_destroy(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_destroy(&attr), 0); } TEST(LlvmLibcPThreadattrTest, SetAndGetStackSize) { pthread_attr_t attr; - ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0); size_t stacksize; ASSERT_EQ( - __llvm_libc::pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN << 2), 0); - ASSERT_EQ(__llvm_libc::pthread_attr_getstacksize(&attr, &stacksize), 0); + LIBC_NAMESPACE::pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN << 2), + 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_getstacksize(&attr, &stacksize), 0); ASSERT_EQ(stacksize, size_t(PTHREAD_STACK_MIN << 2)); ASSERT_EQ( - __llvm_libc::pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN / 2), + LIBC_NAMESPACE::pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN / 2), EINVAL); - ASSERT_EQ(__llvm_libc::pthread_attr_destroy(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_destroy(&attr), 0); } TEST(LlvmLibcPThreadattrTest, SetAndGetStack) { pthread_attr_t attr; - ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0); void *stack; size_t stacksize; ASSERT_EQ( - __llvm_libc::pthread_attr_setstack(&attr, 0, PTHREAD_STACK_MIN << 2), 0); - ASSERT_EQ(__llvm_libc::pthread_attr_getstack(&attr, &stack, &stacksize), 0); + LIBC_NAMESPACE::pthread_attr_setstack(&attr, 0, PTHREAD_STACK_MIN << 2), + 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_getstack(&attr, &stack, &stacksize), + 0); ASSERT_EQ(stacksize, size_t(PTHREAD_STACK_MIN << 2)); ASSERT_EQ(reinterpret_cast<uintptr_t>(stack), uintptr_t(0)); - ASSERT_EQ(__llvm_libc::pthread_attr_setstack( + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setstack( &attr, reinterpret_cast<void *>(1), PTHREAD_STACK_MIN << 2), EINVAL); - ASSERT_EQ(__llvm_libc::pthread_attr_setstack(&attr, 0, PTHREAD_STACK_MIN / 2), - EINVAL); + ASSERT_EQ( + LIBC_NAMESPACE::pthread_attr_setstack(&attr, 0, PTHREAD_STACK_MIN / 2), + EINVAL); - ASSERT_EQ(__llvm_libc::pthread_attr_destroy(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_destroy(&attr), 0); } diff --git a/libc/test/src/pthread/pthread_mutexattr_test.cpp b/libc/test/src/pthread/pthread_mutexattr_test.cpp index 3ecbc4f..a7acd58 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 ca2821b..38433ed 100644 --- a/libc/test/src/sched/affinity_test.cpp +++ b/libc/test/src/sched/affinity_test.cpp @@ -18,27 +18,29 @@ TEST(LlvmLibcSchedAffinityTest, SmokeTest) { cpu_set_t mask; libc_errno = 0; - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; - pid_t tid = __llvm_libc::syscall_impl<pid_t>(SYS_gettid); + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; + pid_t tid = LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_gettid); ASSERT_GT(tid, pid_t(0)); // We just get and set the same mask. - ASSERT_THAT(__llvm_libc::sched_getaffinity(tid, sizeof(cpu_set_t), &mask), + ASSERT_THAT(LIBC_NAMESPACE::sched_getaffinity(tid, sizeof(cpu_set_t), &mask), Succeeds(0)); - ASSERT_THAT(__llvm_libc::sched_setaffinity(tid, sizeof(cpu_set_t), &mask), + ASSERT_THAT(LIBC_NAMESPACE::sched_setaffinity(tid, sizeof(cpu_set_t), &mask), Succeeds(0)); } TEST(LlvmLibcSchedAffinityTest, BadMask) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - pid_t tid = __llvm_libc::syscall_impl<pid_t>(SYS_gettid); + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + pid_t tid = LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_gettid); libc_errno = 0; - ASSERT_THAT(__llvm_libc::sched_getaffinity(tid, sizeof(cpu_set_t), nullptr), - Fails(EFAULT)); + ASSERT_THAT( + LIBC_NAMESPACE::sched_getaffinity(tid, sizeof(cpu_set_t), nullptr), + Fails(EFAULT)); libc_errno = 0; - ASSERT_THAT(__llvm_libc::sched_setaffinity(tid, sizeof(cpu_set_t), nullptr), - Fails(EFAULT)); + ASSERT_THAT( + LIBC_NAMESPACE::sched_setaffinity(tid, sizeof(cpu_set_t), nullptr), + Fails(EFAULT)); libc_errno = 0; } diff --git a/libc/test/src/sched/cpu_count_test.cpp b/libc/test/src/sched/cpu_count_test.cpp index 4c04777..ca3e808 100644 --- a/libc/test/src/sched/cpu_count_test.cpp +++ b/libc/test/src/sched/cpu_count_test.cpp @@ -18,15 +18,15 @@ TEST(LlvmLibcSchedCpuCountTest, SmokeTest) { cpu_set_t mask; libc_errno = 0; - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; - pid_t tid = __llvm_libc::syscall_impl<pid_t>(SYS_gettid); + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; + pid_t tid = LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_gettid); ASSERT_GT(tid, pid_t(0)); - ASSERT_THAT(__llvm_libc::sched_getaffinity(tid, sizeof(cpu_set_t), &mask), + ASSERT_THAT(LIBC_NAMESPACE::sched_getaffinity(tid, sizeof(cpu_set_t), &mask), Succeeds(0)); // CPU_COUNT is a macro, but it expands to an LLVM-libc internal function that // needs to be in the appropriate namespace for the test. - int num_cpus = __llvm_libc::CPU_COUNT(&mask); + int num_cpus = LIBC_NAMESPACE::CPU_COUNT(&mask); ASSERT_GT(num_cpus, 0); ASSERT_LE(num_cpus, int(sizeof(cpu_set_t) * sizeof(unsigned long))); } diff --git a/libc/test/src/sched/get_priority_test.cpp b/libc/test/src/sched/get_priority_test.cpp index 15ee958..3a79a67 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 2c57454..8c6485f 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 @@ public: // 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 @@ public: 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 160ccd5..1001000 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 ffa7f66..45b7a7d 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 3a8e22a..9e5f74a 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 ea98724d..2033543 100644 --- a/libc/test/src/signal/kill_test.cpp +++ b/libc/test/src/signal/kill_test.cpp @@ -15,16 +15,16 @@ #include <signal.h> #include <sys/syscall.h> // For syscall numbers. -using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; TEST(LlvmLibcKillTest, TargetSelf) { - pid_t parent_pid = __llvm_libc::syscall_impl<pid_t>(SYS_getpid); - ASSERT_THAT(__llvm_libc::kill(parent_pid, 0), Succeeds(0)); + pid_t parent_pid = LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_getpid); + ASSERT_THAT(LIBC_NAMESPACE::kill(parent_pid, 0), Succeeds(0)); EXPECT_DEATH( [] { - pid_t child_pid = __llvm_libc::syscall_impl<pid_t>(SYS_getpid); - __llvm_libc::kill(child_pid, SIGKILL); + pid_t child_pid = LIBC_NAMESPACE::syscall_impl<pid_t>(SYS_getpid); + LIBC_NAMESPACE::kill(child_pid, SIGKILL); }, WITH_SIGNAL(SIGKILL)); } diff --git a/libc/test/src/signal/raise_test.cpp b/libc/test/src/signal/raise_test.cpp index 080541f..a114ac5 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 36160f9..262469c 100644 --- a/libc/test/src/signal/sigaction_test.cpp +++ b/libc/test/src/signal/sigaction_test.cpp @@ -15,19 +15,20 @@ #include <errno.h> #include <signal.h> -using __llvm_libc::testing::ErrnoSetterMatcher::Fails; -using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; TEST(LlvmLibcSigaction, Invalid) { // -1 is a much larger signal that NSIG, so this should fail. - EXPECT_THAT(__llvm_libc::sigaction(-1, nullptr, nullptr), Fails(EINVAL)); + EXPECT_THAT(LIBC_NAMESPACE::sigaction(-1, nullptr, nullptr), Fails(EINVAL)); } // SIGKILL cannot have its action changed, but it can be examined. TEST(LlvmLibcSigaction, Sigkill) { struct sigaction action; - EXPECT_THAT(__llvm_libc::sigaction(SIGKILL, nullptr, &action), Succeeds()); - EXPECT_THAT(__llvm_libc::sigaction(SIGKILL, &action, nullptr), Fails(EINVAL)); + EXPECT_THAT(LIBC_NAMESPACE::sigaction(SIGKILL, nullptr, &action), Succeeds()); + EXPECT_THAT(LIBC_NAMESPACE::sigaction(SIGKILL, &action, nullptr), + Fails(EINVAL)); } static int sigusr1Count; @@ -38,29 +39,29 @@ TEST(LlvmLibcSigaction, CustomAction) { sigusr1Count = 0; struct sigaction action; - EXPECT_THAT(__llvm_libc::sigaction(SIGUSR1, nullptr, &action), Succeeds()); + EXPECT_THAT(LIBC_NAMESPACE::sigaction(SIGUSR1, nullptr, &action), Succeeds()); action.sa_handler = +[](int signal) { correctSignal = signal == SIGUSR1; sigusr1Count++; }; - EXPECT_THAT(__llvm_libc::sigaction(SIGUSR1, &action, nullptr), Succeeds()); + EXPECT_THAT(LIBC_NAMESPACE::sigaction(SIGUSR1, &action, nullptr), Succeeds()); - __llvm_libc::raise(SIGUSR1); + LIBC_NAMESPACE::raise(SIGUSR1); EXPECT_EQ(sigusr1Count, 1); EXPECT_TRUE(correctSignal); action.sa_handler = SIG_DFL; - EXPECT_THAT(__llvm_libc::sigaction(SIGUSR1, &action, nullptr), Succeeds()); + EXPECT_THAT(LIBC_NAMESPACE::sigaction(SIGUSR1, &action, nullptr), Succeeds()); - EXPECT_DEATH([] { __llvm_libc::raise(SIGUSR1); }, WITH_SIGNAL(SIGUSR1)); + EXPECT_DEATH([] { LIBC_NAMESPACE::raise(SIGUSR1); }, WITH_SIGNAL(SIGUSR1)); } TEST(LlvmLibcSigaction, Ignore) { struct sigaction action; - EXPECT_THAT(__llvm_libc::sigaction(SIGUSR1, nullptr, &action), Succeeds()); + EXPECT_THAT(LIBC_NAMESPACE::sigaction(SIGUSR1, nullptr, &action), Succeeds()); action.sa_handler = SIG_IGN; - EXPECT_THAT(__llvm_libc::sigaction(SIGUSR1, &action, nullptr), Succeeds()); + EXPECT_THAT(LIBC_NAMESPACE::sigaction(SIGUSR1, &action, nullptr), Succeeds()); - EXPECT_EXITS([] { __llvm_libc::raise(SIGUSR1); }, 0); + EXPECT_EXITS([] { LIBC_NAMESPACE::raise(SIGUSR1); }, 0); } diff --git a/libc/test/src/signal/sigaddset_test.cpp b/libc/test/src/signal/sigaddset_test.cpp index dbc0a61..ac9334f 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 e52b3db..5e1a3a4 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 80f2459..aeae66f 100644 --- a/libc/test/src/signal/sigdelset_test.cpp +++ b/libc/test/src/signal/sigdelset_test.cpp @@ -18,20 +18,21 @@ #include <signal.h> TEST(LlvmLibcSigdelset, Invalid) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; // Invalid set. - EXPECT_THAT(__llvm_libc::sigdelset(nullptr, SIGUSR1), Fails(EINVAL)); + EXPECT_THAT(LIBC_NAMESPACE::sigdelset(nullptr, SIGUSR1), Fails(EINVAL)); sigset_t set; // Valid set, invalid signum. - EXPECT_THAT(__llvm_libc::sigdelset(&set, -1), Fails(EINVAL)); + EXPECT_THAT(LIBC_NAMESPACE::sigdelset(&set, -1), Fails(EINVAL)); } TEST(LlvmLibcSigdelset, UnblockOne) { - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; sigset_t set; - EXPECT_THAT(__llvm_libc::sigfillset(&set), Succeeds()); - EXPECT_THAT(__llvm_libc::sigdelset(&set, SIGUSR1), Succeeds()); - EXPECT_THAT(__llvm_libc::sigprocmask(SIG_SETMASK, &set, nullptr), Succeeds()); - EXPECT_DEATH([] { __llvm_libc::raise(SIGUSR1); }, WITH_SIGNAL(SIGUSR1)); + EXPECT_THAT(LIBC_NAMESPACE::sigfillset(&set), Succeeds()); + EXPECT_THAT(LIBC_NAMESPACE::sigdelset(&set, SIGUSR1), Succeeds()); + EXPECT_THAT(LIBC_NAMESPACE::sigprocmask(SIG_SETMASK, &set, nullptr), + Succeeds()); + EXPECT_DEATH([] { LIBC_NAMESPACE::raise(SIGUSR1); }, WITH_SIGNAL(SIGUSR1)); } diff --git a/libc/test/src/signal/sigfillset_test.cpp b/libc/test/src/signal/sigfillset_test.cpp index 52f1e27..7922b3a4 100644 --- a/libc/test/src/signal/sigfillset_test.cpp +++ b/libc/test/src/signal/sigfillset_test.cpp @@ -17,14 +17,15 @@ #include <signal.h> TEST(LlvmLibcSigfillset, Invalid) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - EXPECT_THAT(__llvm_libc::sigfillset(nullptr), Fails(EINVAL)); + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + EXPECT_THAT(LIBC_NAMESPACE::sigfillset(nullptr), Fails(EINVAL)); } TEST(LlvmLibcSigfillset, BlocksAll) { - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; sigset_t set; - EXPECT_THAT(__llvm_libc::sigfillset(&set), Succeeds()); - EXPECT_THAT(__llvm_libc::sigprocmask(SIG_SETMASK, &set, nullptr), Succeeds()); - EXPECT_EXITS([] { __llvm_libc::raise(SIGUSR1); }, 0); + EXPECT_THAT(LIBC_NAMESPACE::sigfillset(&set), Succeeds()); + EXPECT_THAT(LIBC_NAMESPACE::sigprocmask(SIG_SETMASK, &set, nullptr), + Succeeds()); + EXPECT_EXITS([] { LIBC_NAMESPACE::raise(SIGUSR1); }, 0); } diff --git a/libc/test/src/signal/signal_test.cpp b/libc/test/src/signal/signal_test.cpp index 999933c..78f8bfb 100644 --- a/libc/test/src/signal/signal_test.cpp +++ b/libc/test/src/signal/signal_test.cpp @@ -15,15 +15,15 @@ #include <signal.h> -using __llvm_libc::testing::ErrnoSetterMatcher::Fails; -using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; TEST(LlvmLibcSignal, Invalid) { libc_errno = 0; - __llvm_libc::sighandler_t valid = +[](int) {}; - EXPECT_THAT((void *)__llvm_libc::signal(0, valid), + LIBC_NAMESPACE::sighandler_t valid = +[](int) {}; + EXPECT_THAT((void *)LIBC_NAMESPACE::signal(0, valid), Fails(EINVAL, (void *)SIG_ERR)); - EXPECT_THAT((void *)__llvm_libc::signal(65, valid), + EXPECT_THAT((void *)LIBC_NAMESPACE::signal(65, valid), Fails(EINVAL, (void *)SIG_ERR)); } @@ -31,11 +31,12 @@ static int sum; TEST(LlvmLibcSignal, Basic) { // In case test get run multiple times. sum = 0; - ASSERT_NE(__llvm_libc::signal(SIGUSR1, +[](int) { sum++; }), + ASSERT_NE(LIBC_NAMESPACE::signal( + SIGUSR1, +[](int) { sum++; }), SIG_ERR); - ASSERT_THAT(__llvm_libc::raise(SIGUSR1), Succeeds()); + ASSERT_THAT(LIBC_NAMESPACE::raise(SIGUSR1), Succeeds()); EXPECT_EQ(sum, 1); for (int i = 0; i < 10; i++) - ASSERT_THAT(__llvm_libc::raise(SIGUSR1), Succeeds()); + ASSERT_THAT(LIBC_NAMESPACE::raise(SIGUSR1), Succeeds()); EXPECT_EQ(sum, 11); } diff --git a/libc/test/src/signal/sigprocmask_test.cpp b/libc/test/src/signal/sigprocmask_test.cpp index 3c33464..3e7e3a5 100644 --- a/libc/test/src/signal/sigprocmask_test.cpp +++ b/libc/test/src/signal/sigprocmask_test.cpp @@ -17,19 +17,19 @@ #include <signal.h> -class LlvmLibcSignalTest : public __llvm_libc::testing::Test { +class LlvmLibcSignalTest : public LIBC_NAMESPACE::testing::Test { sigset_t oldSet; public: - void SetUp() override { __llvm_libc::sigprocmask(0, nullptr, &oldSet); } + void SetUp() override { LIBC_NAMESPACE::sigprocmask(0, nullptr, &oldSet); } void TearDown() override { - __llvm_libc::sigprocmask(SIG_SETMASK, &oldSet, nullptr); + LIBC_NAMESPACE::sigprocmask(SIG_SETMASK, &oldSet, nullptr); } }; -using __llvm_libc::testing::ErrnoSetterMatcher::Fails; -using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; // This tests for invalid input. TEST_F(LlvmLibcSignalTest, SigprocmaskInvalid) { @@ -37,24 +37,24 @@ TEST_F(LlvmLibcSignalTest, SigprocmaskInvalid) { sigset_t valid; // 17 and -4 are out of the range for sigprocmask's how paramater. - EXPECT_THAT(__llvm_libc::sigprocmask(17, &valid, nullptr), Fails(EINVAL)); - EXPECT_THAT(__llvm_libc::sigprocmask(-4, &valid, nullptr), Fails(EINVAL)); + EXPECT_THAT(LIBC_NAMESPACE::sigprocmask(17, &valid, nullptr), Fails(EINVAL)); + EXPECT_THAT(LIBC_NAMESPACE::sigprocmask(-4, &valid, nullptr), Fails(EINVAL)); // This pointer is out of this processes address range. sigset_t *invalid = reinterpret_cast<sigset_t *>(-1); - EXPECT_THAT(__llvm_libc::sigprocmask(SIG_SETMASK, invalid, nullptr), + EXPECT_THAT(LIBC_NAMESPACE::sigprocmask(SIG_SETMASK, invalid, nullptr), Fails(EFAULT)); - EXPECT_THAT(__llvm_libc::sigprocmask(-4, nullptr, invalid), Fails(EFAULT)); + EXPECT_THAT(LIBC_NAMESPACE::sigprocmask(-4, nullptr, invalid), Fails(EFAULT)); } // This tests that when nothing is blocked, a process gets killed and alse tests // that when signals are blocked they are not delivered to the process. TEST_F(LlvmLibcSignalTest, BlockUnblock) { sigset_t sigset; - EXPECT_EQ(__llvm_libc::sigemptyset(&sigset), 0); - EXPECT_EQ(__llvm_libc::sigprocmask(SIG_SETMASK, &sigset, nullptr), 0); - EXPECT_DEATH([] { __llvm_libc::raise(SIGUSR1); }, WITH_SIGNAL(SIGUSR1)); - EXPECT_EQ(__llvm_libc::sigaddset(&sigset, SIGUSR1), 0); - EXPECT_EQ(__llvm_libc::sigprocmask(SIG_SETMASK, &sigset, nullptr), 0); - EXPECT_EXITS([] { __llvm_libc::raise(SIGUSR1); }, 0); + EXPECT_EQ(LIBC_NAMESPACE::sigemptyset(&sigset), 0); + EXPECT_EQ(LIBC_NAMESPACE::sigprocmask(SIG_SETMASK, &sigset, nullptr), 0); + EXPECT_DEATH([] { LIBC_NAMESPACE::raise(SIGUSR1); }, WITH_SIGNAL(SIGUSR1)); + EXPECT_EQ(LIBC_NAMESPACE::sigaddset(&sigset, SIGUSR1), 0); + EXPECT_EQ(LIBC_NAMESPACE::sigprocmask(SIG_SETMASK, &sigset, nullptr), 0); + EXPECT_EXITS([] { LIBC_NAMESPACE::raise(SIGUSR1); }, 0); } diff --git a/libc/test/src/spawn/posix_spawn_file_actions_test.cpp b/libc/test/src/spawn/posix_spawn_file_actions_test.cpp index abd2d78..a343710 100644 --- a/libc/test/src/spawn/posix_spawn_file_actions_test.cpp +++ b/libc/test/src/spawn/posix_spawn_file_actions_test.cpp @@ -20,56 +20,58 @@ TEST(LlvmLibcPosixSpawnFileActionsTest, AddActions) { posix_spawn_file_actions_t actions; - ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_init(&actions), 0); + ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_init(&actions), 0); ASSERT_EQ(uintptr_t(actions.__front), uintptr_t(nullptr)); ASSERT_EQ(uintptr_t(actions.__back), uintptr_t(nullptr)); - ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_addclose(&actions, 10), 0); + ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_addclose(&actions, 10), 0); ASSERT_NE(uintptr_t(actions.__front), uintptr_t(nullptr)); ASSERT_NE(uintptr_t(actions.__back), uintptr_t(nullptr)); - ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_adddup2(&actions, 11, 12), 0); - ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_addopen(&actions, 13, - "path/to/file", 0, 0), + ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_adddup2(&actions, 11, 12), + 0); + ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_addopen( + &actions, 13, "path/to/file", 0, 0), 0); - __llvm_libc::BaseSpawnFileAction *act = - reinterpret_cast<__llvm_libc::BaseSpawnFileAction *>(actions.__front); + LIBC_NAMESPACE::BaseSpawnFileAction *act = + reinterpret_cast<LIBC_NAMESPACE::BaseSpawnFileAction *>(actions.__front); int action_count = 0; while (act != nullptr) { ++action_count; if (action_count == 1) - ASSERT_EQ(act->type, __llvm_libc::BaseSpawnFileAction::CLOSE); + ASSERT_EQ(act->type, LIBC_NAMESPACE::BaseSpawnFileAction::CLOSE); if (action_count == 2) - ASSERT_EQ(act->type, __llvm_libc::BaseSpawnFileAction::DUP2); + ASSERT_EQ(act->type, LIBC_NAMESPACE::BaseSpawnFileAction::DUP2); if (action_count == 3) - ASSERT_EQ(act->type, __llvm_libc::BaseSpawnFileAction::OPEN); + ASSERT_EQ(act->type, LIBC_NAMESPACE::BaseSpawnFileAction::OPEN); act = act->next; } ASSERT_EQ(action_count, 3); - ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_destroy(&actions), 0); + ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_destroy(&actions), 0); } TEST(LlvmLibcPosixSpawnFileActionsTest, InvalidActions) { - ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_addclose(nullptr, 1), EINVAL); - ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_adddup2(nullptr, 1, 2), + ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_addclose(nullptr, 1), + EINVAL); + ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_adddup2(nullptr, 1, 2), + EINVAL); + ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_addopen(nullptr, 1, + nullptr, 0, 0), EINVAL); - ASSERT_EQ( - __llvm_libc::posix_spawn_file_actions_addopen(nullptr, 1, nullptr, 0, 0), - EINVAL); - ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_destroy(nullptr), EINVAL); + ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_destroy(nullptr), EINVAL); posix_spawn_file_actions_t actions; - ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_init(&actions), 0); - ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_addclose(&actions, -1), + ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_init(&actions), 0); + ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_addclose(&actions, -1), EBADF); - ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_adddup2(&actions, -1, 2), + ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_adddup2(&actions, -1, 2), EBADF); - ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_adddup2(&actions, 1, -2), + ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_adddup2(&actions, 1, -2), EBADF); - ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_addopen(&actions, -1, nullptr, - 0, 0), + ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_addopen(&actions, -1, + nullptr, 0, 0), EBADF); - ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_destroy(&actions), 0); + ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_destroy(&actions), 0); } diff --git a/libc/test/src/stdio/fgetc_test.cpp b/libc/test/src/stdio/fgetc_test.cpp index b262dda..6e6c0ed 100644 --- a/libc/test/src/stdio/fgetc_test.cpp +++ b/libc/test/src/stdio/fgetc_test.cpp @@ -19,25 +19,25 @@ #include "src/errno/libc_errno.h" #include <stdio.h> -class LlvmLibcGetcTest : public __llvm_libc::testing::Test { +class LlvmLibcGetcTest : public LIBC_NAMESPACE::testing::Test { public: using GetcFunc = int(FILE *); void test_with_func(GetcFunc *func, const char *filename) { - ::FILE *file = __llvm_libc::fopen(filename, "w"); + ::FILE *file = LIBC_NAMESPACE::fopen(filename, "w"); ASSERT_FALSE(file == nullptr); constexpr char CONTENT[] = "123456789"; constexpr size_t WRITE_SIZE = sizeof(CONTENT) - 1; - ASSERT_EQ(WRITE_SIZE, __llvm_libc::fwrite(CONTENT, 1, WRITE_SIZE, file)); + ASSERT_EQ(WRITE_SIZE, LIBC_NAMESPACE::fwrite(CONTENT, 1, WRITE_SIZE, file)); // This is a write-only file so reads should fail. ASSERT_EQ(func(file), EOF); // This is an error and not a real EOF. - ASSERT_EQ(__llvm_libc::feof(file), 0); - ASSERT_NE(__llvm_libc::ferror(file), 0); + ASSERT_EQ(LIBC_NAMESPACE::feof(file), 0); + ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0); libc_errno = 0; - ASSERT_EQ(0, __llvm_libc::fclose(file)); + ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file)); - file = __llvm_libc::fopen(filename, "r"); + file = LIBC_NAMESPACE::fopen(filename, "r"); ASSERT_FALSE(file == nullptr); for (size_t i = 0; i < WRITE_SIZE; ++i) { @@ -46,17 +46,17 @@ public: } // 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 4608be3ee..0d704ec 100644 --- a/libc/test/src/stdio/fgetc_unlocked_test.cpp +++ b/libc/test/src/stdio/fgetc_unlocked_test.cpp @@ -22,46 +22,47 @@ #include "src/errno/libc_errno.h" #include <stdio.h> -class LlvmLibcGetcTest : public __llvm_libc::testing::Test { +class LlvmLibcGetcTest : public LIBC_NAMESPACE::testing::Test { public: using GetcFunc = int(FILE *); void test_with_func(GetcFunc *func, const char *filename) { - ::FILE *file = __llvm_libc::fopen(filename, "w"); + ::FILE *file = LIBC_NAMESPACE::fopen(filename, "w"); ASSERT_FALSE(file == nullptr); constexpr char CONTENT[] = "123456789"; constexpr size_t WRITE_SIZE = sizeof(CONTENT) - 1; - ASSERT_EQ(WRITE_SIZE, __llvm_libc::fwrite(CONTENT, 1, WRITE_SIZE, file)); + ASSERT_EQ(WRITE_SIZE, LIBC_NAMESPACE::fwrite(CONTENT, 1, WRITE_SIZE, file)); // This is a write-only file so reads should fail. ASSERT_EQ(func(file), EOF); // This is an error and not a real EOF. - ASSERT_EQ(__llvm_libc::feof(file), 0); - ASSERT_NE(__llvm_libc::ferror(file), 0); + ASSERT_EQ(LIBC_NAMESPACE::feof(file), 0); + ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0); libc_errno = 0; - ASSERT_EQ(0, __llvm_libc::fclose(file)); + ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file)); - file = __llvm_libc::fopen(filename, "r"); + file = LIBC_NAMESPACE::fopen(filename, "r"); ASSERT_FALSE(file == nullptr); - __llvm_libc::flockfile(file); + LIBC_NAMESPACE::flockfile(file); for (size_t i = 0; i < WRITE_SIZE; ++i) { int c = func(file); ASSERT_EQ(c, int('1' + i)); } // Reading more should return EOF but not set error. ASSERT_EQ(func(file), EOF); - ASSERT_NE(__llvm_libc::feof_unlocked(file), 0); - ASSERT_EQ(__llvm_libc::ferror_unlocked(file), 0); + ASSERT_NE(LIBC_NAMESPACE::feof_unlocked(file), 0); + ASSERT_EQ(LIBC_NAMESPACE::ferror_unlocked(file), 0); - __llvm_libc::funlockfile(file); - ASSERT_EQ(0, __llvm_libc::fclose(file)); + LIBC_NAMESPACE::funlockfile(file); + ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file)); } }; TEST_F(LlvmLibcGetcTest, WriteAndReadCharactersWithFgetcUnlocked) { - test_with_func(&__llvm_libc::fgetc_unlocked, "testdata/fgetc_unlocked.test"); + test_with_func(&LIBC_NAMESPACE::fgetc_unlocked, + "testdata/fgetc_unlocked.test"); } TEST_F(LlvmLibcGetcTest, WriteAndReadCharactersWithGetcUnlocked) { - test_with_func(&__llvm_libc::getc_unlocked, "testdata/getc_unlocked.test"); + test_with_func(&LIBC_NAMESPACE::getc_unlocked, "testdata/getc_unlocked.test"); } diff --git a/libc/test/src/stdio/fgets_test.cpp b/libc/test/src/stdio/fgets_test.cpp index 150a9dd..9f9841c 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 68a749a..d5478e5 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 <stdio.h> -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<FILE *>(nullptr)); // EXPECT_NE(libc_errno, 0); } TEST(LlvmLibcFILETest, FFlush) { constexpr char FILENAME[] = "testdata/fflush.test"; - ::FILE *file = __llvm_libc::fopen(FILENAME, "w+"); + ::FILE *file = LIBC_NAMESPACE::fopen(FILENAME, "w+"); ASSERT_FALSE(file == nullptr); constexpr char CONTENT[] = "1234567890987654321"; ASSERT_EQ(sizeof(CONTENT), - __llvm_libc::fwrite(CONTENT, 1, sizeof(CONTENT), file)); + LIBC_NAMESPACE::fwrite(CONTENT, 1, sizeof(CONTENT), file)); // Flushing at this point should write the data to disk. So, we should be // able to read it back. - ASSERT_EQ(0, __llvm_libc::fflush(file)); + ASSERT_EQ(0, LIBC_NAMESPACE::fflush(file)); char data[sizeof(CONTENT)]; - ASSERT_EQ(__llvm_libc::fseek(file, 0, SEEK_SET), 0); - ASSERT_EQ(__llvm_libc::fread(data, 1, sizeof(CONTENT), file), + ASSERT_EQ(LIBC_NAMESPACE::fseek(file, 0, SEEK_SET), 0); + ASSERT_EQ(LIBC_NAMESPACE::fread(data, 1, sizeof(CONTENT), file), sizeof(CONTENT)); ASSERT_STREQ(data, CONTENT); - ASSERT_EQ(__llvm_libc::fclose(file), 0); + ASSERT_EQ(LIBC_NAMESPACE::fclose(file), 0); } TEST(LlvmLibcFILETest, FOpenFWriteSizeGreaterThanOne) { @@ -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 f0de8ca..42e7c57 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 cfdaef2..6f3c291 100644 --- a/libc/test/src/stdio/fopencookie_test.cpp +++ b/libc/test/src/stdio/fopencookie_test.cpp @@ -22,7 +22,7 @@ #include <stdio.h> #include <stdlib.h> -using MemoryView = __llvm_libc::testing::MemoryView; +using MemoryView = LIBC_NAMESPACE::testing::MemoryView; struct StringStream { char *buf; @@ -98,29 +98,29 @@ TEST(LlvmLibcFOpenCookie, ReadOnlyCookieTest) { for (size_t i = 0; i < sizeof(CONTENT); ++i) ss->buf[i] = CONTENT[i]; - ::FILE *f = __llvm_libc::fopencookie(ss, "r", STRING_STREAM_FUNCS); + ::FILE *f = LIBC_NAMESPACE::fopencookie(ss, "r", STRING_STREAM_FUNCS); ASSERT_TRUE(f != nullptr); char read_data[sizeof(CONTENT)]; ASSERT_EQ(sizeof(CONTENT), - __llvm_libc::fread(read_data, 1, sizeof(CONTENT), f)); + LIBC_NAMESPACE::fread(read_data, 1, sizeof(CONTENT), f)); ASSERT_STREQ(read_data, CONTENT); // Reading another time should trigger eof. ASSERT_NE(sizeof(CONTENT), - __llvm_libc::fread(read_data, 1, sizeof(CONTENT), f)); - ASSERT_NE(__llvm_libc::feof(f), 0); + LIBC_NAMESPACE::fread(read_data, 1, sizeof(CONTENT), f)); + ASSERT_NE(LIBC_NAMESPACE::feof(f), 0); - ASSERT_EQ(0, __llvm_libc::fseek(f, 0, SEEK_SET)); + ASSERT_EQ(0, LIBC_NAMESPACE::fseek(f, 0, SEEK_SET)); // Should be an error to write. - ASSERT_EQ(size_t(0), __llvm_libc::fwrite(CONTENT, 1, sizeof(CONTENT), f)); - ASSERT_NE(__llvm_libc::ferror(f), 0); + ASSERT_EQ(size_t(0), LIBC_NAMESPACE::fwrite(CONTENT, 1, sizeof(CONTENT), f)); + ASSERT_NE(LIBC_NAMESPACE::ferror(f), 0); ASSERT_NE(libc_errno, 0); libc_errno = 0; - __llvm_libc::clearerr(f); - ASSERT_EQ(__llvm_libc::ferror(f), 0); + LIBC_NAMESPACE::clearerr(f); + ASSERT_EQ(LIBC_NAMESPACE::ferror(f), 0); - ASSERT_EQ(0, __llvm_libc::fclose(f)); + ASSERT_EQ(0, LIBC_NAMESPACE::fclose(f)); free(ss); } @@ -132,28 +132,29 @@ TEST(LlvmLibcFOpenCookie, WriteOnlyCookieTest) { ss->offset = 0; ss->endpos = 0; - ::FILE *f = __llvm_libc::fopencookie(ss, "w", STRING_STREAM_FUNCS); + ::FILE *f = LIBC_NAMESPACE::fopencookie(ss, "w", STRING_STREAM_FUNCS); ASSERT_TRUE(f != nullptr); constexpr char WRITE_DATA[] = "Hello,writeonly!"; ASSERT_EQ(sizeof(WRITE_DATA), - __llvm_libc::fwrite(WRITE_DATA, 1, sizeof(WRITE_DATA), f)); + LIBC_NAMESPACE::fwrite(WRITE_DATA, 1, sizeof(WRITE_DATA), f)); // Flushing will ensure the data to be written to the string stream. - ASSERT_EQ(0, __llvm_libc::fflush(f)); + ASSERT_EQ(0, LIBC_NAMESPACE::fflush(f)); ASSERT_STREQ(WRITE_DATA, ss->buf); - ASSERT_EQ(0, __llvm_libc::fseek(f, 0, SEEK_SET)); + ASSERT_EQ(0, LIBC_NAMESPACE::fseek(f, 0, SEEK_SET)); char read_data[sizeof(WRITE_DATA)]; // Should be an error to read. - ASSERT_EQ(size_t(0), __llvm_libc::fread(read_data, 1, sizeof(WRITE_DATA), f)); - ASSERT_NE(__llvm_libc::ferror(f), 0); + ASSERT_EQ(size_t(0), + LIBC_NAMESPACE::fread(read_data, 1, sizeof(WRITE_DATA), f)); + ASSERT_NE(LIBC_NAMESPACE::ferror(f), 0); ASSERT_EQ(libc_errno, EBADF); libc_errno = 0; - __llvm_libc::clearerr(f); - ASSERT_EQ(__llvm_libc::ferror(f), 0); + LIBC_NAMESPACE::clearerr(f); + ASSERT_EQ(LIBC_NAMESPACE::ferror(f), 0); - ASSERT_EQ(0, __llvm_libc::fclose(f)); + ASSERT_EQ(0, LIBC_NAMESPACE::fclose(f)); free(ss); } @@ -168,26 +169,26 @@ TEST(LlvmLibcFOpenCookie, AppendOnlyCookieTest) { for (size_t i = 0; i < sizeof(INITIAL_CONTENT); ++i) ss->buf[i] = INITIAL_CONTENT[i]; - ::FILE *f = __llvm_libc::fopencookie(ss, "a", STRING_STREAM_FUNCS); + ::FILE *f = LIBC_NAMESPACE::fopencookie(ss, "a", STRING_STREAM_FUNCS); ASSERT_TRUE(f != nullptr); constexpr size_t READ_SIZE = 5; char read_data[READ_SIZE]; // This is not a readable file. - ASSERT_EQ(__llvm_libc::fread(read_data, 1, READ_SIZE, f), size_t(0)); - ASSERT_NE(__llvm_libc::ferror(f), 0); + ASSERT_EQ(LIBC_NAMESPACE::fread(read_data, 1, READ_SIZE, f), size_t(0)); + ASSERT_NE(LIBC_NAMESPACE::ferror(f), 0); EXPECT_NE(libc_errno, 0); libc_errno = 0; - __llvm_libc::clearerr(f); - ASSERT_EQ(__llvm_libc::ferror(f), 0); + LIBC_NAMESPACE::clearerr(f); + ASSERT_EQ(LIBC_NAMESPACE::ferror(f), 0); - ASSERT_EQ(__llvm_libc::fwrite(WRITE_DATA, 1, sizeof(WRITE_DATA), f), + ASSERT_EQ(LIBC_NAMESPACE::fwrite(WRITE_DATA, 1, sizeof(WRITE_DATA), f), sizeof(WRITE_DATA)); - EXPECT_EQ(__llvm_libc::fflush(f), 0); + EXPECT_EQ(LIBC_NAMESPACE::fflush(f), 0); EXPECT_EQ(ss->endpos, sizeof(WRITE_DATA) + sizeof(INITIAL_CONTENT)); - ASSERT_EQ(__llvm_libc::fclose(f), 0); + ASSERT_EQ(LIBC_NAMESPACE::fclose(f), 0); free(ss); } @@ -201,24 +202,24 @@ TEST(LlvmLibcFOpenCookie, ReadUpdateCookieTest) { for (size_t i = 0; i < sizeof(INITIAL_CONTENT); ++i) ss->buf[i] = INITIAL_CONTENT[i]; - ::FILE *f = __llvm_libc::fopencookie(ss, "r+", STRING_STREAM_FUNCS); + ::FILE *f = LIBC_NAMESPACE::fopencookie(ss, "r+", STRING_STREAM_FUNCS); ASSERT_TRUE(f != nullptr); constexpr size_t READ_SIZE = sizeof(INITIAL_CONTENT) / 2; char read_data[READ_SIZE]; - ASSERT_EQ(READ_SIZE, __llvm_libc::fread(read_data, 1, READ_SIZE, f)); + ASSERT_EQ(READ_SIZE, LIBC_NAMESPACE::fread(read_data, 1, READ_SIZE, f)); MemoryView src1(INITIAL_CONTENT, READ_SIZE), dst1(read_data, READ_SIZE); EXPECT_MEM_EQ(src1, dst1); - ASSERT_EQ(__llvm_libc::fseek(f, 0, SEEK_SET), 0); + ASSERT_EQ(LIBC_NAMESPACE::fseek(f, 0, SEEK_SET), 0); constexpr char WRITE_DATA[] = "hello, file"; ASSERT_EQ(sizeof(WRITE_DATA), - __llvm_libc::fwrite(WRITE_DATA, 1, sizeof(WRITE_DATA), f)); - ASSERT_EQ(__llvm_libc::fflush(f), 0); + LIBC_NAMESPACE::fwrite(WRITE_DATA, 1, sizeof(WRITE_DATA), f)); + ASSERT_EQ(LIBC_NAMESPACE::fflush(f), 0); EXPECT_STREQ(ss->buf, WRITE_DATA); - ASSERT_EQ(__llvm_libc::fclose(f), 0); + ASSERT_EQ(LIBC_NAMESPACE::fclose(f), 0); free(ss); } @@ -230,19 +231,19 @@ TEST(LlvmLibcFOpenCookie, WriteUpdateCookieTest) { ss->offset = 0; ss->endpos = 0; - ::FILE *f = __llvm_libc::fopencookie(ss, "w+", STRING_STREAM_FUNCS); + ::FILE *f = LIBC_NAMESPACE::fopencookie(ss, "w+", STRING_STREAM_FUNCS); ASSERT_TRUE(f != nullptr); ASSERT_EQ(sizeof(WRITE_DATA), - __llvm_libc::fwrite(WRITE_DATA, 1, sizeof(WRITE_DATA), f)); + LIBC_NAMESPACE::fwrite(WRITE_DATA, 1, sizeof(WRITE_DATA), f)); - ASSERT_EQ(__llvm_libc::fseek(f, 0, SEEK_SET), 0); + ASSERT_EQ(LIBC_NAMESPACE::fseek(f, 0, SEEK_SET), 0); char read_data[sizeof(WRITE_DATA)]; - ASSERT_EQ(__llvm_libc::fread(read_data, 1, sizeof(read_data), f), + ASSERT_EQ(LIBC_NAMESPACE::fread(read_data, 1, sizeof(read_data), f), sizeof(read_data)); EXPECT_STREQ(read_data, WRITE_DATA); - ASSERT_EQ(__llvm_libc::fclose(f), 0); + ASSERT_EQ(LIBC_NAMESPACE::fclose(f), 0); free(ss); } diff --git a/libc/test/src/stdio/fprintf_test.cpp b/libc/test/src/stdio/fprintf_test.cpp index 9a3c1f2..08b3179 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 e5aa7c7..578403fc3 100644 --- a/libc/test/src/stdio/fputc_test.cpp +++ b/libc/test/src/stdio/fputc_test.cpp @@ -17,14 +17,14 @@ TEST(LlvmLibcPutcTest, PrintOut) { constexpr char simple[] = "A simple string written to stdout\n"; for (const char &c : simple) { - result = __llvm_libc::putchar(c); + result = LIBC_NAMESPACE::putchar(c); EXPECT_GE(result, 0); } constexpr char more[] = "A simple string written to stderr\n"; for (const char &c : simple) { - result = - __llvm_libc::fputc(c, reinterpret_cast<FILE *>(__llvm_libc::stderr)); + result = LIBC_NAMESPACE::fputc( + c, reinterpret_cast<FILE *>(LIBC_NAMESPACE::stderr)); } EXPECT_GE(result, 0); } diff --git a/libc/test/src/stdio/fputs_test.cpp b/libc/test/src/stdio/fputs_test.cpp index 8c20696..6583738 100644 --- a/libc/test/src/stdio/fputs_test.cpp +++ b/libc/test/src/stdio/fputs_test.cpp @@ -15,12 +15,12 @@ TEST(LlvmLibcPutsTest, PrintOut) { int result; constexpr char simple[] = "A simple string written to stdout\n"; - result = - __llvm_libc::fputs(simple, reinterpret_cast<FILE *>(__llvm_libc::stdout)); + result = LIBC_NAMESPACE::fputs( + simple, reinterpret_cast<FILE *>(LIBC_NAMESPACE::stdout)); EXPECT_GE(result, 0); constexpr char more[] = "A simple string written to stderr\n"; - result = - __llvm_libc::fputs(more, reinterpret_cast<FILE *>(__llvm_libc::stderr)); + result = LIBC_NAMESPACE::fputs( + more, reinterpret_cast<FILE *>(LIBC_NAMESPACE::stderr)); EXPECT_GE(result, 0); } diff --git a/libc/test/src/stdio/fscanf_test.cpp b/libc/test/src/stdio/fscanf_test.cpp index efb8f31..7010907 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 fec881d..61b626f 100644 --- a/libc/test/src/stdio/ftell_test.cpp +++ b/libc/test/src/stdio/ftell_test.cpp @@ -17,41 +17,41 @@ #include <stdio.h> -class LlvmLibcFTellTest : public __llvm_libc::testing::Test { +class LlvmLibcFTellTest : public LIBC_NAMESPACE::testing::Test { protected: void test_with_bufmode(int bufmode) { constexpr char FILENAME[] = "testdata/ftell.test"; // We will set a special buffer to the file so that we guarantee buffering. constexpr size_t BUFFER_SIZE = 1024; char buffer[BUFFER_SIZE]; - ::FILE *file = __llvm_libc::fopen(FILENAME, "w+"); + ::FILE *file = LIBC_NAMESPACE::fopen(FILENAME, "w+"); ASSERT_FALSE(file == nullptr); - ASSERT_EQ(__llvm_libc::setvbuf(file, buffer, bufmode, BUFFER_SIZE), 0); + ASSERT_EQ(LIBC_NAMESPACE::setvbuf(file, buffer, bufmode, BUFFER_SIZE), 0); // Include few '\n' chars to test when |bufmode| is _IOLBF. constexpr char CONTENT[] = "12\n345\n6789"; constexpr size_t WRITE_SIZE = sizeof(CONTENT) - 1; - ASSERT_EQ(WRITE_SIZE, __llvm_libc::fwrite(CONTENT, 1, WRITE_SIZE, file)); + ASSERT_EQ(WRITE_SIZE, LIBC_NAMESPACE::fwrite(CONTENT, 1, WRITE_SIZE, file)); // The above write should have buffered the written data and not have // trasferred it to the underlying stream. But, ftell operation should // still return the correct effective offset. - ASSERT_EQ(size_t(__llvm_libc::ftell(file)), WRITE_SIZE); + ASSERT_EQ(size_t(LIBC_NAMESPACE::ftell(file)), WRITE_SIZE); long offset = 5; - ASSERT_EQ(0, __llvm_libc::fseek(file, offset, SEEK_SET)); - ASSERT_EQ(__llvm_libc::ftell(file), offset); - ASSERT_EQ(0, __llvm_libc::fseek(file, -offset, SEEK_END)); - ASSERT_EQ(size_t(__llvm_libc::ftell(file)), size_t(WRITE_SIZE - offset)); + ASSERT_EQ(0, LIBC_NAMESPACE::fseek(file, offset, SEEK_SET)); + ASSERT_EQ(LIBC_NAMESPACE::ftell(file), offset); + ASSERT_EQ(0, LIBC_NAMESPACE::fseek(file, -offset, SEEK_END)); + ASSERT_EQ(size_t(LIBC_NAMESPACE::ftell(file)), size_t(WRITE_SIZE - offset)); - ASSERT_EQ(0, __llvm_libc::fseek(file, 0, SEEK_SET)); + ASSERT_EQ(0, LIBC_NAMESPACE::fseek(file, 0, SEEK_SET)); constexpr size_t READ_SIZE = WRITE_SIZE / 2; char data[READ_SIZE]; // Reading a small amount will actually read out much more data and // buffer it. But, ftell should return the correct effective offset. - ASSERT_EQ(READ_SIZE, __llvm_libc::fread(data, 1, READ_SIZE, file)); - ASSERT_EQ(size_t(__llvm_libc::ftell(file)), READ_SIZE); + ASSERT_EQ(READ_SIZE, LIBC_NAMESPACE::fread(data, 1, READ_SIZE, file)); + ASSERT_EQ(size_t(LIBC_NAMESPACE::ftell(file)), READ_SIZE); - ASSERT_EQ(0, __llvm_libc::fclose(file)); + ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file)); } }; diff --git a/libc/test/src/stdio/printf_core/converter_test.cpp b/libc/test/src/stdio/printf_core/converter_test.cpp index 69860d6..8404ef6 100644 --- a/libc/test/src/stdio/printf_core/converter_test.cpp +++ b/libc/test/src/stdio/printf_core/converter_test.cpp @@ -12,24 +12,24 @@ #include "test/UnitTest/Test.h" -class LlvmLibcPrintfConverterTest : public __llvm_libc::testing::Test { +class LlvmLibcPrintfConverterTest : public LIBC_NAMESPACE::testing::Test { protected: // void SetUp() override {} // void TearDown() override {} char str[60]; - __llvm_libc::printf_core::WriteBuffer wb = - __llvm_libc::printf_core::WriteBuffer(str, sizeof(str) - 1); - __llvm_libc::printf_core::Writer writer = - __llvm_libc::printf_core::Writer(&wb); + LIBC_NAMESPACE::printf_core::WriteBuffer wb = + LIBC_NAMESPACE::printf_core::WriteBuffer(str, sizeof(str) - 1); + LIBC_NAMESPACE::printf_core::Writer writer = + LIBC_NAMESPACE::printf_core::Writer(&wb); }; TEST_F(LlvmLibcPrintfConverterTest, SimpleRawConversion) { - __llvm_libc::printf_core::FormatSection raw_section; + LIBC_NAMESPACE::printf_core::FormatSection raw_section; raw_section.has_conv = false; raw_section.raw_string = "abc"; - __llvm_libc::printf_core::convert(&writer, raw_section); + LIBC_NAMESPACE::printf_core::convert(&writer, raw_section); wb.buff[wb.buff_cur] = '\0'; @@ -38,12 +38,12 @@ TEST_F(LlvmLibcPrintfConverterTest, SimpleRawConversion) { } TEST_F(LlvmLibcPrintfConverterTest, PercentConversion) { - __llvm_libc::printf_core::FormatSection simple_conv; + LIBC_NAMESPACE::printf_core::FormatSection simple_conv; simple_conv.has_conv = true; simple_conv.raw_string = "%%"; simple_conv.conv_name = '%'; - __llvm_libc::printf_core::convert(&writer, simple_conv); + LIBC_NAMESPACE::printf_core::convert(&writer, simple_conv); wb.buff[wb.buff_cur] = '\0'; @@ -52,7 +52,7 @@ TEST_F(LlvmLibcPrintfConverterTest, PercentConversion) { } TEST_F(LlvmLibcPrintfConverterTest, CharConversionSimple) { - __llvm_libc::printf_core::FormatSection simple_conv; + LIBC_NAMESPACE::printf_core::FormatSection simple_conv; simple_conv.has_conv = true; // If has_conv is true, the raw string is ignored. They are not being parsed // and match the actual conversion taking place so that you can compare these @@ -61,7 +61,7 @@ TEST_F(LlvmLibcPrintfConverterTest, CharConversionSimple) { simple_conv.conv_name = 'c'; simple_conv.conv_val_raw = 'D'; - __llvm_libc::printf_core::convert(&writer, simple_conv); + LIBC_NAMESPACE::printf_core::convert(&writer, simple_conv); wb.buff[wb.buff_cur] = '\0'; @@ -70,13 +70,13 @@ TEST_F(LlvmLibcPrintfConverterTest, CharConversionSimple) { } TEST_F(LlvmLibcPrintfConverterTest, CharConversionRightJustified) { - __llvm_libc::printf_core::FormatSection right_justified_conv; + LIBC_NAMESPACE::printf_core::FormatSection right_justified_conv; right_justified_conv.has_conv = true; right_justified_conv.raw_string = "%4c"; right_justified_conv.conv_name = 'c'; right_justified_conv.min_width = 4; right_justified_conv.conv_val_raw = 'E'; - __llvm_libc::printf_core::convert(&writer, right_justified_conv); + LIBC_NAMESPACE::printf_core::convert(&writer, right_justified_conv); wb.buff[wb.buff_cur] = '\0'; @@ -85,15 +85,15 @@ TEST_F(LlvmLibcPrintfConverterTest, CharConversionRightJustified) { } TEST_F(LlvmLibcPrintfConverterTest, CharConversionLeftJustified) { - __llvm_libc::printf_core::FormatSection left_justified_conv; + LIBC_NAMESPACE::printf_core::FormatSection left_justified_conv; left_justified_conv.has_conv = true; left_justified_conv.raw_string = "%-4c"; left_justified_conv.conv_name = 'c'; left_justified_conv.flags = - __llvm_libc::printf_core::FormatFlags::LEFT_JUSTIFIED; + LIBC_NAMESPACE::printf_core::FormatFlags::LEFT_JUSTIFIED; left_justified_conv.min_width = 4; left_justified_conv.conv_val_raw = 'F'; - __llvm_libc::printf_core::convert(&writer, left_justified_conv); + LIBC_NAMESPACE::printf_core::convert(&writer, left_justified_conv); wb.buff[wb.buff_cur] = '\0'; @@ -103,13 +103,13 @@ TEST_F(LlvmLibcPrintfConverterTest, CharConversionLeftJustified) { TEST_F(LlvmLibcPrintfConverterTest, StringConversionSimple) { - __llvm_libc::printf_core::FormatSection simple_conv; + LIBC_NAMESPACE::printf_core::FormatSection simple_conv; simple_conv.has_conv = true; simple_conv.raw_string = "%s"; simple_conv.conv_name = 's'; simple_conv.conv_val_ptr = const_cast<char *>("DEF"); - __llvm_libc::printf_core::convert(&writer, simple_conv); + LIBC_NAMESPACE::printf_core::convert(&writer, simple_conv); wb.buff[wb.buff_cur] = '\0'; @@ -118,13 +118,13 @@ TEST_F(LlvmLibcPrintfConverterTest, StringConversionSimple) { } TEST_F(LlvmLibcPrintfConverterTest, StringConversionPrecisionHigh) { - __llvm_libc::printf_core::FormatSection high_precision_conv; + LIBC_NAMESPACE::printf_core::FormatSection high_precision_conv; high_precision_conv.has_conv = true; high_precision_conv.raw_string = "%4s"; high_precision_conv.conv_name = 's'; high_precision_conv.precision = 4; high_precision_conv.conv_val_ptr = const_cast<char *>("456"); - __llvm_libc::printf_core::convert(&writer, high_precision_conv); + LIBC_NAMESPACE::printf_core::convert(&writer, high_precision_conv); wb.buff[wb.buff_cur] = '\0'; @@ -133,13 +133,13 @@ TEST_F(LlvmLibcPrintfConverterTest, StringConversionPrecisionHigh) { } TEST_F(LlvmLibcPrintfConverterTest, StringConversionPrecisionLow) { - __llvm_libc::printf_core::FormatSection low_precision_conv; + LIBC_NAMESPACE::printf_core::FormatSection low_precision_conv; low_precision_conv.has_conv = true; low_precision_conv.raw_string = "%.2s"; low_precision_conv.conv_name = 's'; low_precision_conv.precision = 2; low_precision_conv.conv_val_ptr = const_cast<char *>("xyz"); - __llvm_libc::printf_core::convert(&writer, low_precision_conv); + LIBC_NAMESPACE::printf_core::convert(&writer, low_precision_conv); wb.buff[wb.buff_cur] = '\0'; @@ -148,13 +148,13 @@ TEST_F(LlvmLibcPrintfConverterTest, StringConversionPrecisionLow) { } TEST_F(LlvmLibcPrintfConverterTest, StringConversionRightJustified) { - __llvm_libc::printf_core::FormatSection right_justified_conv; + LIBC_NAMESPACE::printf_core::FormatSection right_justified_conv; right_justified_conv.has_conv = true; right_justified_conv.raw_string = "%4s"; right_justified_conv.conv_name = 's'; right_justified_conv.min_width = 4; right_justified_conv.conv_val_ptr = const_cast<char *>("789"); - __llvm_libc::printf_core::convert(&writer, right_justified_conv); + LIBC_NAMESPACE::printf_core::convert(&writer, right_justified_conv); wb.buff[wb.buff_cur] = '\0'; @@ -163,15 +163,15 @@ TEST_F(LlvmLibcPrintfConverterTest, StringConversionRightJustified) { } TEST_F(LlvmLibcPrintfConverterTest, StringConversionLeftJustified) { - __llvm_libc::printf_core::FormatSection left_justified_conv; + LIBC_NAMESPACE::printf_core::FormatSection left_justified_conv; left_justified_conv.has_conv = true; left_justified_conv.raw_string = "%-4s"; left_justified_conv.conv_name = 's'; left_justified_conv.flags = - __llvm_libc::printf_core::FormatFlags::LEFT_JUSTIFIED; + LIBC_NAMESPACE::printf_core::FormatFlags::LEFT_JUSTIFIED; left_justified_conv.min_width = 4; left_justified_conv.conv_val_ptr = const_cast<char *>("ghi"); - __llvm_libc::printf_core::convert(&writer, left_justified_conv); + LIBC_NAMESPACE::printf_core::convert(&writer, left_justified_conv); wb.buff[wb.buff_cur] = '\0'; @@ -180,12 +180,12 @@ TEST_F(LlvmLibcPrintfConverterTest, StringConversionLeftJustified) { } TEST_F(LlvmLibcPrintfConverterTest, IntConversionSimple) { - __llvm_libc::printf_core::FormatSection section; + LIBC_NAMESPACE::printf_core::FormatSection section; section.has_conv = true; section.raw_string = "%d"; section.conv_name = 'd'; section.conv_val_raw = 12345; - __llvm_libc::printf_core::convert(&writer, section); + LIBC_NAMESPACE::printf_core::convert(&writer, section); wb.buff[wb.buff_cur] = '\0'; @@ -194,16 +194,16 @@ TEST_F(LlvmLibcPrintfConverterTest, IntConversionSimple) { } TEST_F(LlvmLibcPrintfConverterTest, HexConversion) { - __llvm_libc::printf_core::FormatSection section; + LIBC_NAMESPACE::printf_core::FormatSection section; section.has_conv = true; section.raw_string = "%#018x"; section.conv_name = 'x'; - section.flags = static_cast<__llvm_libc::printf_core::FormatFlags>( - __llvm_libc::printf_core::FormatFlags::ALTERNATE_FORM | - __llvm_libc::printf_core::FormatFlags::LEADING_ZEROES); + section.flags = static_cast<LIBC_NAMESPACE::printf_core::FormatFlags>( + LIBC_NAMESPACE::printf_core::FormatFlags::ALTERNATE_FORM | + LIBC_NAMESPACE::printf_core::FormatFlags::LEADING_ZEROES); section.min_width = 18; section.conv_val_raw = 0x123456ab; - __llvm_libc::printf_core::convert(&writer, section); + LIBC_NAMESPACE::printf_core::convert(&writer, section); wb.buff[wb.buff_cur] = '\0'; ASSERT_STREQ(str, "0x00000000123456ab"); @@ -212,12 +212,12 @@ TEST_F(LlvmLibcPrintfConverterTest, HexConversion) { TEST_F(LlvmLibcPrintfConverterTest, PointerConversion) { - __llvm_libc::printf_core::FormatSection section; + LIBC_NAMESPACE::printf_core::FormatSection section; section.has_conv = true; section.raw_string = "%p"; section.conv_name = 'p'; section.conv_val_ptr = (void *)(0x123456ab); - __llvm_libc::printf_core::convert(&writer, section); + LIBC_NAMESPACE::printf_core::convert(&writer, section); wb.buff[wb.buff_cur] = '\0'; ASSERT_STREQ(str, "0x123456ab"); @@ -226,12 +226,12 @@ TEST_F(LlvmLibcPrintfConverterTest, PointerConversion) { TEST_F(LlvmLibcPrintfConverterTest, OctConversion) { - __llvm_libc::printf_core::FormatSection section; + LIBC_NAMESPACE::printf_core::FormatSection section; section.has_conv = true; section.raw_string = "%o"; section.conv_name = 'o'; section.conv_val_raw = 01234; - __llvm_libc::printf_core::convert(&writer, section); + LIBC_NAMESPACE::printf_core::convert(&writer, section); wb.buff[wb.buff_cur] = '\0'; ASSERT_STREQ(str, "1234"); diff --git a/libc/test/src/stdio/printf_core/parser_test.cpp b/libc/test/src/stdio/printf_core/parser_test.cpp index 910b611..0134277 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<ArgList> parser(str, v); + LIBC_NAMESPACE::printf_core::Parser<ArgList> 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<ArgList> parser(str, v); + LIBC_NAMESPACE::printf_core::Parser<ArgList> 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>( + 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>( + 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<uint64_t>(arg2); + expected1.conv_val_raw = LIBC_NAMESPACE::cpp::bit_cast<uint64_t>(arg2); expected1.conv_name = 'f'; ASSERT_PFORMAT_EQ(expected1, format_arr[1]); @@ -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<uint64_t>(arg2); + expected1.conv_val_raw = LIBC_NAMESPACE::cpp::bit_cast<uint64_t>(arg2); expected1.conv_name = 'f'; ASSERT_PFORMAT_EQ(expected1, format_arr[1]); @@ -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<uint64_t>(arg2); + expected1.conv_val_raw = LIBC_NAMESPACE::cpp::bit_cast<uint64_t>(arg2); expected1.conv_name = 'f'; ASSERT_PFORMAT_EQ(expected1, format_arr[1]); @@ -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<uint64_t>(arg2); + expected5.conv_val_raw = LIBC_NAMESPACE::cpp::bit_cast<uint64_t>(arg2); expected5.conv_name = 'f'; EXPECT_PFORMAT_EQ(expected5, format_arr[5]); @@ -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<uint64_t>(arg2); + expected7.conv_val_raw = LIBC_NAMESPACE::cpp::bit_cast<uint64_t>(arg2); expected7.conv_name = 'f'; EXPECT_PFORMAT_EQ(expected7, format_arr[7]); @@ -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 f31ff91d..4fe5ffb 100644 --- a/libc/test/src/stdio/printf_core/writer_test.cpp +++ b/libc/test/src/stdio/printf_core/writer_test.cpp @@ -13,9 +13,9 @@ #include "test/UnitTest/Test.h" -using __llvm_libc::cpp::string_view; -using __llvm_libc::printf_core::WriteBuffer; -using __llvm_libc::printf_core::Writer; +using LIBC_NAMESPACE::cpp::string_view; +using LIBC_NAMESPACE::printf_core::WriteBuffer; +using LIBC_NAMESPACE::printf_core::Writer; TEST(LlvmLibcPrintfWriterTest, Constructor) { char str[10]; @@ -200,8 +200,8 @@ int copy_to_out(string_view new_str, void *raw_out_buff) { OutBuff *out_buff = reinterpret_cast<OutBuff *>(raw_out_buff); - __llvm_libc::inline_memcpy(out_buff->out_str + out_buff->cur_pos, - new_str.data(), new_str.size()); + LIBC_NAMESPACE::inline_memcpy(out_buff->out_str + out_buff->cur_pos, + new_str.data(), new_str.size()); out_buff->cur_pos += new_str.size(); return 0; diff --git a/libc/test/src/stdio/printf_test.cpp b/libc/test/src/stdio/printf_test.cpp index e2e3675..147d17b 100644 --- a/libc/test/src/stdio/printf_test.cpp +++ b/libc/test/src/stdio/printf_test.cpp @@ -14,16 +14,16 @@ TEST(LlvmLibcPrintfTest, PrintOut) { int written; constexpr char simple[] = "A simple string with no conversions.\n"; - written = __llvm_libc::printf(simple); + written = LIBC_NAMESPACE::printf(simple); EXPECT_EQ(written, static_cast<int>(sizeof(simple) - 1)); constexpr char numbers[] = "1234567890\n"; - written = __llvm_libc::printf("%s", numbers); + written = LIBC_NAMESPACE::printf("%s", numbers); EXPECT_EQ(written, static_cast<int>(sizeof(numbers) - 1)); constexpr char format_more[] = "%s and more\n"; constexpr char short_numbers[] = "1234"; - written = __llvm_libc::printf(format_more, short_numbers); + written = LIBC_NAMESPACE::printf(format_more, short_numbers); EXPECT_EQ(written, static_cast<int>(sizeof(format_more) + sizeof(short_numbers) - 4)); } diff --git a/libc/test/src/stdio/putc_test.cpp b/libc/test/src/stdio/putc_test.cpp index 0bd3acc..7349a97 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 a9fe171..e9ce46ea 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 dab1c80..ce4a135 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 97cb77e..c760deb 100644 --- a/libc/test/src/stdio/scanf_core/converter_test.cpp +++ b/libc/test/src/stdio/scanf_core/converter_test.cpp @@ -16,159 +16,159 @@ TEST(LlvmLibcScanfConverterTest, RawMatchBasic) { const char *str = "abcdef"; - __llvm_libc::scanf_core::StringReader str_reader(str); - __llvm_libc::scanf_core::Reader reader(&str_reader); + LIBC_NAMESPACE::scanf_core::StringReader str_reader(str); + LIBC_NAMESPACE::scanf_core::Reader reader(&str_reader); // Reading "abc" should succeed. - ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, "abc"), - static_cast<int>(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "abc"), + static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(3)); // Reading nothing should succeed and not advance. - ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, ""), - static_cast<int>(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, ""), + static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(3)); // Reading a space where there is none should succeed and not advance. - ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, " "), - static_cast<int>(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, " "), + static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(3)); // Reading "d" should succeed and advance by 1. - ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, "d"), - static_cast<int>(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "d"), + static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(4)); // Reading "z" should fail and not advance. - ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, "z"), - static_cast<int>(__llvm_libc::scanf_core::MATCHING_FAILURE)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "z"), + static_cast<int>(LIBC_NAMESPACE::scanf_core::MATCHING_FAILURE)); ASSERT_EQ(reader.chars_read(), size_t(4)); // Reading "efgh" should fail but advance to the end. - ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, "efgh"), - static_cast<int>(__llvm_libc::scanf_core::MATCHING_FAILURE)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "efgh"), + static_cast<int>(LIBC_NAMESPACE::scanf_core::MATCHING_FAILURE)); ASSERT_EQ(reader.chars_read(), size_t(6)); } TEST(LlvmLibcScanfConverterTest, RawMatchSpaces) { const char *str = " a \t\n b cd"; - __llvm_libc::scanf_core::StringReader str_reader(str); - __llvm_libc::scanf_core::Reader reader(&str_reader); + LIBC_NAMESPACE::scanf_core::StringReader str_reader(str); + LIBC_NAMESPACE::scanf_core::Reader reader(&str_reader); // Reading "a" should fail and not advance. // Since there's nothing in the format string (the second argument to // raw_match) to match the space in the buffer it isn't consumed. - ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, "a"), - static_cast<int>(__llvm_libc::scanf_core::MATCHING_FAILURE)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "a"), + static_cast<int>(LIBC_NAMESPACE::scanf_core::MATCHING_FAILURE)); ASSERT_EQ(reader.chars_read(), size_t(0)); // Reading " \t\n " should succeed and advance past the space. // Any number of space characters in the format string match 0 or more space // characters in the buffer. - ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, " \t\n "), - static_cast<int>(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, " \t\n "), + static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(1)); // Reading "ab" should fail and only advance past the a // The a characters match, but the format string doesn't have anything to // consume the spaces in the buffer, so it fails. - ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, "ab"), - static_cast<int>(__llvm_libc::scanf_core::MATCHING_FAILURE)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "ab"), + static_cast<int>(LIBC_NAMESPACE::scanf_core::MATCHING_FAILURE)); ASSERT_EQ(reader.chars_read(), size_t(2)); // Reading " b" should succeed and advance past the b // Any number of space characters in the format string matches 0 or more space // characters in the buffer. - ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, " b"), - static_cast<int>(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, " b"), + static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(7)); // Reading "\t" should succeed and advance past the spaces to the c - ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, "\t"), - static_cast<int>(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "\t"), + static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(10)); // Reading "c d" should succeed and advance past the d. // Here the space character in the format string is matching 0 space // characters in the buffer. - ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, "c d"), - static_cast<int>(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "c d"), + static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(12)); } TEST(LlvmLibcScanfConverterTest, StringConvSimple) { const char *str = "abcDEF123 654LKJihg"; char result[20]; - __llvm_libc::scanf_core::StringReader str_reader(str); - __llvm_libc::scanf_core::Reader reader(&str_reader); + LIBC_NAMESPACE::scanf_core::StringReader str_reader(str); + LIBC_NAMESPACE::scanf_core::Reader reader(&str_reader); - __llvm_libc::scanf_core::FormatSection conv; + LIBC_NAMESPACE::scanf_core::FormatSection conv; conv.has_conv = true; conv.conv_name = 's'; conv.output_ptr = result; - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast<int>(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(9)); ASSERT_STREQ(result, "abcDEF123"); //%s skips all spaces before beginning to read. - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast<int>(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(19)); ASSERT_STREQ(result, "654LKJihg"); } TEST(LlvmLibcScanfConverterTest, StringConvNoWrite) { const char *str = "abcDEF123 654LKJihg"; - __llvm_libc::scanf_core::StringReader str_reader(str); - __llvm_libc::scanf_core::Reader reader(&str_reader); + LIBC_NAMESPACE::scanf_core::StringReader str_reader(str); + LIBC_NAMESPACE::scanf_core::Reader reader(&str_reader); - __llvm_libc::scanf_core::FormatSection conv; + LIBC_NAMESPACE::scanf_core::FormatSection conv; conv.has_conv = true; conv.conv_name = 's'; - conv.flags = __llvm_libc::scanf_core::NO_WRITE; + conv.flags = LIBC_NAMESPACE::scanf_core::NO_WRITE; - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast<int>(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(9)); //%s skips all spaces before beginning to read. - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast<int>(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(19)); } TEST(LlvmLibcScanfConverterTest, StringConvWidth) { const char *str = "abcDEF123 654LKJihg"; char result[6]; - __llvm_libc::scanf_core::StringReader str_reader(str); - __llvm_libc::scanf_core::Reader reader(&str_reader); + LIBC_NAMESPACE::scanf_core::StringReader str_reader(str); + LIBC_NAMESPACE::scanf_core::Reader reader(&str_reader); - __llvm_libc::scanf_core::FormatSection conv; + LIBC_NAMESPACE::scanf_core::FormatSection conv; conv.has_conv = true; conv.conv_name = 's'; conv.max_width = 5; // this means the result takes up 6 characters (with \0). conv.output_ptr = result; - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast<int>(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(5)); ASSERT_STREQ(result, "abcDE"); - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast<int>(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(9)); ASSERT_STREQ(result, "F123"); //%s skips all spaces before beginning to read. - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast<int>(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(15)); ASSERT_STREQ(result, "654LK"); - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast<int>(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(19)); ASSERT_STREQ(result, "Jihg"); } @@ -176,70 +176,70 @@ TEST(LlvmLibcScanfConverterTest, StringConvWidth) { TEST(LlvmLibcScanfConverterTest, CharsConv) { const char *str = "abcDEF123 654LKJihg MNOpqr&*("; char result[20]; - __llvm_libc::scanf_core::StringReader str_reader(str); - __llvm_libc::scanf_core::Reader reader(&str_reader); + LIBC_NAMESPACE::scanf_core::StringReader str_reader(str); + LIBC_NAMESPACE::scanf_core::Reader reader(&str_reader); - __llvm_libc::scanf_core::FormatSection conv; + LIBC_NAMESPACE::scanf_core::FormatSection conv; conv.has_conv = true; conv.conv_name = 'c'; conv.output_ptr = result; - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast<int>(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(1)); ASSERT_EQ(result[0], 'a'); - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast<int>(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(2)); ASSERT_EQ(result[0], 'b'); - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast<int>(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(3)); ASSERT_EQ(result[0], 'c'); // Switch from character by character to 8 at a time. conv.max_width = 8; - __llvm_libc::cpp::string_view result_view(result, 8); + LIBC_NAMESPACE::cpp::string_view result_view(result, 8); //%c doesn't stop on spaces. - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast<int>(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(11)); - ASSERT_EQ(result_view, __llvm_libc::cpp::string_view("DEF123 6", 8)); + ASSERT_EQ(result_view, LIBC_NAMESPACE::cpp::string_view("DEF123 6", 8)); - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast<int>(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(19)); - ASSERT_EQ(result_view, __llvm_libc::cpp::string_view("54LKJihg", 8)); + ASSERT_EQ(result_view, LIBC_NAMESPACE::cpp::string_view("54LKJihg", 8)); //%c also doesn't skip spaces at the start. - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast<int>(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(27)); - ASSERT_EQ(result_view, __llvm_libc::cpp::string_view(" MNOpqr&", 8)); + ASSERT_EQ(result_view, LIBC_NAMESPACE::cpp::string_view(" MNOpqr&", 8)); //%c will stop on a null byte though. - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast<int>(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(29)); - ASSERT_EQ(__llvm_libc::cpp::string_view(result, 2), - __llvm_libc::cpp::string_view("*(", 2)); + ASSERT_EQ(LIBC_NAMESPACE::cpp::string_view(result, 2), + LIBC_NAMESPACE::cpp::string_view("*(", 2)); } TEST(LlvmLibcScanfConverterTest, ScansetConv) { const char *str = "abcDEF[123] 654LKJihg"; char result[20]; - __llvm_libc::scanf_core::StringReader str_reader(str); - __llvm_libc::scanf_core::Reader reader(&str_reader); + LIBC_NAMESPACE::scanf_core::StringReader str_reader(str); + LIBC_NAMESPACE::scanf_core::Reader reader(&str_reader); - __llvm_libc::scanf_core::FormatSection conv; + LIBC_NAMESPACE::scanf_core::FormatSection conv; conv.has_conv = true; conv.conv_name = '['; conv.output_ptr = result; - __llvm_libc::cpp::bitset<256> bitset1; + LIBC_NAMESPACE::cpp::bitset<256> bitset1; bitset1.set_range('a', 'c'); bitset1.set_range('D', 'F'); bitset1.set_range('1', '6'); @@ -248,48 +248,48 @@ TEST(LlvmLibcScanfConverterTest, ScansetConv) { conv.scan_set = bitset1; - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast<int>(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(11)); - ASSERT_EQ(__llvm_libc::cpp::string_view(result, 11), - __llvm_libc::cpp::string_view("abcDEF[123]", 11)); + ASSERT_EQ(LIBC_NAMESPACE::cpp::string_view(result, 11), + LIBC_NAMESPACE::cpp::string_view("abcDEF[123]", 11)); // The scanset conversion doesn't consume leading spaces. If it did it would // return "654" here. - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast<int>(__llvm_libc::scanf_core::MATCHING_FAILURE)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast<int>(LIBC_NAMESPACE::scanf_core::MATCHING_FAILURE)); ASSERT_EQ(reader.chars_read(), size_t(11)); // This set is everything except for a-g. - __llvm_libc::cpp::bitset<256> bitset2; + LIBC_NAMESPACE::cpp::bitset<256> bitset2; bitset2.set_range('a', 'g'); bitset2.flip(); conv.scan_set = bitset2; conv.max_width = 5; - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast<int>(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(16)); - ASSERT_EQ(__llvm_libc::cpp::string_view(result, 5), - __llvm_libc::cpp::string_view(" 654L", 5)); + ASSERT_EQ(LIBC_NAMESPACE::cpp::string_view(result, 5), + LIBC_NAMESPACE::cpp::string_view(" 654L", 5)); - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast<int>(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(20)); - ASSERT_EQ(__llvm_libc::cpp::string_view(result, 4), - __llvm_libc::cpp::string_view("KJih", 4)); + ASSERT_EQ(LIBC_NAMESPACE::cpp::string_view(result, 4), + LIBC_NAMESPACE::cpp::string_view("KJih", 4)); // This set is g and '\0'. - __llvm_libc::cpp::bitset<256> bitset3; + LIBC_NAMESPACE::cpp::bitset<256> bitset3; bitset3.set('g'); bitset3.set('\0'); conv.scan_set = bitset3; // Even though '\0' is in the scanset, it should still stop on it. - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast<int>(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast<int>(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(21)); - ASSERT_EQ(__llvm_libc::cpp::string_view(result, 1), - __llvm_libc::cpp::string_view("g", 1)); + ASSERT_EQ(LIBC_NAMESPACE::cpp::string_view(result, 1), + LIBC_NAMESPACE::cpp::string_view("g", 1)); } diff --git a/libc/test/src/stdio/scanf_core/parser_test.cpp b/libc/test/src/stdio/scanf_core/parser_test.cpp index b1f9efa..c81edbd 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<ArgList> parser(str, v); + LIBC_NAMESPACE::scanf_core::Parser<ArgList> 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<ArgList> parser(str, v); + LIBC_NAMESPACE::scanf_core::Parser<ArgList> 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 9db916c..43a1418 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<char *>(str), 1000000}; - __llvm_libc::scanf_core::Reader reader(&rb); + LIBC_NAMESPACE::scanf_core::ReadBuffer rb{const_cast<char *>(str), 1000000}; + LIBC_NAMESPACE::scanf_core::Reader reader(&rb); } TEST(LlvmLibcScanfStringReaderTest, SimpleRead) { const char *str = "abc"; - __llvm_libc::scanf_core::ReadBuffer rb{const_cast<char *>(str), 1000000}; - __llvm_libc::scanf_core::Reader reader(&rb); + LIBC_NAMESPACE::scanf_core::ReadBuffer rb{const_cast<char *>(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<char *>(str), 1000000}; - __llvm_libc::scanf_core::Reader reader(&rb); + LIBC_NAMESPACE::scanf_core::ReadBuffer rb{const_cast<char *>(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 3c2bb37..b0abca4 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 6b44f6b..2faa01a 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 764be9a..d898f2b 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 4fda76d..8b9c919 100644 --- a/libc/test/src/stdio/sprintf_test.cpp +++ b/libc/test/src/stdio/sprintf_test.cpp @@ -16,18 +16,18 @@ // TODO: Add a comment here explaining the printf format string. // #include <stdio.h> -// namespace __llvm_libc { +// namespace LIBC_NAMESPACE { // using ::sprintf; // } -class LlvmLibcSPrintfTest : public __llvm_libc::testing::Test { +class LlvmLibcSPrintfTest : public LIBC_NAMESPACE::testing::Test { protected: char buff[1000]; int written; }; -using __llvm_libc::fputil::testing::ForceRoundingMode; -using __llvm_libc::fputil::testing::RoundingMode; +using LIBC_NAMESPACE::fputil::testing::ForceRoundingMode; +using LIBC_NAMESPACE::fputil::testing::RoundingMode; // Subtract 1 from sizeof(expected_str) to account for the null byte. #define ASSERT_STREQ_LEN(actual_written, actual_str, expected_str) \ @@ -38,7 +38,8 @@ TEST(LlvmLibcSPrintfTest, SimpleNoConv) { char buff[64]; int written; - written = __llvm_libc::sprintf(buff, "A simple string with no conversions."); + written = + LIBC_NAMESPACE::sprintf(buff, "A simple string with no conversions."); EXPECT_EQ(written, 36); ASSERT_STREQ(buff, "A simple string with no conversions."); } @@ -47,15 +48,15 @@ TEST(LlvmLibcSPrintfTest, PercentConv) { char buff[64]; int written; - written = __llvm_libc::sprintf(buff, "%%"); + written = LIBC_NAMESPACE::sprintf(buff, "%%"); EXPECT_EQ(written, 1); ASSERT_STREQ(buff, "%"); - written = __llvm_libc::sprintf(buff, "abc %% def"); + written = LIBC_NAMESPACE::sprintf(buff, "abc %% def"); EXPECT_EQ(written, 9); ASSERT_STREQ(buff, "abc % def"); - written = __llvm_libc::sprintf(buff, "%%%%%%"); + written = LIBC_NAMESPACE::sprintf(buff, "%%%%%%"); EXPECT_EQ(written, 3); ASSERT_STREQ(buff, "%%%"); } @@ -64,15 +65,15 @@ TEST(LlvmLibcSPrintfTest, CharConv) { char buff[64]; int written; - written = __llvm_libc::sprintf(buff, "%c", 'a'); + written = LIBC_NAMESPACE::sprintf(buff, "%c", 'a'); EXPECT_EQ(written, 1); ASSERT_STREQ(buff, "a"); - written = __llvm_libc::sprintf(buff, "%3c %-3c", '1', '2'); + written = LIBC_NAMESPACE::sprintf(buff, "%3c %-3c", '1', '2'); EXPECT_EQ(written, 7); ASSERT_STREQ(buff, " 1 2 "); - written = __llvm_libc::sprintf(buff, "%*c", 2, '3'); + written = LIBC_NAMESPACE::sprintf(buff, "%*c", 2, '3'); EXPECT_EQ(written, 2); ASSERT_STREQ(buff, " 3"); } @@ -81,26 +82,26 @@ TEST(LlvmLibcSPrintfTest, StringConv) { char buff[64]; int written; - written = __llvm_libc::sprintf(buff, "%s", "abcDEF123"); + written = LIBC_NAMESPACE::sprintf(buff, "%s", "abcDEF123"); EXPECT_EQ(written, 9); ASSERT_STREQ(buff, "abcDEF123"); - written = __llvm_libc::sprintf(buff, "%10s %-10s", "centered", "title"); + written = LIBC_NAMESPACE::sprintf(buff, "%10s %-10s", "centered", "title"); EXPECT_EQ(written, 21); ASSERT_STREQ(buff, " centered title "); - written = __llvm_libc::sprintf(buff, "%-5.4s%-4.4s", "words can describe", - "soups most delicious"); + written = LIBC_NAMESPACE::sprintf(buff, "%-5.4s%-4.4s", "words can describe", + "soups most delicious"); EXPECT_EQ(written, 9); ASSERT_STREQ(buff, "word soup"); - written = __llvm_libc::sprintf(buff, "%*s %.*s %*.*s", 10, "beginning", 2, - "isn't", 12, 10, "important. Ever."); + written = LIBC_NAMESPACE::sprintf(buff, "%*s %.*s %*.*s", 10, "beginning", 2, + "isn't", 12, 10, "important. Ever."); EXPECT_EQ(written, 26); ASSERT_STREQ(buff, " beginning is important."); #ifndef LIBC_COPT_PRINTF_NO_NULLPTR_CHECKS - written = __llvm_libc::sprintf(buff, "%s", nullptr); + written = LIBC_NAMESPACE::sprintf(buff, "%s", nullptr); EXPECT_EQ(written, 4); ASSERT_STREQ(buff, "null"); #endif // LIBC_COPT_PRINTF_NO_NULLPTR_CHECKS @@ -112,31 +113,31 @@ TEST(LlvmLibcSPrintfTest, IntConv) { // Basic Tests. - written = __llvm_libc::sprintf(buff, "%d", 123); + written = LIBC_NAMESPACE::sprintf(buff, "%d", 123); EXPECT_EQ(written, 3); ASSERT_STREQ(buff, "123"); - written = __llvm_libc::sprintf(buff, "%i", -456); + written = LIBC_NAMESPACE::sprintf(buff, "%i", -456); EXPECT_EQ(written, 4); ASSERT_STREQ(buff, "-456"); // Length Modifier Tests. - written = __llvm_libc::sprintf(buff, "%hhu", 257); // 0x101 + written = LIBC_NAMESPACE::sprintf(buff, "%hhu", 257); // 0x101 EXPECT_EQ(written, 1); ASSERT_STREQ(buff, "1"); - written = __llvm_libc::sprintf(buff, "%llu", 18446744073709551615ull); + written = LIBC_NAMESPACE::sprintf(buff, "%llu", 18446744073709551615ull); EXPECT_EQ(written, 20); ASSERT_STREQ(buff, "18446744073709551615"); // ull max - written = __llvm_libc::sprintf(buff, "%u", ~0); + written = LIBC_NAMESPACE::sprintf(buff, "%u", ~0); if (sizeof(int) == 4) { EXPECT_EQ(written, 10); ASSERT_STREQ(buff, "4294967295"); } - written = __llvm_libc::sprintf(buff, "%tu", ~ptrdiff_t(0)); + written = LIBC_NAMESPACE::sprintf(buff, "%tu", ~ptrdiff_t(0)); if (sizeof(ptrdiff_t) == 8) { EXPECT_EQ(written, 20); ASSERT_STREQ(buff, "18446744073709551615"); @@ -145,114 +146,114 @@ TEST(LlvmLibcSPrintfTest, IntConv) { ASSERT_STREQ(buff, "4294967295"); } - written = __llvm_libc::sprintf(buff, "%lld", -9223372036854775807ll - 1ll); + written = LIBC_NAMESPACE::sprintf(buff, "%lld", -9223372036854775807ll - 1ll); EXPECT_EQ(written, 20); ASSERT_STREQ(buff, "-9223372036854775808"); // ll min // Min Width Tests. - written = __llvm_libc::sprintf(buff, "%4d", 789); + written = LIBC_NAMESPACE::sprintf(buff, "%4d", 789); EXPECT_EQ(written, 4); ASSERT_STREQ(buff, " 789"); - written = __llvm_libc::sprintf(buff, "%2d", 987); + written = LIBC_NAMESPACE::sprintf(buff, "%2d", 987); EXPECT_EQ(written, 3); ASSERT_STREQ(buff, "987"); // Precision Tests. - written = __llvm_libc::sprintf(buff, "%d", 0); + written = LIBC_NAMESPACE::sprintf(buff, "%d", 0); EXPECT_EQ(written, 1); ASSERT_STREQ(buff, "0"); - written = __llvm_libc::sprintf(buff, "%.0d", 0); + written = LIBC_NAMESPACE::sprintf(buff, "%.0d", 0); EXPECT_EQ(written, 0); ASSERT_STREQ(buff, ""); - written = __llvm_libc::sprintf(buff, "%.5d", 654); + written = LIBC_NAMESPACE::sprintf(buff, "%.5d", 654); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "00654"); - written = __llvm_libc::sprintf(buff, "%.5d", -321); + written = LIBC_NAMESPACE::sprintf(buff, "%.5d", -321); EXPECT_EQ(written, 6); ASSERT_STREQ(buff, "-00321"); - written = __llvm_libc::sprintf(buff, "%.2d", 135); + written = LIBC_NAMESPACE::sprintf(buff, "%.2d", 135); EXPECT_EQ(written, 3); ASSERT_STREQ(buff, "135"); // Flag Tests. - written = __llvm_libc::sprintf(buff, "%.5d", -321); + written = LIBC_NAMESPACE::sprintf(buff, "%.5d", -321); EXPECT_EQ(written, 6); ASSERT_STREQ(buff, "-00321"); - written = __llvm_libc::sprintf(buff, "%-5d", 246); + written = LIBC_NAMESPACE::sprintf(buff, "%-5d", 246); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "246 "); - written = __llvm_libc::sprintf(buff, "%-5d", -147); + written = LIBC_NAMESPACE::sprintf(buff, "%-5d", -147); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "-147 "); - written = __llvm_libc::sprintf(buff, "%+d", 258); + written = LIBC_NAMESPACE::sprintf(buff, "%+d", 258); EXPECT_EQ(written, 4); ASSERT_STREQ(buff, "+258"); - written = __llvm_libc::sprintf(buff, "% d", 369); + written = LIBC_NAMESPACE::sprintf(buff, "% d", 369); EXPECT_EQ(written, 4); ASSERT_STREQ(buff, " 369"); - written = __llvm_libc::sprintf(buff, "%05d", 470); + written = LIBC_NAMESPACE::sprintf(buff, "%05d", 470); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "00470"); - written = __llvm_libc::sprintf(buff, "%05d", -581); + written = LIBC_NAMESPACE::sprintf(buff, "%05d", -581); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "-0581"); // Combined Tests. - written = __llvm_libc::sprintf(buff, "%+ u", 692); + written = LIBC_NAMESPACE::sprintf(buff, "%+ u", 692); EXPECT_EQ(written, 3); ASSERT_STREQ(buff, "692"); - written = __llvm_libc::sprintf(buff, "%+ -05d", 703); + written = LIBC_NAMESPACE::sprintf(buff, "%+ -05d", 703); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "+703 "); - written = __llvm_libc::sprintf(buff, "%7.5d", 814); + written = LIBC_NAMESPACE::sprintf(buff, "%7.5d", 814); EXPECT_EQ(written, 7); ASSERT_STREQ(buff, " 00814"); - written = __llvm_libc::sprintf(buff, "%7.5d", -925); + written = LIBC_NAMESPACE::sprintf(buff, "%7.5d", -925); EXPECT_EQ(written, 7); ASSERT_STREQ(buff, " -00925"); - written = __llvm_libc::sprintf(buff, "%7.5d", 159); + written = LIBC_NAMESPACE::sprintf(buff, "%7.5d", 159); EXPECT_EQ(written, 7); ASSERT_STREQ(buff, " 00159"); - written = __llvm_libc::sprintf(buff, "% -7.5d", 260); + written = LIBC_NAMESPACE::sprintf(buff, "% -7.5d", 260); EXPECT_EQ(written, 7); ASSERT_STREQ(buff, " 00260 "); - written = __llvm_libc::sprintf(buff, "%5.4d", 10000); + written = LIBC_NAMESPACE::sprintf(buff, "%5.4d", 10000); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "10000"); // Multiple Conversion Tests. - written = __llvm_libc::sprintf(buff, "%10d %-10d", 456, -789); + written = LIBC_NAMESPACE::sprintf(buff, "%10d %-10d", 456, -789); EXPECT_EQ(written, 21); ASSERT_STREQ(buff, " 456 -789 "); - written = __llvm_libc::sprintf(buff, "%-5.4d%+.4u", 75, 25); + written = LIBC_NAMESPACE::sprintf(buff, "%-5.4d%+.4u", 75, 25); EXPECT_EQ(written, 9); ASSERT_STREQ(buff, "0075 0025"); - written = __llvm_libc::sprintf(buff, "% 05hhi %+-0.5llu %-+ 06.3zd", - 256 + 127, 68719476736ll, size_t(2)); + written = LIBC_NAMESPACE::sprintf(buff, "% 05hhi %+-0.5llu %-+ 06.3zd", + 256 + 127, 68719476736ll, size_t(2)); EXPECT_EQ(written, 24); ASSERT_STREQ(buff, " 0127 68719476736 +002 "); } @@ -263,25 +264,25 @@ TEST(LlvmLibcSPrintfTest, HexConv) { // Basic Tests. - written = __llvm_libc::sprintf(buff, "%x", 0x123a); + written = LIBC_NAMESPACE::sprintf(buff, "%x", 0x123a); EXPECT_EQ(written, 4); ASSERT_STREQ(buff, "123a"); - written = __llvm_libc::sprintf(buff, "%X", 0x456b); + written = LIBC_NAMESPACE::sprintf(buff, "%X", 0x456b); EXPECT_EQ(written, 4); ASSERT_STREQ(buff, "456B"); // Length Modifier Tests. - written = __llvm_libc::sprintf(buff, "%hhx", 0x10001); + written = LIBC_NAMESPACE::sprintf(buff, "%hhx", 0x10001); EXPECT_EQ(written, 1); ASSERT_STREQ(buff, "1"); - written = __llvm_libc::sprintf(buff, "%llx", 0xffffffffffffffffull); + written = LIBC_NAMESPACE::sprintf(buff, "%llx", 0xffffffffffffffffull); EXPECT_EQ(written, 16); ASSERT_STREQ(buff, "ffffffffffffffff"); // ull max - written = __llvm_libc::sprintf(buff, "%tX", ~ptrdiff_t(0)); + written = LIBC_NAMESPACE::sprintf(buff, "%tX", ~ptrdiff_t(0)); if (sizeof(ptrdiff_t) == 8) { EXPECT_EQ(written, 16); ASSERT_STREQ(buff, "FFFFFFFFFFFFFFFF"); @@ -292,92 +293,92 @@ TEST(LlvmLibcSPrintfTest, HexConv) { // Min Width Tests. - written = __llvm_libc::sprintf(buff, "%4x", 0x789); + written = LIBC_NAMESPACE::sprintf(buff, "%4x", 0x789); EXPECT_EQ(written, 4); ASSERT_STREQ(buff, " 789"); - written = __llvm_libc::sprintf(buff, "%2X", 0x987); + written = LIBC_NAMESPACE::sprintf(buff, "%2X", 0x987); EXPECT_EQ(written, 3); ASSERT_STREQ(buff, "987"); // Precision Tests. - written = __llvm_libc::sprintf(buff, "%x", 0); + written = LIBC_NAMESPACE::sprintf(buff, "%x", 0); EXPECT_EQ(written, 1); ASSERT_STREQ(buff, "0"); - written = __llvm_libc::sprintf(buff, "%.0x", 0); + written = LIBC_NAMESPACE::sprintf(buff, "%.0x", 0); EXPECT_EQ(written, 0); ASSERT_STREQ(buff, ""); - written = __llvm_libc::sprintf(buff, "%.5x", 0x1F3); + written = LIBC_NAMESPACE::sprintf(buff, "%.5x", 0x1F3); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "001f3"); - written = __llvm_libc::sprintf(buff, "%.2x", 0x135); + written = LIBC_NAMESPACE::sprintf(buff, "%.2x", 0x135); EXPECT_EQ(written, 3); ASSERT_STREQ(buff, "135"); // Flag Tests. - written = __llvm_libc::sprintf(buff, "%-5x", 0x246); + written = LIBC_NAMESPACE::sprintf(buff, "%-5x", 0x246); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "246 "); - written = __llvm_libc::sprintf(buff, "%#x", 0xd3f); + written = LIBC_NAMESPACE::sprintf(buff, "%#x", 0xd3f); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "0xd3f"); - written = __llvm_libc::sprintf(buff, "%#X", 0xE40); + written = LIBC_NAMESPACE::sprintf(buff, "%#X", 0xE40); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "0XE40"); - written = __llvm_libc::sprintf(buff, "%05x", 0x470); + written = LIBC_NAMESPACE::sprintf(buff, "%05x", 0x470); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "00470"); - written = __llvm_libc::sprintf(buff, "%0#6x", 0x8c3); + written = LIBC_NAMESPACE::sprintf(buff, "%0#6x", 0x8c3); EXPECT_EQ(written, 6); ASSERT_STREQ(buff, "0x08c3"); - written = __llvm_libc::sprintf(buff, "%-#6x", 0x5f0); + written = LIBC_NAMESPACE::sprintf(buff, "%-#6x", 0x5f0); EXPECT_EQ(written, 6); ASSERT_STREQ(buff, "0x5f0 "); // Combined Tests. - written = __llvm_libc::sprintf(buff, "%#-07x", 0x703); + written = LIBC_NAMESPACE::sprintf(buff, "%#-07x", 0x703); EXPECT_EQ(written, 7); ASSERT_STREQ(buff, "0x703 "); - written = __llvm_libc::sprintf(buff, "%7.5x", 0x814); + written = LIBC_NAMESPACE::sprintf(buff, "%7.5x", 0x814); EXPECT_EQ(written, 7); ASSERT_STREQ(buff, " 00814"); - written = __llvm_libc::sprintf(buff, "%#9.5X", 0x9d4); + written = LIBC_NAMESPACE::sprintf(buff, "%#9.5X", 0x9d4); EXPECT_EQ(written, 9); ASSERT_STREQ(buff, " 0X009D4"); - written = __llvm_libc::sprintf(buff, "%-7.5x", 0x260); + written = LIBC_NAMESPACE::sprintf(buff, "%-7.5x", 0x260); EXPECT_EQ(written, 7); ASSERT_STREQ(buff, "00260 "); - written = __llvm_libc::sprintf(buff, "%5.4x", 0x10000); + written = LIBC_NAMESPACE::sprintf(buff, "%5.4x", 0x10000); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "10000"); // Multiple Conversion Tests. - written = __llvm_libc::sprintf(buff, "%10X %-#10x", 0x45b, 0x789); + written = LIBC_NAMESPACE::sprintf(buff, "%10X %-#10x", 0x45b, 0x789); EXPECT_EQ(written, 21); ASSERT_STREQ(buff, " 45B 0x789 "); - written = __llvm_libc::sprintf(buff, "%-5.4x%#.4x", 0x75, 0x25); + written = LIBC_NAMESPACE::sprintf(buff, "%-5.4x%#.4x", 0x75, 0x25); EXPECT_EQ(written, 11); ASSERT_STREQ(buff, "0075 0x0025"); - written = __llvm_libc::sprintf(buff, "%04hhX %#.5llx %-6.3zX", 256 + 0x7f, - 0x1000000000ll, size_t(2)); + written = LIBC_NAMESPACE::sprintf(buff, "%04hhX %#.5llx %-6.3zX", 256 + 0x7f, + 0x1000000000ll, size_t(2)); EXPECT_EQ(written, 24); ASSERT_STREQ(buff, "007F 0x1000000000 002 "); } @@ -386,46 +387,46 @@ TEST(LlvmLibcSPrintfTest, PointerConv) { char buff[64]; int written; - written = __llvm_libc::sprintf(buff, "%p", nullptr); + written = LIBC_NAMESPACE::sprintf(buff, "%p", nullptr); EXPECT_EQ(written, 9); ASSERT_STREQ(buff, "(nullptr)"); - written = __llvm_libc::sprintf(buff, "%p", 0x1a2b3c4d); + written = LIBC_NAMESPACE::sprintf(buff, "%p", 0x1a2b3c4d); EXPECT_EQ(written, 10); ASSERT_STREQ(buff, "0x1a2b3c4d"); if constexpr (sizeof(void *) > 4) { - written = __llvm_libc::sprintf(buff, "%p", 0x1a2b3c4d5e6f7081); + written = LIBC_NAMESPACE::sprintf(buff, "%p", 0x1a2b3c4d5e6f7081); EXPECT_EQ(written, 18); ASSERT_STREQ(buff, "0x1a2b3c4d5e6f7081"); } - written = __llvm_libc::sprintf(buff, "%p", buff); + written = LIBC_NAMESPACE::sprintf(buff, "%p", buff); EXPECT_GT(written, 0); // Width tests: - written = __llvm_libc::sprintf(buff, "%20p", nullptr); + written = LIBC_NAMESPACE::sprintf(buff, "%20p", nullptr); EXPECT_EQ(written, 20); ASSERT_STREQ(buff, " (nullptr)"); - written = __llvm_libc::sprintf(buff, "%20p", 0x1a2b3c4d); + written = LIBC_NAMESPACE::sprintf(buff, "%20p", 0x1a2b3c4d); EXPECT_EQ(written, 20); ASSERT_STREQ(buff, " 0x1a2b3c4d"); // Flag tests: - written = __llvm_libc::sprintf(buff, "%-20p", nullptr); + written = LIBC_NAMESPACE::sprintf(buff, "%-20p", nullptr); EXPECT_EQ(written, 20); ASSERT_STREQ(buff, "(nullptr) "); - written = __llvm_libc::sprintf(buff, "%-20p", 0x1a2b3c4d); + written = LIBC_NAMESPACE::sprintf(buff, "%-20p", 0x1a2b3c4d); EXPECT_EQ(written, 20); ASSERT_STREQ(buff, "0x1a2b3c4d "); // Using the 0 flag is technically undefined, but here we're following the // convention of matching the behavior of %#x. - written = __llvm_libc::sprintf(buff, "%020p", 0x1a2b3c4d); + written = LIBC_NAMESPACE::sprintf(buff, "%020p", 0x1a2b3c4d); EXPECT_EQ(written, 20); ASSERT_STREQ(buff, "0x00000000001a2b3c4d"); @@ -433,13 +434,13 @@ TEST(LlvmLibcSPrintfTest, PointerConv) { // These are all undefined behavior. The precision option is undefined for %p. // Precision specifies the number of characters for a string conversion. - written = __llvm_libc::sprintf(buff, "%.5p", nullptr); + written = LIBC_NAMESPACE::sprintf(buff, "%.5p", nullptr); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "(null"); // Precision specifies the number of digits to be written for %x conversions, // and the "0x" doesn't count as part of the digits. - written = __llvm_libc::sprintf(buff, "%.20p", 0x1a2b3c4d); + written = LIBC_NAMESPACE::sprintf(buff, "%.20p", 0x1a2b3c4d); EXPECT_EQ(written, 22); ASSERT_STREQ(buff, "0x0000000000001a2b3c4d"); } @@ -450,25 +451,25 @@ TEST(LlvmLibcSPrintfTest, OctConv) { // Basic Tests. - written = __llvm_libc::sprintf(buff, "%o", 01234); + written = LIBC_NAMESPACE::sprintf(buff, "%o", 01234); EXPECT_EQ(written, 4); ASSERT_STREQ(buff, "1234"); - written = __llvm_libc::sprintf(buff, "%o", 04567); + written = LIBC_NAMESPACE::sprintf(buff, "%o", 04567); EXPECT_EQ(written, 4); ASSERT_STREQ(buff, "4567"); // Length Modifier Tests. - written = __llvm_libc::sprintf(buff, "%hho", 0401); + written = LIBC_NAMESPACE::sprintf(buff, "%hho", 0401); EXPECT_EQ(written, 1); ASSERT_STREQ(buff, "1"); - written = __llvm_libc::sprintf(buff, "%llo", 01777777777777777777777ull); + written = LIBC_NAMESPACE::sprintf(buff, "%llo", 01777777777777777777777ull); EXPECT_EQ(written, 22); ASSERT_STREQ(buff, "1777777777777777777777"); // ull max - written = __llvm_libc::sprintf(buff, "%to", ~ptrdiff_t(0)); + written = LIBC_NAMESPACE::sprintf(buff, "%to", ~ptrdiff_t(0)); if (sizeof(ptrdiff_t) == 8) { EXPECT_EQ(written, 22); ASSERT_STREQ(buff, "1777777777777777777777"); @@ -479,88 +480,88 @@ TEST(LlvmLibcSPrintfTest, OctConv) { // Min Width Tests. - written = __llvm_libc::sprintf(buff, "%4o", 0701); + written = LIBC_NAMESPACE::sprintf(buff, "%4o", 0701); EXPECT_EQ(written, 4); ASSERT_STREQ(buff, " 701"); - written = __llvm_libc::sprintf(buff, "%2o", 0107); + written = LIBC_NAMESPACE::sprintf(buff, "%2o", 0107); EXPECT_EQ(written, 3); ASSERT_STREQ(buff, "107"); // Precision Tests. - written = __llvm_libc::sprintf(buff, "%o", 0); + written = LIBC_NAMESPACE::sprintf(buff, "%o", 0); EXPECT_EQ(written, 1); ASSERT_STREQ(buff, "0"); - written = __llvm_libc::sprintf(buff, "%.0o", 0); + written = LIBC_NAMESPACE::sprintf(buff, "%.0o", 0); EXPECT_EQ(written, 0); ASSERT_STREQ(buff, ""); - written = __llvm_libc::sprintf(buff, "%.5o", 0153); + written = LIBC_NAMESPACE::sprintf(buff, "%.5o", 0153); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "00153"); - written = __llvm_libc::sprintf(buff, "%.2o", 0135); + written = LIBC_NAMESPACE::sprintf(buff, "%.2o", 0135); EXPECT_EQ(written, 3); ASSERT_STREQ(buff, "135"); // Flag Tests. - written = __llvm_libc::sprintf(buff, "%-5o", 0246); + written = LIBC_NAMESPACE::sprintf(buff, "%-5o", 0246); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "246 "); - written = __llvm_libc::sprintf(buff, "%#o", 0234); + written = LIBC_NAMESPACE::sprintf(buff, "%#o", 0234); EXPECT_EQ(written, 4); ASSERT_STREQ(buff, "0234"); - written = __llvm_libc::sprintf(buff, "%05o", 0470); + written = LIBC_NAMESPACE::sprintf(buff, "%05o", 0470); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "00470"); - written = __llvm_libc::sprintf(buff, "%0#6o", 0753); + written = LIBC_NAMESPACE::sprintf(buff, "%0#6o", 0753); EXPECT_EQ(written, 6); ASSERT_STREQ(buff, "000753"); - written = __llvm_libc::sprintf(buff, "%-#6o", 0642); + written = LIBC_NAMESPACE::sprintf(buff, "%-#6o", 0642); EXPECT_EQ(written, 6); ASSERT_STREQ(buff, "0642 "); // Combined Tests. - written = __llvm_libc::sprintf(buff, "%#-07o", 0703); + written = LIBC_NAMESPACE::sprintf(buff, "%#-07o", 0703); EXPECT_EQ(written, 7); ASSERT_STREQ(buff, "0703 "); - written = __llvm_libc::sprintf(buff, "%7.5o", 0314); + written = LIBC_NAMESPACE::sprintf(buff, "%7.5o", 0314); EXPECT_EQ(written, 7); ASSERT_STREQ(buff, " 00314"); - written = __llvm_libc::sprintf(buff, "%#9.5o", 0234); + written = LIBC_NAMESPACE::sprintf(buff, "%#9.5o", 0234); EXPECT_EQ(written, 9); ASSERT_STREQ(buff, " 00234"); - written = __llvm_libc::sprintf(buff, "%-7.5o", 0260); + written = LIBC_NAMESPACE::sprintf(buff, "%-7.5o", 0260); EXPECT_EQ(written, 7); ASSERT_STREQ(buff, "00260 "); - written = __llvm_libc::sprintf(buff, "%5.4o", 010000); + written = LIBC_NAMESPACE::sprintf(buff, "%5.4o", 010000); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "10000"); // Multiple Conversion Tests. - written = __llvm_libc::sprintf(buff, "%10o %-#10o", 0456, 0123); + written = LIBC_NAMESPACE::sprintf(buff, "%10o %-#10o", 0456, 0123); EXPECT_EQ(written, 21); ASSERT_STREQ(buff, " 456 0123 "); - written = __llvm_libc::sprintf(buff, "%-5.4o%#.4o", 075, 025); + written = LIBC_NAMESPACE::sprintf(buff, "%-5.4o%#.4o", 075, 025); EXPECT_EQ(written, 9); ASSERT_STREQ(buff, "0075 0025"); - written = __llvm_libc::sprintf(buff, "%04hho %#.5llo %-6.3zo", 256 + 077, - 01000000000000ll, size_t(2)); + written = LIBC_NAMESPACE::sprintf(buff, "%04hho %#.5llo %-6.3zo", 256 + 077, + 01000000000000ll, size_t(2)); EXPECT_EQ(written, 26); ASSERT_STREQ(buff, "0077 01000000000000 002 "); } @@ -569,64 +570,64 @@ TEST(LlvmLibcSPrintfTest, OctConv) { TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) { ForceRoundingMode r(RoundingMode::Nearest); - double inf = __llvm_libc::fputil::FPBits<double>::inf().get_val(); - double nan = __llvm_libc::fputil::FPBits<double>::build_nan(1); + double inf = LIBC_NAMESPACE::fputil::FPBits<double>::inf().get_val(); + double nan = LIBC_NAMESPACE::fputil::FPBits<double>::build_nan(1); - written = __llvm_libc::sprintf(buff, "%a", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%a", 1.0); ASSERT_STREQ_LEN(written, buff, "0x1p+0"); - written = __llvm_libc::sprintf(buff, "%A", -1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%A", -1.0); ASSERT_STREQ_LEN(written, buff, "-0X1P+0"); - written = __llvm_libc::sprintf(buff, "%a", -0x1.abcdef12345p0); + written = LIBC_NAMESPACE::sprintf(buff, "%a", -0x1.abcdef12345p0); ASSERT_STREQ_LEN(written, buff, "-0x1.abcdef12345p+0"); - written = __llvm_libc::sprintf(buff, "%A", 0x1.abcdef12345p0); + written = LIBC_NAMESPACE::sprintf(buff, "%A", 0x1.abcdef12345p0); ASSERT_STREQ_LEN(written, buff, "0X1.ABCDEF12345P+0"); - written = __llvm_libc::sprintf(buff, "%a", 0.0); + written = LIBC_NAMESPACE::sprintf(buff, "%a", 0.0); ASSERT_STREQ_LEN(written, buff, "0x0p+0"); - written = __llvm_libc::sprintf(buff, "%a", 1.0e100); + written = LIBC_NAMESPACE::sprintf(buff, "%a", 1.0e100); ASSERT_STREQ_LEN(written, buff, "0x1.249ad2594c37dp+332"); - written = __llvm_libc::sprintf(buff, "%a", 0.1); + written = LIBC_NAMESPACE::sprintf(buff, "%a", 0.1); ASSERT_STREQ_LEN(written, buff, "0x1.999999999999ap-4"); // Subnormal Tests. - written = __llvm_libc::sprintf(buff, "%a", 0x1.0p-1027); + written = LIBC_NAMESPACE::sprintf(buff, "%a", 0x1.0p-1027); ASSERT_STREQ_LEN(written, buff, "0x0.08p-1022"); - written = __llvm_libc::sprintf(buff, "%a", 0x1.0p-1025); + written = LIBC_NAMESPACE::sprintf(buff, "%a", 0x1.0p-1025); ASSERT_STREQ_LEN(written, buff, "0x0.2p-1022"); - written = __llvm_libc::sprintf(buff, "%a", 0x1.0p-1023); + written = LIBC_NAMESPACE::sprintf(buff, "%a", 0x1.0p-1023); ASSERT_STREQ_LEN(written, buff, "0x0.8p-1022"); - written = __llvm_libc::sprintf(buff, "%a", 0x1.0p-1022); + written = LIBC_NAMESPACE::sprintf(buff, "%a", 0x1.0p-1022); ASSERT_STREQ_LEN(written, buff, "0x1p-1022"); - written = __llvm_libc::sprintf(buff, "%a", 0x1.0p-1074); + written = LIBC_NAMESPACE::sprintf(buff, "%a", 0x1.0p-1074); ASSERT_STREQ_LEN(written, buff, "0x0.0000000000001p-1022"); // Inf/Nan Tests. - written = __llvm_libc::sprintf(buff, "%a", inf); + written = LIBC_NAMESPACE::sprintf(buff, "%a", inf); ASSERT_STREQ_LEN(written, buff, "inf"); - written = __llvm_libc::sprintf(buff, "%A", -inf); + written = LIBC_NAMESPACE::sprintf(buff, "%A", -inf); ASSERT_STREQ_LEN(written, buff, "-INF"); - written = __llvm_libc::sprintf(buff, "%a", nan); + written = LIBC_NAMESPACE::sprintf(buff, "%a", nan); ASSERT_STREQ_LEN(written, buff, "nan"); - written = __llvm_libc::sprintf(buff, "%A", -nan); + written = LIBC_NAMESPACE::sprintf(buff, "%A", -nan); ASSERT_STREQ_LEN(written, buff, "-NAN"); // Length Modifier Tests. - written = __llvm_libc::sprintf(buff, "%La", 0.1L); + written = LIBC_NAMESPACE::sprintf(buff, "%La", 0.1L); #if defined(SPECIAL_X86_LONG_DOUBLE) ASSERT_STREQ_LEN(written, buff, "0xc.ccccccccccccccdp-7"); #elif defined(LONG_DOUBLE_IS_DOUBLE) @@ -635,7 +636,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) { ASSERT_STREQ_LEN(written, buff, "0x1.999999999999999999999999999ap-4"); #endif - written = __llvm_libc::sprintf(buff, "%La", 1.0e1000L); + written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e1000L); #if defined(SPECIAL_X86_LONG_DOUBLE) ASSERT_STREQ_LEN(written, buff, "0xf.38db1f9dd3dac05p+3318"); #elif defined(LONG_DOUBLE_IS_DOUBLE) @@ -644,7 +645,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) { ASSERT_STREQ_LEN(written, buff, "0x1.e71b63f3ba7b580af1a52d2a7379p+3321"); #endif - written = __llvm_libc::sprintf(buff, "%La", 1.0e-1000L); + written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e-1000L); #if defined(SPECIAL_X86_LONG_DOUBLE) ASSERT_STREQ_LEN(written, buff, "0x8.68a9188a89e1467p-3325"); #elif defined(LONG_DOUBLE_IS_DOUBLE) @@ -655,99 +656,99 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) { // Min Width Tests. - written = __llvm_libc::sprintf(buff, "%15a", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%15a", 1.0); ASSERT_STREQ_LEN(written, buff, " 0x1p+0"); - written = __llvm_libc::sprintf(buff, "%15a", -1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%15a", -1.0); ASSERT_STREQ_LEN(written, buff, " -0x1p+0"); - written = __llvm_libc::sprintf(buff, "%15a", 1.0e10); + written = LIBC_NAMESPACE::sprintf(buff, "%15a", 1.0e10); ASSERT_STREQ_LEN(written, buff, " 0x1.2a05f2p+33"); - written = __llvm_libc::sprintf(buff, "%15a", -1.0e10); + written = LIBC_NAMESPACE::sprintf(buff, "%15a", -1.0e10); ASSERT_STREQ_LEN(written, buff, "-0x1.2a05f2p+33"); - written = __llvm_libc::sprintf(buff, "%10a", 1.0e10); + written = LIBC_NAMESPACE::sprintf(buff, "%10a", 1.0e10); ASSERT_STREQ_LEN(written, buff, "0x1.2a05f2p+33"); - written = __llvm_libc::sprintf(buff, "%5a", inf); + written = LIBC_NAMESPACE::sprintf(buff, "%5a", inf); ASSERT_STREQ_LEN(written, buff, " inf"); - written = __llvm_libc::sprintf(buff, "%5a", -nan); + written = LIBC_NAMESPACE::sprintf(buff, "%5a", -nan); ASSERT_STREQ_LEN(written, buff, " -nan"); // Precision Tests. - written = __llvm_libc::sprintf(buff, "%.1a", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 1.0); ASSERT_STREQ_LEN(written, buff, "0x1.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0.0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0.0); ASSERT_STREQ_LEN(written, buff, "0x0.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0.1); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0.1); ASSERT_STREQ_LEN(written, buff, "0x1.ap-4"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.0fp0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.0fp0); ASSERT_STREQ_LEN(written, buff, "0x1.1p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.07p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.07p0); ASSERT_STREQ_LEN(written, buff, "0x1.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.08p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.08p0); ASSERT_STREQ_LEN(written, buff, "0x1.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.18p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.18p0); ASSERT_STREQ_LEN(written, buff, "0x1.2p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.ffp0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.ffp0); ASSERT_STREQ_LEN(written, buff, "0x2.0p+0"); - written = __llvm_libc::sprintf(buff, "%.5a", 1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.5a", 1.25); ASSERT_STREQ_LEN(written, buff, "0x1.40000p+0"); - written = __llvm_libc::sprintf(buff, "%.0a", 1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.0a", 1.25); ASSERT_STREQ_LEN(written, buff, "0x1p+0"); - written = __llvm_libc::sprintf(buff, "%.0a", 1.75); + written = LIBC_NAMESPACE::sprintf(buff, "%.0a", 1.75); ASSERT_STREQ_LEN(written, buff, "0x2p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.0p-1023); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.0p-1023); ASSERT_STREQ_LEN(written, buff, "0x0.8p-1022"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.8p-1023); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.8p-1023); ASSERT_STREQ_LEN(written, buff, "0x0.cp-1022"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.0p-1024); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.0p-1024); ASSERT_STREQ_LEN(written, buff, "0x0.4p-1022"); - written = __llvm_libc::sprintf(buff, "%.0a", 0x1.0p-1023); + written = LIBC_NAMESPACE::sprintf(buff, "%.0a", 0x1.0p-1023); ASSERT_STREQ_LEN(written, buff, "0x0p-1022"); - written = __llvm_libc::sprintf(buff, "%.0a", 0x1.8p-1023); + written = LIBC_NAMESPACE::sprintf(buff, "%.0a", 0x1.8p-1023); ASSERT_STREQ_LEN(written, buff, "0x1p-1022"); - written = __llvm_libc::sprintf(buff, "%.0a", 0x1.0p-1024); + written = LIBC_NAMESPACE::sprintf(buff, "%.0a", 0x1.0p-1024); ASSERT_STREQ_LEN(written, buff, "0x0p-1022"); - written = __llvm_libc::sprintf(buff, "%.2a", 0x1.0p-1027); + written = LIBC_NAMESPACE::sprintf(buff, "%.2a", 0x1.0p-1027); ASSERT_STREQ_LEN(written, buff, "0x0.08p-1022"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.0p-1027); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.0p-1027); ASSERT_STREQ_LEN(written, buff, "0x0.0p-1022"); - written = __llvm_libc::sprintf(buff, "%.5a", 0.0); + written = LIBC_NAMESPACE::sprintf(buff, "%.5a", 0.0); ASSERT_STREQ_LEN(written, buff, "0x0.00000p+0"); - written = __llvm_libc::sprintf(buff, "%.5a", 0x1.008p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.5a", 0x1.008p0); ASSERT_STREQ_LEN(written, buff, "0x1.00800p+0"); - written = __llvm_libc::sprintf(buff, "%.5a", 0x1.008p10); + written = LIBC_NAMESPACE::sprintf(buff, "%.5a", 0x1.008p10); ASSERT_STREQ_LEN(written, buff, "0x1.00800p+10"); - written = __llvm_libc::sprintf(buff, "%.5a", nan); + written = LIBC_NAMESPACE::sprintf(buff, "%.5a", nan); ASSERT_STREQ_LEN(written, buff, "nan"); - written = __llvm_libc::sprintf(buff, "%.1La", 0.1L); + written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0.1L); #if defined(SPECIAL_X86_LONG_DOUBLE) ASSERT_STREQ_LEN(written, buff, "0xc.dp-7"); #elif defined(LONG_DOUBLE_IS_DOUBLE) @@ -756,7 +757,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) { ASSERT_STREQ_LEN(written, buff, "0x1.ap-4"); #endif - written = __llvm_libc::sprintf(buff, "%.1La", 0xf.fffffffffffffffp16380L); + written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0xf.fffffffffffffffp16380L); #if defined(SPECIAL_X86_LONG_DOUBLE) ASSERT_STREQ_LEN(written, buff, "0x1.0p+16384"); #elif defined(LONG_DOUBLE_IS_DOUBLE) @@ -768,162 +769,162 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) { // Rounding Mode Tests. if (ForceRoundingMode r(RoundingMode::Nearest); r.success) { - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.08p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.08p0); ASSERT_STREQ_LEN(written, buff, "0x1.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.18p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.18p0); ASSERT_STREQ_LEN(written, buff, "0x1.2p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.04p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.04p0); ASSERT_STREQ_LEN(written, buff, "0x1.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.14p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.14p0); ASSERT_STREQ_LEN(written, buff, "0x1.1p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.08p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.08p0); ASSERT_STREQ_LEN(written, buff, "-0x1.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.18p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.18p0); ASSERT_STREQ_LEN(written, buff, "-0x1.2p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.04p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.04p0); ASSERT_STREQ_LEN(written, buff, "-0x1.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.14p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.14p0); ASSERT_STREQ_LEN(written, buff, "-0x1.1p+0"); } if (ForceRoundingMode r(RoundingMode::Upward); r.success) { - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.08p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.08p0); ASSERT_STREQ_LEN(written, buff, "0x1.1p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.18p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.18p0); ASSERT_STREQ_LEN(written, buff, "0x1.2p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.04p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.04p0); ASSERT_STREQ_LEN(written, buff, "0x1.1p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.14p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.14p0); ASSERT_STREQ_LEN(written, buff, "0x1.2p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.08p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.08p0); ASSERT_STREQ_LEN(written, buff, "-0x1.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.18p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.18p0); ASSERT_STREQ_LEN(written, buff, "-0x1.1p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.04p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.04p0); ASSERT_STREQ_LEN(written, buff, "-0x1.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.14p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.14p0); ASSERT_STREQ_LEN(written, buff, "-0x1.1p+0"); } if (ForceRoundingMode r(RoundingMode::Downward); r.success) { - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.08p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.08p0); ASSERT_STREQ_LEN(written, buff, "0x1.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.18p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.18p0); ASSERT_STREQ_LEN(written, buff, "0x1.1p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.04p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.04p0); ASSERT_STREQ_LEN(written, buff, "0x1.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.14p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.14p0); ASSERT_STREQ_LEN(written, buff, "0x1.1p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.08p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.08p0); ASSERT_STREQ_LEN(written, buff, "-0x1.1p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.18p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.18p0); ASSERT_STREQ_LEN(written, buff, "-0x1.2p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.04p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.04p0); ASSERT_STREQ_LEN(written, buff, "-0x1.1p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.14p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.14p0); ASSERT_STREQ_LEN(written, buff, "-0x1.2p+0"); } if (ForceRoundingMode r(RoundingMode::TowardZero); r.success) { - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.08p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.08p0); ASSERT_STREQ_LEN(written, buff, "0x1.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.18p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.18p0); ASSERT_STREQ_LEN(written, buff, "0x1.1p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.04p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.04p0); ASSERT_STREQ_LEN(written, buff, "0x1.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.14p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.14p0); ASSERT_STREQ_LEN(written, buff, "0x1.1p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.08p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.08p0); ASSERT_STREQ_LEN(written, buff, "-0x1.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.18p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.18p0); ASSERT_STREQ_LEN(written, buff, "-0x1.1p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.04p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.04p0); ASSERT_STREQ_LEN(written, buff, "-0x1.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.14p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.14p0); ASSERT_STREQ_LEN(written, buff, "-0x1.1p+0"); } // Flag Tests. - written = __llvm_libc::sprintf(buff, "%+a", nan); + written = LIBC_NAMESPACE::sprintf(buff, "%+a", nan); ASSERT_STREQ_LEN(written, buff, "+nan"); - written = __llvm_libc::sprintf(buff, "% A", inf); + written = LIBC_NAMESPACE::sprintf(buff, "% A", inf); ASSERT_STREQ_LEN(written, buff, " INF"); - written = __llvm_libc::sprintf(buff, "%-5a", inf); + written = LIBC_NAMESPACE::sprintf(buff, "%-5a", inf); ASSERT_STREQ_LEN(written, buff, "inf "); - written = __llvm_libc::sprintf(buff, "%+-5A", nan); + written = LIBC_NAMESPACE::sprintf(buff, "%+-5A", nan); ASSERT_STREQ_LEN(written, buff, "+NAN "); - written = __llvm_libc::sprintf(buff, "%+a", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%+a", 1.0); ASSERT_STREQ_LEN(written, buff, "+0x1p+0"); - written = __llvm_libc::sprintf(buff, "% a", 0.0); + written = LIBC_NAMESPACE::sprintf(buff, "% a", 0.0); ASSERT_STREQ_LEN(written, buff, " 0x0p+0"); - written = __llvm_libc::sprintf(buff, "%-10a", 1.5); + written = LIBC_NAMESPACE::sprintf(buff, "%-10a", 1.5); ASSERT_STREQ_LEN(written, buff, "0x1.8p+0 "); - written = __llvm_libc::sprintf(buff, "%#a", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%#a", 1.0); ASSERT_STREQ_LEN(written, buff, "0x1.p+0"); - written = __llvm_libc::sprintf(buff, "%#.0a", 1.5); + written = LIBC_NAMESPACE::sprintf(buff, "%#.0a", 1.5); ASSERT_STREQ_LEN(written, buff, "0x2.p+0"); - written = __llvm_libc::sprintf(buff, "%010a", 1.5); + written = LIBC_NAMESPACE::sprintf(buff, "%010a", 1.5); ASSERT_STREQ_LEN(written, buff, "0x001.8p+0"); - written = __llvm_libc::sprintf(buff, "%+- #0a", 0.0); + written = LIBC_NAMESPACE::sprintf(buff, "%+- #0a", 0.0); ASSERT_STREQ_LEN(written, buff, "+0x0.p+0"); // Combined Tests. - written = __llvm_libc::sprintf(buff, "%12.3a %-12.3A", 0.1, 256.0); + written = LIBC_NAMESPACE::sprintf(buff, "%12.3a %-12.3A", 0.1, 256.0); ASSERT_STREQ_LEN(written, buff, " 0x1.99ap-4 0X1.000P+8 "); - written = __llvm_libc::sprintf(buff, "%+-#12.3a % 012.3a", 0.1256, 1256.0); + written = LIBC_NAMESPACE::sprintf(buff, "%+-#12.3a % 012.3a", 0.1256, 1256.0); ASSERT_STREQ_LEN(written, buff, "+0x1.014p-3 0x1.3a0p+10"); // These tests check that the padding is properly calculated based on the // min_width field. Specifically, they check that the extra zeroes added by // the high precision are accounted for correctly. - written = __llvm_libc::sprintf(buff, "%50.50a", 0x1.0p0); + written = LIBC_NAMESPACE::sprintf(buff, "%50.50a", 0x1.0p0); ASSERT_STREQ_LEN(written, buff, "0x1.00000000000000000000000000000000000000000000000000p+0"); // The difference with this test is that the formatted number is exactly 57 // characters, so padding to 58 adds a space. - written = __llvm_libc::sprintf(buff, "%58.50a", 0x1.0p0); + written = LIBC_NAMESPACE::sprintf(buff, "%58.50a", 0x1.0p0); ASSERT_STREQ_LEN( written, buff, " 0x1.00000000000000000000000000000000000000000000000000p+0"); @@ -931,28 +932,28 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) { TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { ForceRoundingMode r(RoundingMode::Nearest); - double inf = __llvm_libc::fputil::FPBits<double>::inf().get_val(); - double nan = __llvm_libc::fputil::FPBits<double>::build_nan(1); + double inf = LIBC_NAMESPACE::fputil::FPBits<double>::inf().get_val(); + double nan = LIBC_NAMESPACE::fputil::FPBits<double>::build_nan(1); char big_buff[10000]; // Used for long doubles and other extremely wide // numbers. - written = __llvm_libc::sprintf(buff, "%f", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%f", 1.0); ASSERT_STREQ_LEN(written, buff, "1.000000"); - written = __llvm_libc::sprintf(buff, "%F", -1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%F", -1.0); ASSERT_STREQ_LEN(written, buff, "-1.000000"); - written = __llvm_libc::sprintf(buff, "%f", -1.234567); + written = LIBC_NAMESPACE::sprintf(buff, "%f", -1.234567); ASSERT_STREQ_LEN(written, buff, "-1.234567"); - written = __llvm_libc::sprintf(buff, "%f", 0.0); + written = LIBC_NAMESPACE::sprintf(buff, "%f", 0.0); ASSERT_STREQ_LEN(written, buff, "0.000000"); - written = __llvm_libc::sprintf(buff, "%f", 1.5); + written = LIBC_NAMESPACE::sprintf(buff, "%f", 1.5); ASSERT_STREQ_LEN(written, buff, "1.500000"); - written = __llvm_libc::sprintf(buff, "%f", 1e300); + written = LIBC_NAMESPACE::sprintf(buff, "%f", 1e300); ASSERT_STREQ_LEN( written, buff, "100000000000000005250476025520442024870446858110815915491585411551180245" @@ -961,35 +962,35 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { "111903896764088007465274278014249457925878882005684283811566947219638686" "5459400540160.000000"); - written = __llvm_libc::sprintf(buff, "%f", 0.1); + written = LIBC_NAMESPACE::sprintf(buff, "%f", 0.1); ASSERT_STREQ_LEN(written, buff, "0.100000"); - written = __llvm_libc::sprintf(buff, "%f", 1234567890123456789.0); + written = LIBC_NAMESPACE::sprintf(buff, "%f", 1234567890123456789.0); ASSERT_STREQ_LEN(written, buff, "1234567890123456768.000000"); - written = __llvm_libc::sprintf(buff, "%f", 9999999999999.99); + written = LIBC_NAMESPACE::sprintf(buff, "%f", 9999999999999.99); ASSERT_STREQ_LEN(written, buff, "9999999999999.990234"); // Simple Subnormal Tests. - written = __llvm_libc::sprintf(buff, "%f", 0x1.0p-1027); + written = LIBC_NAMESPACE::sprintf(buff, "%f", 0x1.0p-1027); ASSERT_STREQ_LEN(written, buff, "0.000000"); - written = __llvm_libc::sprintf(buff, "%f", 0x1.0p-1074); + written = LIBC_NAMESPACE::sprintf(buff, "%f", 0x1.0p-1074); ASSERT_STREQ_LEN(written, buff, "0.000000"); // Inf/Nan Tests. - written = __llvm_libc::sprintf(buff, "%f", inf); + written = LIBC_NAMESPACE::sprintf(buff, "%f", inf); ASSERT_STREQ_LEN(written, buff, "inf"); - written = __llvm_libc::sprintf(buff, "%F", -inf); + written = LIBC_NAMESPACE::sprintf(buff, "%F", -inf); ASSERT_STREQ_LEN(written, buff, "-INF"); - written = __llvm_libc::sprintf(buff, "%f", nan); + written = LIBC_NAMESPACE::sprintf(buff, "%f", nan); ASSERT_STREQ_LEN(written, buff, "nan"); - written = __llvm_libc::sprintf(buff, "%F", -nan); + written = LIBC_NAMESPACE::sprintf(buff, "%F", -nan); ASSERT_STREQ_LEN(written, buff, "-NAN"); // Length Modifier Tests. @@ -999,17 +1000,17 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { // TODO(michaelrj): Fix the tests to only depend on the digits the long double // is accurate for. - written = __llvm_libc::sprintf(buff, "%Lf", 1.0L); + written = LIBC_NAMESPACE::sprintf(buff, "%Lf", 1.0L); ASSERT_STREQ_LEN(written, buff, "1.000000"); #if defined(SPECIAL_X86_LONG_DOUBLE) - written = __llvm_libc::sprintf(buff, "%Lf", 1e100L); + written = LIBC_NAMESPACE::sprintf(buff, "%Lf", 1e100L); ASSERT_STREQ_LEN(written, buff, "99999999999999999996693535322073426194986990198284960792713" "91541752018669482644324418977840117055488.000000"); - written = __llvm_libc::sprintf(big_buff, "%Lf", 1e1000L); + written = LIBC_NAMESPACE::sprintf(big_buff, "%Lf", 1e1000L); ASSERT_STREQ_LEN( written, big_buff, "999999999999999999973107317669562353428234857594552594925899449376328728" @@ -1028,7 +1029,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { "2431457550909271560663602154947063707982236377366647567795879936." "000000"); - written = __llvm_libc::sprintf(big_buff, "%Lf", 1e4900L); + written = LIBC_NAMESPACE::sprintf(big_buff, "%Lf", 1e4900L); ASSERT_STREQ_LEN( written, big_buff, "100000000000000000002708312230690349833224052504078834346502930111959028" @@ -1101,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<double>::inf().get_val(); - double nan = __llvm_libc::fputil::FPBits<double>::build_nan(1); + double inf = LIBC_NAMESPACE::fputil::FPBits<double>::inf().get_val(); + double nan = LIBC_NAMESPACE::fputil::FPBits<double>::build_nan(1); - written = __llvm_libc::sprintf(buff, "%e", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%e", 1.0); ASSERT_STREQ_LEN(written, buff, "1.000000e+00"); - written = __llvm_libc::sprintf(buff, "%E", -1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%E", -1.0); ASSERT_STREQ_LEN(written, buff, "-1.000000E+00"); - written = __llvm_libc::sprintf(buff, "%e", -1.234567); + written = LIBC_NAMESPACE::sprintf(buff, "%e", -1.234567); ASSERT_STREQ_LEN(written, buff, "-1.234567e+00"); - written = __llvm_libc::sprintf(buff, "%e", 0.0); + written = LIBC_NAMESPACE::sprintf(buff, "%e", 0.0); ASSERT_STREQ_LEN(written, buff, "0.000000e+00"); - written = __llvm_libc::sprintf(buff, "%e", 1.5); + written = LIBC_NAMESPACE::sprintf(buff, "%e", 1.5); ASSERT_STREQ_LEN(written, buff, "1.500000e+00"); - written = __llvm_libc::sprintf(buff, "%e", 1e300); + written = LIBC_NAMESPACE::sprintf(buff, "%e", 1e300); ASSERT_STREQ_LEN(written, buff, "1.000000e+300"); - written = __llvm_libc::sprintf(buff, "%e", 0.1); + written = LIBC_NAMESPACE::sprintf(buff, "%e", 0.1); ASSERT_STREQ_LEN(written, buff, "1.000000e-01"); - written = __llvm_libc::sprintf(buff, "%e", 0.001); + written = LIBC_NAMESPACE::sprintf(buff, "%e", 0.001); ASSERT_STREQ_LEN(written, buff, "1.000000e-03"); - written = __llvm_libc::sprintf(buff, "%e", 0.00001); + written = LIBC_NAMESPACE::sprintf(buff, "%e", 0.00001); ASSERT_STREQ_LEN(written, buff, "1.000000e-05"); - written = __llvm_libc::sprintf(buff, "%e", 0.0000001); + written = LIBC_NAMESPACE::sprintf(buff, "%e", 0.0000001); ASSERT_STREQ_LEN(written, buff, "1.000000e-07"); - written = __llvm_libc::sprintf(buff, "%e", 0.000000001); + written = LIBC_NAMESPACE::sprintf(buff, "%e", 0.000000001); ASSERT_STREQ_LEN(written, buff, "1.000000e-09"); - written = __llvm_libc::sprintf(buff, "%e", 1.0e-20); + written = LIBC_NAMESPACE::sprintf(buff, "%e", 1.0e-20); ASSERT_STREQ_LEN(written, buff, "1.000000e-20"); - written = __llvm_libc::sprintf(buff, "%e", 1234567890123456789.0); + written = LIBC_NAMESPACE::sprintf(buff, "%e", 1234567890123456789.0); ASSERT_STREQ_LEN(written, buff, "1.234568e+18"); - written = __llvm_libc::sprintf(buff, "%e", 9999999000000.00); + written = LIBC_NAMESPACE::sprintf(buff, "%e", 9999999000000.00); ASSERT_STREQ_LEN(written, buff, "9.999999e+12"); // Simple Subnormal Tests. - written = __llvm_libc::sprintf(buff, "%e", 0x1.0p-1027); + written = LIBC_NAMESPACE::sprintf(buff, "%e", 0x1.0p-1027); ASSERT_STREQ_LEN(written, buff, "6.953356e-310"); - written = __llvm_libc::sprintf(buff, "%e", 0x1.0p-1074); + written = LIBC_NAMESPACE::sprintf(buff, "%e", 0x1.0p-1074); ASSERT_STREQ_LEN(written, buff, "4.940656e-324"); // Inf/Nan Tests. - written = __llvm_libc::sprintf(buff, "%e", inf); + written = LIBC_NAMESPACE::sprintf(buff, "%e", inf); ASSERT_STREQ_LEN(written, buff, "inf"); - written = __llvm_libc::sprintf(buff, "%E", -inf); + written = LIBC_NAMESPACE::sprintf(buff, "%E", -inf); ASSERT_STREQ_LEN(written, buff, "-INF"); - written = __llvm_libc::sprintf(buff, "%e", nan); + written = LIBC_NAMESPACE::sprintf(buff, "%e", nan); ASSERT_STREQ_LEN(written, buff, "nan"); - written = __llvm_libc::sprintf(buff, "%E", -nan); + written = LIBC_NAMESPACE::sprintf(buff, "%E", -nan); ASSERT_STREQ_LEN(written, buff, "-NAN"); // Length Modifier Tests. #if defined(SPECIAL_X86_LONG_DOUBLE) - written = __llvm_libc::sprintf(buff, "%.9Le", 1000000000500000000.1L); + written = LIBC_NAMESPACE::sprintf(buff, "%.9Le", 1000000000500000000.1L); ASSERT_STREQ_LEN(written, buff, "1.000000001e+18"); - written = __llvm_libc::sprintf(buff, "%.9Le", 1000000000500000000.0L); + written = LIBC_NAMESPACE::sprintf(buff, "%.9Le", 1000000000500000000.0L); ASSERT_STREQ_LEN(written, buff, "1.000000000e+18"); - 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<double>::inf().get_val(); - double nan = __llvm_libc::fputil::FPBits<double>::build_nan(1); + double inf = LIBC_NAMESPACE::fputil::FPBits<double>::inf().get_val(); + double nan = LIBC_NAMESPACE::fputil::FPBits<double>::build_nan(1); - written = __llvm_libc::sprintf(buff, "%g", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%g", 1.0); ASSERT_STREQ_LEN(written, buff, "1"); - written = __llvm_libc::sprintf(buff, "%G", -1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%G", -1.0); ASSERT_STREQ_LEN(written, buff, "-1"); - written = __llvm_libc::sprintf(buff, "%g", -1.234567); + written = LIBC_NAMESPACE::sprintf(buff, "%g", -1.234567); ASSERT_STREQ_LEN(written, buff, "-1.23457"); - written = __llvm_libc::sprintf(buff, "%g", 0.0); + written = LIBC_NAMESPACE::sprintf(buff, "%g", 0.0); ASSERT_STREQ_LEN(written, buff, "0"); - written = __llvm_libc::sprintf(buff, "%g", -0.0); + written = LIBC_NAMESPACE::sprintf(buff, "%g", -0.0); ASSERT_STREQ_LEN(written, buff, "-0"); - written = __llvm_libc::sprintf(buff, "%g", 1.5); + written = LIBC_NAMESPACE::sprintf(buff, "%g", 1.5); ASSERT_STREQ_LEN(written, buff, "1.5"); - written = __llvm_libc::sprintf(buff, "%g", 1e300); + written = LIBC_NAMESPACE::sprintf(buff, "%g", 1e300); ASSERT_STREQ_LEN(written, buff, "1e+300"); - written = __llvm_libc::sprintf(buff, "%g", 0.1); + written = LIBC_NAMESPACE::sprintf(buff, "%g", 0.1); ASSERT_STREQ_LEN(written, buff, "0.1"); - written = __llvm_libc::sprintf(buff, "%g", 0.001); + written = LIBC_NAMESPACE::sprintf(buff, "%g", 0.001); ASSERT_STREQ_LEN(written, buff, "0.001"); - written = __llvm_libc::sprintf(buff, "%g", 0.00001); + written = LIBC_NAMESPACE::sprintf(buff, "%g", 0.00001); ASSERT_STREQ_LEN(written, buff, "1e-05"); - written = __llvm_libc::sprintf(buff, "%g", 0.0000001); + written = LIBC_NAMESPACE::sprintf(buff, "%g", 0.0000001); ASSERT_STREQ_LEN(written, buff, "1e-07"); - written = __llvm_libc::sprintf(buff, "%g", 0.000000001); + written = LIBC_NAMESPACE::sprintf(buff, "%g", 0.000000001); ASSERT_STREQ_LEN(written, buff, "1e-09"); - written = __llvm_libc::sprintf(buff, "%g", 1.0e-20); + written = LIBC_NAMESPACE::sprintf(buff, "%g", 1.0e-20); ASSERT_STREQ_LEN(written, buff, "1e-20"); - written = __llvm_libc::sprintf(buff, "%g", 1234567890123456789.0); + written = LIBC_NAMESPACE::sprintf(buff, "%g", 1234567890123456789.0); ASSERT_STREQ_LEN(written, buff, "1.23457e+18"); - written = __llvm_libc::sprintf(buff, "%g", 9999990000000.00); + written = LIBC_NAMESPACE::sprintf(buff, "%g", 9999990000000.00); ASSERT_STREQ_LEN(written, buff, "9.99999e+12"); - written = __llvm_libc::sprintf(buff, "%g", 9999999000000.00); + written = LIBC_NAMESPACE::sprintf(buff, "%g", 9999999000000.00); ASSERT_STREQ_LEN(written, buff, "1e+13"); // Simple Subnormal Tests. - written = __llvm_libc::sprintf(buff, "%g", 0x1.0p-1027); + written = LIBC_NAMESPACE::sprintf(buff, "%g", 0x1.0p-1027); ASSERT_STREQ_LEN(written, buff, "6.95336e-310"); - written = __llvm_libc::sprintf(buff, "%g", 0x1.0p-1074); + written = LIBC_NAMESPACE::sprintf(buff, "%g", 0x1.0p-1074); ASSERT_STREQ_LEN(written, buff, "4.94066e-324"); // Inf/Nan Tests. - written = __llvm_libc::sprintf(buff, "%g", inf); + written = LIBC_NAMESPACE::sprintf(buff, "%g", inf); ASSERT_STREQ_LEN(written, buff, "inf"); - written = __llvm_libc::sprintf(buff, "%G", -inf); + written = LIBC_NAMESPACE::sprintf(buff, "%G", -inf); ASSERT_STREQ_LEN(written, buff, "-INF"); - written = __llvm_libc::sprintf(buff, "%g", nan); + written = LIBC_NAMESPACE::sprintf(buff, "%g", nan); ASSERT_STREQ_LEN(written, buff, "nan"); - written = __llvm_libc::sprintf(buff, "%G", -nan); + written = LIBC_NAMESPACE::sprintf(buff, "%G", -nan); ASSERT_STREQ_LEN(written, buff, "-NAN"); // Length Modifier Tests. - 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 b6535df..8e0ad7d 100644 --- a/libc/test/src/stdio/sscanf_test.cpp +++ b/libc/test/src/stdio/sscanf_test.cpp @@ -21,16 +21,16 @@ TEST(LlvmLibcSScanfTest, SimpleStringConv) { int ret_val; char buffer[10]; char buffer2[10]; - ret_val = __llvm_libc::sscanf("abc123", "abc %s", buffer); + ret_val = LIBC_NAMESPACE::sscanf("abc123", "abc %s", buffer); ASSERT_EQ(ret_val, 1); ASSERT_STREQ(buffer, "123"); - ret_val = __llvm_libc::sscanf("abc123", "%3s %3s", buffer, buffer2); + ret_val = LIBC_NAMESPACE::sscanf("abc123", "%3s %3s", buffer, buffer2); ASSERT_EQ(ret_val, 2); ASSERT_STREQ(buffer, "abc"); ASSERT_STREQ(buffer2, "123"); - ret_val = __llvm_libc::sscanf("abc 123", "%3s%3s", buffer, buffer2); + ret_val = LIBC_NAMESPACE::sscanf("abc 123", "%3s%3s", buffer, buffer2); ASSERT_EQ(ret_val, 2); ASSERT_STREQ(buffer, "abc"); ASSERT_STREQ(buffer2, "123"); @@ -39,41 +39,41 @@ TEST(LlvmLibcSScanfTest, SimpleStringConv) { TEST(LlvmLibcSScanfTest, IntConvSimple) { int ret_val; int result = 0; - ret_val = __llvm_libc::sscanf("123", "%d", &result); + ret_val = LIBC_NAMESPACE::sscanf("123", "%d", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 123); - ret_val = __llvm_libc::sscanf("456", "%i", &result); + ret_val = LIBC_NAMESPACE::sscanf("456", "%i", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 456); - ret_val = __llvm_libc::sscanf("789", "%x", &result); + ret_val = LIBC_NAMESPACE::sscanf("789", "%x", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 0x789); - ret_val = __llvm_libc::sscanf("012", "%o", &result); + ret_val = LIBC_NAMESPACE::sscanf("012", "%o", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 012); - ret_val = __llvm_libc::sscanf("345", "%u", &result); + ret_val = LIBC_NAMESPACE::sscanf("345", "%u", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 345); // 288 characters - ret_val = __llvm_libc::sscanf("10000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000", - "%d", &result); - EXPECT_EQ(ret_val, 1); - EXPECT_EQ(result, int(__llvm_libc::cpp::numeric_limits<intmax_t>::max())); - - ret_val = __llvm_libc::sscanf("Not an integer", "%d", &result); + ret_val = LIBC_NAMESPACE::sscanf("10000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000", + "%d", &result); + EXPECT_EQ(ret_val, 1); + EXPECT_EQ(result, int(LIBC_NAMESPACE::cpp::numeric_limits<intmax_t>::max())); + + ret_val = LIBC_NAMESPACE::sscanf("Not an integer", "%d", &result); EXPECT_EQ(ret_val, 0); } @@ -83,33 +83,33 @@ TEST(LlvmLibcSScanfTest, IntConvLengthModifier) { int int_result = 0; char char_result = 0; - ret_val = __llvm_libc::sscanf("123", "%ju", &max_result); + ret_val = LIBC_NAMESPACE::sscanf("123", "%ju", &max_result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(max_result, uintmax_t(123)); // Check overflow handling - ret_val = __llvm_libc::sscanf("999999999999999999999999999999999999", "%ju", - &max_result); + ret_val = LIBC_NAMESPACE::sscanf("999999999999999999999999999999999999", + "%ju", &max_result); EXPECT_EQ(ret_val, 1); - EXPECT_EQ(max_result, __llvm_libc::cpp::numeric_limits<uintmax_t>::max()); + EXPECT_EQ(max_result, LIBC_NAMESPACE::cpp::numeric_limits<uintmax_t>::max()); // Because this is unsigned, any out of range value should return the maximum, // even with a negative sign. - ret_val = __llvm_libc::sscanf("-999999999999999999999999999999999999", "%ju", - &max_result); + ret_val = LIBC_NAMESPACE::sscanf("-999999999999999999999999999999999999", + "%ju", &max_result); EXPECT_EQ(ret_val, 1); - EXPECT_EQ(max_result, __llvm_libc::cpp::numeric_limits<uintmax_t>::max()); + EXPECT_EQ(max_result, LIBC_NAMESPACE::cpp::numeric_limits<uintmax_t>::max()); - ret_val = __llvm_libc::sscanf("-18446744073709551616", "%ju", &max_result); + ret_val = LIBC_NAMESPACE::sscanf("-18446744073709551616", "%ju", &max_result); EXPECT_EQ(ret_val, 1); - EXPECT_EQ(max_result, __llvm_libc::cpp::numeric_limits<uintmax_t>::max()); + EXPECT_EQ(max_result, LIBC_NAMESPACE::cpp::numeric_limits<uintmax_t>::max()); // But any number below the maximum should have the - sign applied. - ret_val = __llvm_libc::sscanf("-1", "%ju", &max_result); + ret_val = LIBC_NAMESPACE::sscanf("-1", "%ju", &max_result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(max_result, uintmax_t(-1)); - ret_val = __llvm_libc::sscanf("-1", "%u", &int_result); + ret_val = LIBC_NAMESPACE::sscanf("-1", "%u", &int_result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(int_result, -1); @@ -117,7 +117,7 @@ TEST(LlvmLibcSScanfTest, IntConvLengthModifier) { char_result = 0x6f; // Overflows for sizes larger than the maximum are handled by casting. - ret_val = __llvm_libc::sscanf("8589967360", "%d", &int_result); + ret_val = LIBC_NAMESPACE::sscanf("8589967360", "%d", &int_result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(int_result, int(8589967360)); // 2^33 + 2^15 @@ -125,13 +125,13 @@ TEST(LlvmLibcSScanfTest, IntConvLengthModifier) { ASSERT_EQ(max_result, uintmax_t(0xff00ff00ff00ff00)); ASSERT_EQ(char_result, char(0x6f)); - ret_val = __llvm_libc::sscanf("-8589967360", "%d", &int_result); + ret_val = LIBC_NAMESPACE::sscanf("-8589967360", "%d", &int_result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(int_result, int(-8589967360)); ASSERT_EQ(max_result, uintmax_t(0xff00ff00ff00ff00)); ASSERT_EQ(char_result, char(0x6f)); - ret_val = __llvm_libc::sscanf("25", "%hhd", &char_result); + ret_val = LIBC_NAMESPACE::sscanf("25", "%hhd", &char_result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(char_result, char(25)); } @@ -139,19 +139,19 @@ TEST(LlvmLibcSScanfTest, IntConvLengthModifier) { TEST(LlvmLibcSScanfTest, IntConvBaseSelection) { int ret_val; int result = 0; - ret_val = __llvm_libc::sscanf("0xabc123", "%i", &result); + ret_val = LIBC_NAMESPACE::sscanf("0xabc123", "%i", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 0xabc123); - ret_val = __llvm_libc::sscanf("0456", "%i", &result); + ret_val = LIBC_NAMESPACE::sscanf("0456", "%i", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 0456); - ret_val = __llvm_libc::sscanf("0999", "%i", &result); + ret_val = LIBC_NAMESPACE::sscanf("0999", "%i", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 0); - ret_val = __llvm_libc::sscanf("123abc456", "%i", &result); + ret_val = LIBC_NAMESPACE::sscanf("123abc456", "%i", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 123); } @@ -160,43 +160,43 @@ TEST(LlvmLibcSScanfTest, IntConvMaxLengthTests) { int ret_val; int result = 0; - ret_val = __llvm_libc::sscanf("12", "%1d", &result); + ret_val = LIBC_NAMESPACE::sscanf("12", "%1d", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 1); - ret_val = __llvm_libc::sscanf("-1", "%1d", &result); + ret_val = LIBC_NAMESPACE::sscanf("-1", "%1d", &result); EXPECT_EQ(ret_val, 0); EXPECT_EQ(result, 0); - ret_val = __llvm_libc::sscanf("+1", "%1d", &result); + ret_val = LIBC_NAMESPACE::sscanf("+1", "%1d", &result); EXPECT_EQ(ret_val, 0); EXPECT_EQ(result, 0); - ret_val = __llvm_libc::sscanf("01", "%1d", &result); + ret_val = LIBC_NAMESPACE::sscanf("01", "%1d", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 0); - ret_val = __llvm_libc::sscanf("01", "%1i", &result); + ret_val = LIBC_NAMESPACE::sscanf("01", "%1i", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 0); - ret_val = __llvm_libc::sscanf("0x1", "%2i", &result); + ret_val = LIBC_NAMESPACE::sscanf("0x1", "%2i", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 0); - ret_val = __llvm_libc::sscanf("-0x1", "%3i", &result); + ret_val = LIBC_NAMESPACE::sscanf("-0x1", "%3i", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 0); - ret_val = __llvm_libc::sscanf("-0x123", "%4i", &result); + ret_val = LIBC_NAMESPACE::sscanf("-0x123", "%4i", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, -1); - ret_val = __llvm_libc::sscanf("123456789", "%5i", &result); + ret_val = LIBC_NAMESPACE::sscanf("123456789", "%5i", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 12345); - ret_val = __llvm_libc::sscanf("123456789", "%10i", &result); + ret_val = LIBC_NAMESPACE::sscanf("123456789", "%10i", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 123456789); } @@ -206,23 +206,23 @@ TEST(LlvmLibcSScanfTest, IntConvNoWriteTests) { // Result shouldn't be used by these tests, but it's safer to have it and // check it. int result = 0; - ret_val = __llvm_libc::sscanf("-1", "%*1d", &result); + ret_val = LIBC_NAMESPACE::sscanf("-1", "%*1d", &result); EXPECT_EQ(ret_val, 0); EXPECT_EQ(result, 0); - ret_val = __llvm_libc::sscanf("01", "%*1i", &result); + ret_val = LIBC_NAMESPACE::sscanf("01", "%*1i", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 0); - ret_val = __llvm_libc::sscanf("0x1", "%*2i", &result); + ret_val = LIBC_NAMESPACE::sscanf("0x1", "%*2i", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 0); - ret_val = __llvm_libc::sscanf("a", "%*i", &result); + ret_val = LIBC_NAMESPACE::sscanf("a", "%*i", &result); EXPECT_EQ(ret_val, 0); EXPECT_EQ(result, 0); - ret_val = __llvm_libc::sscanf("123", "%*i", &result); + ret_val = LIBC_NAMESPACE::sscanf("123", "%*i", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 0); } @@ -231,62 +231,62 @@ TEST(LlvmLibcSScanfTest, FloatConvSimple) { int ret_val; float result = 0; - float inf = __llvm_libc::fputil::FPBits<float>::inf().get_val(); - float nan = __llvm_libc::fputil::FPBits<float>::build_nan(1); + float inf = LIBC_NAMESPACE::fputil::FPBits<float>::inf().get_val(); + float nan = LIBC_NAMESPACE::fputil::FPBits<float>::build_nan(1); - ret_val = __llvm_libc::sscanf("123", "%f", &result); + ret_val = LIBC_NAMESPACE::sscanf("123", "%f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 123.0); - ret_val = __llvm_libc::sscanf("456.1", "%a", &result); + ret_val = LIBC_NAMESPACE::sscanf("456.1", "%a", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 456.1); - ret_val = __llvm_libc::sscanf("0x789.ap0", "%e", &result); + ret_val = LIBC_NAMESPACE::sscanf("0x789.ap0", "%e", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0x789.ap0); - ret_val = __llvm_libc::sscanf("0x.8", "%e", &result); + ret_val = LIBC_NAMESPACE::sscanf("0x.8", "%e", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0x0.8p0); - ret_val = __llvm_libc::sscanf("0x8.", "%e", &result); + ret_val = LIBC_NAMESPACE::sscanf("0x8.", "%e", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0x8.0p0); - ret_val = __llvm_libc::sscanf("+12.0e1", "%g", &result); + ret_val = LIBC_NAMESPACE::sscanf("+12.0e1", "%g", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 12.0e1); - ret_val = __llvm_libc::sscanf("inf", "%F", &result); + ret_val = LIBC_NAMESPACE::sscanf("inf", "%F", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, inf); - ret_val = __llvm_libc::sscanf("NaN", "%A", &result); + ret_val = LIBC_NAMESPACE::sscanf("NaN", "%A", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, nan); - ret_val = __llvm_libc::sscanf("-InFiNiTy", "%E", &result); + ret_val = LIBC_NAMESPACE::sscanf("-InFiNiTy", "%E", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, -inf); - ret_val = __llvm_libc::sscanf("1e10", "%G", &result); + ret_val = LIBC_NAMESPACE::sscanf("1e10", "%G", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 1e10); - ret_val = __llvm_libc::sscanf(".1", "%G", &result); + ret_val = LIBC_NAMESPACE::sscanf(".1", "%G", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.1); - ret_val = __llvm_libc::sscanf("1.", "%G", &result); + ret_val = LIBC_NAMESPACE::sscanf("1.", "%G", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 1.0); - ret_val = __llvm_libc::sscanf("0", "%f", &result); + ret_val = LIBC_NAMESPACE::sscanf("0", "%f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.0); - ret_val = __llvm_libc::sscanf("Not a float", "%f", &result); + ret_val = LIBC_NAMESPACE::sscanf("Not a float", "%f", &result); EXPECT_EQ(ret_val, 0); } @@ -295,30 +295,31 @@ TEST(LlvmLibcSScanfTest, FloatConvLengthModifier) { double d_result = 0; long double ld_result = 0; - double d_inf = __llvm_libc::fputil::FPBits<double>::inf().get_val(); - long double ld_nan = __llvm_libc::fputil::FPBits<long double>::build_nan(1); + double d_inf = LIBC_NAMESPACE::fputil::FPBits<double>::inf().get_val(); + long double ld_nan = + LIBC_NAMESPACE::fputil::FPBits<long double>::build_nan(1); - ret_val = __llvm_libc::sscanf("123", "%lf", &d_result); + ret_val = LIBC_NAMESPACE::sscanf("123", "%lf", &d_result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(d_result, 123.0); - ret_val = __llvm_libc::sscanf("456.1", "%La", &ld_result); + ret_val = LIBC_NAMESPACE::sscanf("456.1", "%La", &ld_result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(ld_result, 456.1L); - ret_val = __llvm_libc::sscanf("inf", "%le", &d_result); + ret_val = LIBC_NAMESPACE::sscanf("inf", "%le", &d_result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(d_result, d_inf); - ret_val = __llvm_libc::sscanf("nan", "%Lg", &ld_result); + ret_val = LIBC_NAMESPACE::sscanf("nan", "%Lg", &ld_result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(ld_result, ld_nan); - ret_val = __llvm_libc::sscanf("1e-300", "%lF", &d_result); + ret_val = LIBC_NAMESPACE::sscanf("1e-300", "%lF", &d_result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(d_result, 1e-300); - ret_val = __llvm_libc::sscanf("1.0e600", "%LA", &ld_result); + ret_val = LIBC_NAMESPACE::sscanf("1.0e600", "%LA", &ld_result); EXPECT_EQ(ret_val, 1); // 1e600 may be larger than the maximum long double (if long double is double). // In that case both of these should be evaluated as inf. @@ -336,12 +337,12 @@ TEST(LlvmLibcSScanfTest, FloatConvLongNumber) { // 32 characters ret_val = - __llvm_libc::sscanf("123456789012345678901234567890.0", "%f", &result); + LIBC_NAMESPACE::sscanf("123456789012345678901234567890.0", "%f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 123456789012345678901234567890.0f); // 64 characters - ret_val = __llvm_libc::sscanf( + ret_val = LIBC_NAMESPACE::sscanf( "123456789012345678901234567890123456789012345678901234567890.000", "%la", &d_result); EXPECT_EQ(ret_val, 1); @@ -350,7 +351,7 @@ TEST(LlvmLibcSScanfTest, FloatConvLongNumber) { 123456789012345678901234567890123456789012345678901234567890.000); // 128 characters - ret_val = __llvm_libc::sscanf( + ret_val = LIBC_NAMESPACE::sscanf( "123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890.0000000", "%le", &d_result); @@ -360,29 +361,29 @@ TEST(LlvmLibcSScanfTest, FloatConvLongNumber) { 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890.0000000); // 256 characters - ret_val = __llvm_libc::sscanf("10000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000", - "%lf", &d_result); + ret_val = LIBC_NAMESPACE::sscanf("10000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000", + "%lf", &d_result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(d_result, 1e255); // 288 characters - ret_val = __llvm_libc::sscanf("10000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000", - "%lf", &d_result); + ret_val = LIBC_NAMESPACE::sscanf("10000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000", + "%lf", &d_result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(d_result, 1e287); } @@ -391,48 +392,48 @@ TEST(LlvmLibcSScanfTest, FloatConvComplexParsing) { int ret_val; float result = 0; - float inf = __llvm_libc::fputil::FPBits<float>::inf().get_val(); - float nan = __llvm_libc::fputil::FPBits<float>::build_nan(1); + float inf = LIBC_NAMESPACE::fputil::FPBits<float>::inf().get_val(); + float nan = LIBC_NAMESPACE::fputil::FPBits<float>::build_nan(1); - ret_val = __llvm_libc::sscanf("0x1.0e3", "%f", &result); + ret_val = LIBC_NAMESPACE::sscanf("0x1.0e3", "%f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0x1.0e3p0); - ret_val = __llvm_libc::sscanf("", "%a", &result); + ret_val = LIBC_NAMESPACE::sscanf("", "%a", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("+", "%a", &result); + ret_val = LIBC_NAMESPACE::sscanf("+", "%a", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("-", "%a", &result); + ret_val = LIBC_NAMESPACE::sscanf("-", "%a", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("+.", "%a", &result); + ret_val = LIBC_NAMESPACE::sscanf("+.", "%a", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("-.e+10", "%a", &result); + ret_val = LIBC_NAMESPACE::sscanf("-.e+10", "%a", &result); EXPECT_EQ(ret_val, 0); // This is a specific example from the standard. Its behavior diverges from // other implementations that accept "100e" as being the same as "100e0" - ret_val = __llvm_libc::sscanf("100er", "%a", &result); + ret_val = LIBC_NAMESPACE::sscanf("100er", "%a", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("nah", "%a", &result); + ret_val = LIBC_NAMESPACE::sscanf("nah", "%a", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("indirection", "%a", &result); + ret_val = LIBC_NAMESPACE::sscanf("indirection", "%a", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("infnan", "%a", &result); + ret_val = LIBC_NAMESPACE::sscanf("infnan", "%a", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, inf); - ret_val = __llvm_libc::sscanf("naninf", "%a", &result); + ret_val = LIBC_NAMESPACE::sscanf("naninf", "%a", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, nan); - ret_val = __llvm_libc::sscanf("infinityinfinity", "%a", &result); + ret_val = LIBC_NAMESPACE::sscanf("infinityinfinity", "%a", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, inf); @@ -444,17 +445,17 @@ TEST(LlvmLibcSScanfTest, FloatConvComplexParsing) { // one character so when it finds that the character after the second 'i' is // not the next character in "infinity" it can't rewind to the point where it // had just "inf". - ret_val = __llvm_libc::sscanf("infi", "%a", &result); + ret_val = LIBC_NAMESPACE::sscanf("infi", "%a", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("infinite", "%a", &result); + ret_val = LIBC_NAMESPACE::sscanf("infinite", "%a", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("-.1e1", "%f", &result); + ret_val = LIBC_NAMESPACE::sscanf("-.1e1", "%f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, -.1e1); - ret_val = __llvm_libc::sscanf("1.2.e1", "%f", &result); + ret_val = LIBC_NAMESPACE::sscanf("1.2.e1", "%f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 1.2); } @@ -463,64 +464,64 @@ TEST(LlvmLibcSScanfTest, FloatConvMaxWidth) { int ret_val; float result = 0; - float inf = __llvm_libc::fputil::FPBits<float>::inf().get_val(); + float inf = LIBC_NAMESPACE::fputil::FPBits<float>::inf().get_val(); - ret_val = __llvm_libc::sscanf("123", "%3f", &result); + ret_val = LIBC_NAMESPACE::sscanf("123", "%3f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 123.0); - ret_val = __llvm_libc::sscanf("123", "%5f", &result); + ret_val = LIBC_NAMESPACE::sscanf("123", "%5f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 123.0); - ret_val = __llvm_libc::sscanf("456", "%1f", &result); + ret_val = LIBC_NAMESPACE::sscanf("456", "%1f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 4.0); - ret_val = __llvm_libc::sscanf("-789", "%1f", &result); + ret_val = LIBC_NAMESPACE::sscanf("-789", "%1f", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("-123", "%2f", &result); + ret_val = LIBC_NAMESPACE::sscanf("-123", "%2f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, -1.0); - ret_val = __llvm_libc::sscanf("inf", "%2f", &result); + ret_val = LIBC_NAMESPACE::sscanf("inf", "%2f", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("nan", "%1f", &result); + ret_val = LIBC_NAMESPACE::sscanf("nan", "%1f", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("-inf", "%3f", &result); + ret_val = LIBC_NAMESPACE::sscanf("-inf", "%3f", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("-nan", "%3f", &result); + ret_val = LIBC_NAMESPACE::sscanf("-nan", "%3f", &result); EXPECT_EQ(ret_val, 0); // If the max length were not here this would fail as discussed above, but // since the max length limits it to the 3 it succeeds. - ret_val = __llvm_libc::sscanf("infinite", "%3f", &result); + ret_val = LIBC_NAMESPACE::sscanf("infinite", "%3f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, inf); - ret_val = __llvm_libc::sscanf("-infinite", "%4f", &result); + ret_val = LIBC_NAMESPACE::sscanf("-infinite", "%4f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, -inf); - ret_val = __llvm_libc::sscanf("01", "%1f", &result); + ret_val = LIBC_NAMESPACE::sscanf("01", "%1f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.0); - ret_val = __llvm_libc::sscanf("0x1", "%2f", &result); + ret_val = LIBC_NAMESPACE::sscanf("0x1", "%2f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.0); - ret_val = __llvm_libc::sscanf("100e", "%4f", &result); + ret_val = LIBC_NAMESPACE::sscanf("100e", "%4f", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("100e+10", "%5f", &result); + ret_val = LIBC_NAMESPACE::sscanf("100e+10", "%5f", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("100e10", "%5f", &result); + ret_val = LIBC_NAMESPACE::sscanf("100e10", "%5f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 100e1); } @@ -529,55 +530,55 @@ TEST(LlvmLibcSScanfTest, FloatConvNoWrite) { int ret_val; float result = 0; - ret_val = __llvm_libc::sscanf("123", "%*f", &result); + ret_val = LIBC_NAMESPACE::sscanf("123", "%*f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.0); - ret_val = __llvm_libc::sscanf("456.1", "%*a", &result); + ret_val = LIBC_NAMESPACE::sscanf("456.1", "%*a", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.0); - ret_val = __llvm_libc::sscanf("0x789.ap0", "%*e", &result); + ret_val = LIBC_NAMESPACE::sscanf("0x789.ap0", "%*e", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.0); - ret_val = __llvm_libc::sscanf("+12.0e1", "%*g", &result); + ret_val = LIBC_NAMESPACE::sscanf("+12.0e1", "%*g", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.0); - ret_val = __llvm_libc::sscanf("inf", "%*F", &result); + ret_val = LIBC_NAMESPACE::sscanf("inf", "%*F", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.0); - ret_val = __llvm_libc::sscanf("NaN", "%*A", &result); + ret_val = LIBC_NAMESPACE::sscanf("NaN", "%*A", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.0); - ret_val = __llvm_libc::sscanf("-InFiNiTy", "%*E", &result); + ret_val = LIBC_NAMESPACE::sscanf("-InFiNiTy", "%*E", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.0); - ret_val = __llvm_libc::sscanf("1e10", "%*G", &result); + ret_val = LIBC_NAMESPACE::sscanf("1e10", "%*G", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.0); - ret_val = __llvm_libc::sscanf(".1", "%*G", &result); + ret_val = LIBC_NAMESPACE::sscanf(".1", "%*G", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.0); - ret_val = __llvm_libc::sscanf("123", "%*3f", &result); + ret_val = LIBC_NAMESPACE::sscanf("123", "%*3f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.0); - ret_val = __llvm_libc::sscanf("123", "%*5f", &result); + ret_val = LIBC_NAMESPACE::sscanf("123", "%*5f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.0); - ret_val = __llvm_libc::sscanf("456", "%*1f", &result); + ret_val = LIBC_NAMESPACE::sscanf("456", "%*1f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.0); - ret_val = __llvm_libc::sscanf("Not a float", "%*f", &result); + ret_val = LIBC_NAMESPACE::sscanf("Not a float", "%*f", &result); EXPECT_EQ(ret_val, 0); } @@ -586,45 +587,45 @@ TEST(LlvmLibcSScanfTest, CurPosCombined) { int result = -1; char c_result = 0; - ret_val = __llvm_libc::sscanf("some text", "%n", &result); + ret_val = LIBC_NAMESPACE::sscanf("some text", "%n", &result); // %n doesn't count as a conversion for the return value. EXPECT_EQ(ret_val, 0); EXPECT_EQ(result, 0); - ret_val = __llvm_libc::sscanf("1234567890", "12345%n", &result); + ret_val = LIBC_NAMESPACE::sscanf("1234567890", "12345%n", &result); EXPECT_EQ(ret_val, 0); EXPECT_EQ(result, 5); - ret_val = __llvm_libc::sscanf("1234567890", "12345%n", &result); + ret_val = LIBC_NAMESPACE::sscanf("1234567890", "12345%n", &result); EXPECT_EQ(ret_val, 0); EXPECT_EQ(result, 5); // 288 characters - ret_val = __llvm_libc::sscanf("10000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000", - "%*d%hhn", &c_result); + ret_val = LIBC_NAMESPACE::sscanf("10000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000", + "%*d%hhn", &c_result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(c_result, char(288)); // Overflow is handled by casting. // 320 characters - ret_val = __llvm_libc::sscanf("10000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000", - "%*d%n", &result); + ret_val = LIBC_NAMESPACE::sscanf("10000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000", + "%*d%n", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 320); } @@ -633,37 +634,37 @@ TEST(LlvmLibcSScanfTest, PointerConvCombined) { int ret_val; void *result; - ret_val = __llvm_libc::sscanf("(nullptr)", "%p", &result); + ret_val = LIBC_NAMESPACE::sscanf("(nullptr)", "%p", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, static_cast<void *>(nullptr)); - ret_val = __llvm_libc::sscanf("(NuLlPtR)", "%p", &result); + ret_val = LIBC_NAMESPACE::sscanf("(NuLlPtR)", "%p", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, static_cast<void *>(nullptr)); - ret_val = __llvm_libc::sscanf("(NULLPTR)", "%p", &result); + ret_val = LIBC_NAMESPACE::sscanf("(NULLPTR)", "%p", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, static_cast<void *>(nullptr)); - ret_val = __llvm_libc::sscanf("(null)", "%p", &result); + ret_val = LIBC_NAMESPACE::sscanf("(null)", "%p", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("(nullptr2", "%p", &result); + ret_val = LIBC_NAMESPACE::sscanf("(nullptr2", "%p", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("0", "%p", &result); + ret_val = LIBC_NAMESPACE::sscanf("0", "%p", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, reinterpret_cast<void *>(0)); - ret_val = __llvm_libc::sscanf("100", "%p", &result); + ret_val = LIBC_NAMESPACE::sscanf("100", "%p", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, reinterpret_cast<void *>(0x100)); - ret_val = __llvm_libc::sscanf("-1", "%p", &result); + ret_val = LIBC_NAMESPACE::sscanf("-1", "%p", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, reinterpret_cast<void *>(-1)); - ret_val = __llvm_libc::sscanf("0xabcDEFG", "%p", &result); + ret_val = LIBC_NAMESPACE::sscanf("0xabcDEFG", "%p", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, reinterpret_cast<void *>(0xabcdef)); } @@ -672,17 +673,17 @@ TEST(LlvmLibcSScanfTest, CombinedConv) { int ret_val; int result = 0; char buffer[10]; - ret_val = __llvm_libc::sscanf("123abc", "%i%s", &result, buffer); + ret_val = LIBC_NAMESPACE::sscanf("123abc", "%i%s", &result, buffer); EXPECT_EQ(ret_val, 2); EXPECT_EQ(result, 123); ASSERT_STREQ(buffer, "abc"); - ret_val = __llvm_libc::sscanf("0xZZZ", "%i%s", &result, buffer); + ret_val = LIBC_NAMESPACE::sscanf("0xZZZ", "%i%s", &result, buffer); EXPECT_EQ(ret_val, 2); EXPECT_EQ(result, 0); ASSERT_STREQ(buffer, "ZZZ"); - ret_val = __llvm_libc::sscanf("0xZZZ", "%X%s", &result, buffer); + ret_val = LIBC_NAMESPACE::sscanf("0xZZZ", "%X%s", &result, buffer); EXPECT_EQ(ret_val, 2); EXPECT_EQ(result, 0); ASSERT_STREQ(buffer, "ZZZ"); diff --git a/libc/test/src/stdio/ungetc_test.cpp b/libc/test/src/stdio/ungetc_test.cpp index 028343d..75eecc8 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 67ce11e..cf51e8c 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 49c40e0..9bad2c8 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 0710bbf..40eba72 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 08f1070..2aef1d7 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 3f0551a..ddccdfa 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 923489d..8570182 100644 --- a/libc/test/src/stdlib/AtoiTest.h +++ b/libc/test/src/stdlib/AtoiTest.h @@ -11,9 +11,10 @@ #include <limits.h> -using __llvm_libc::cpp::is_same_v; +using LIBC_NAMESPACE::cpp::is_same_v; -template <typename ReturnT> struct AtoTest : public __llvm_libc::testing::Test { +template <typename ReturnT> +struct AtoTest : public LIBC_NAMESPACE::testing::Test { using FunctionT = ReturnT (*)(const char *); void validNumbers(FunctionT func) { diff --git a/libc/test/src/stdlib/DivTest.h b/libc/test/src/stdlib/DivTest.h index 5867c5b..90fae6c 100644 --- a/libc/test/src/stdlib/DivTest.h +++ b/libc/test/src/stdlib/DivTest.h @@ -9,7 +9,7 @@ #include "test/UnitTest/Test.h" template <typename IntType, typename ReturnType> -class DivTest : public __llvm_libc::testing::Test { +class DivTest : public LIBC_NAMESPACE::testing::Test { public: using DivFunc = ReturnType(IntType, IntType); diff --git a/libc/test/src/stdlib/StrtolTest.h b/libc/test/src/stdlib/StrtolTest.h index 24726b4..11794c4 100644 --- a/libc/test/src/stdlib/StrtolTest.h +++ b/libc/test/src/stdlib/StrtolTest.h @@ -15,7 +15,7 @@ #include <limits.h> #include <stddef.h> -using __llvm_libc::cpp::is_signed_v; +using LIBC_NAMESPACE::cpp::is_signed_v; static inline char int_to_b36_char(int input) { if (input < 0 || input > 36) @@ -26,13 +26,13 @@ static inline char int_to_b36_char(int input) { } template <typename ReturnT> -struct StrtoTest : public __llvm_libc::testing::Test { +struct StrtoTest : public LIBC_NAMESPACE::testing::Test { using FunctionT = ReturnT (*)(const char *, char **, int); static constexpr ReturnT T_MAX = - __llvm_libc::cpp::numeric_limits<ReturnT>::max(); + LIBC_NAMESPACE::cpp::numeric_limits<ReturnT>::max(); static constexpr ReturnT T_MIN = - __llvm_libc::cpp::numeric_limits<ReturnT>::min(); + LIBC_NAMESPACE::cpp::numeric_limits<ReturnT>::min(); void InvalidBase(FunctionT func) { const char *ten = "10"; diff --git a/libc/test/src/stdlib/_Exit_test.cpp b/libc/test/src/stdlib/_Exit_test.cpp index af5cd23..9ca0fc5 100644 --- a/libc/test/src/stdlib/_Exit_test.cpp +++ b/libc/test/src/stdlib/_Exit_test.cpp @@ -13,9 +13,9 @@ #include <stdlib.h> TEST(LlvmLibcStdlib, _Exit) { - EXPECT_EXITS([] { __llvm_libc::_Exit(1); }, 1); - EXPECT_EXITS([] { __llvm_libc::_Exit(65); }, 65); + EXPECT_EXITS([] { LIBC_NAMESPACE::_Exit(1); }, 1); + EXPECT_EXITS([] { LIBC_NAMESPACE::_Exit(65); }, 65); - EXPECT_EXITS([] { __llvm_libc::exit(1); }, 1); - EXPECT_EXITS([] { __llvm_libc::exit(65); }, 65); + EXPECT_EXITS([] { LIBC_NAMESPACE::exit(1); }, 1); + EXPECT_EXITS([] { LIBC_NAMESPACE::exit(65); }, 65); } diff --git a/libc/test/src/stdlib/abort_test.cpp b/libc/test/src/stdlib/abort_test.cpp index 6e6f1ae..766c8d5 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 a402253..171383e 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 eb295ad..8a785cc 100644 --- a/libc/test/src/stdlib/atexit_test.cpp +++ b/libc/test/src/stdlib/atexit_test.cpp @@ -18,38 +18,39 @@ TEST(LlvmLibcAtExit, Basic) { a = 0; auto test = [] { - int status = __llvm_libc::atexit(+[] { + int status = LIBC_NAMESPACE::atexit(+[] { if (a != 1) __builtin_trap(); }); - status |= __llvm_libc::atexit(+[] { a++; }); + status |= LIBC_NAMESPACE::atexit(+[] { a++; }); if (status) __builtin_trap(); - __llvm_libc::exit(0); + LIBC_NAMESPACE::exit(0); }; EXPECT_EXITS(test, 0); } TEST(LlvmLibcAtExit, AtExitCallsSysExit) { auto test = [] { - __llvm_libc::atexit(+[] { _Exit(1); }); - __llvm_libc::exit(0); + LIBC_NAMESPACE::atexit(+[] { _Exit(1); }); + LIBC_NAMESPACE::exit(0); }; EXPECT_EXITS(test, 1); } static int size; -static __llvm_libc::cpp::array<int, 256> arr; +static LIBC_NAMESPACE::cpp::array<int, 256> arr; template <int... Ts> -void register_atexit_handlers(__llvm_libc::cpp::integer_sequence<int, Ts...>) { - (__llvm_libc::atexit(+[] { arr[size++] = Ts; }), ...); +void register_atexit_handlers( + LIBC_NAMESPACE::cpp::integer_sequence<int, Ts...>) { + (LIBC_NAMESPACE::atexit(+[] { arr[size++] = Ts; }), ...); } template <int count> constexpr auto getTest() { return [] { - __llvm_libc::atexit(+[] { + LIBC_NAMESPACE::atexit(+[] { if (size != count) __builtin_trap(); for (int i = 0; i < count; i++) @@ -57,8 +58,8 @@ template <int count> constexpr auto getTest() { __builtin_trap(); }); register_atexit_handlers( - __llvm_libc::cpp::make_integer_sequence<int, count>{}); - __llvm_libc::exit(0); + LIBC_NAMESPACE::cpp::make_integer_sequence<int, count>{}); + LIBC_NAMESPACE::exit(0); }; } @@ -80,9 +81,9 @@ TEST(LlvmLibcAtExit, Many) { TEST(LlvmLibcAtExit, HandlerCallsAtExit) { auto test = [] { - __llvm_libc::atexit( - +[] { __llvm_libc::atexit(+[] { __llvm_libc::exit(1); }); }); - __llvm_libc::exit(0); + LIBC_NAMESPACE::atexit( + +[] { LIBC_NAMESPACE::atexit(+[] { LIBC_NAMESPACE::exit(1); }); }); + LIBC_NAMESPACE::exit(0); }; EXPECT_EXITS(test, 1); } diff --git a/libc/test/src/stdlib/atof_test.cpp b/libc/test/src/stdlib/atof_test.cpp index efa9f6c..ed3d4c2 100644 --- a/libc/test/src/stdlib/atof_test.cpp +++ b/libc/test/src/stdlib/atof_test.cpp @@ -16,21 +16,21 @@ #include <limits.h> #include <stddef.h> -using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; // This is just a simple test to make sure that this function works at all. It's // functionally identical to strtod so the bulk of the testing is there. TEST(LlvmLibcAToFTest, SimpleTest) { - __llvm_libc::fputil::FPBits<double> expected_fp = - __llvm_libc::fputil::FPBits<double>(uint64_t(0x405ec00000000000)); + LIBC_NAMESPACE::fputil::FPBits<double> expected_fp = + LIBC_NAMESPACE::fputil::FPBits<double>(uint64_t(0x405ec00000000000)); libc_errno = 0; - EXPECT_THAT(__llvm_libc::atof("123"), + EXPECT_THAT(LIBC_NAMESPACE::atof("123"), Succeeds<double>(static_cast<double>(expected_fp))); } TEST(LlvmLibcAToFTest, FailedParsingTest) { libc_errno = 0; // atof does not flag errors. - EXPECT_THAT(__llvm_libc::atof("???"), Succeeds<double>(0.0)); + EXPECT_THAT(LIBC_NAMESPACE::atof("???"), Succeeds<double>(0.0)); } diff --git a/libc/test/src/stdlib/atoi_test.cpp b/libc/test/src/stdlib/atoi_test.cpp index 6fbde55..4973fbb 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 ad1cbba..cc81708 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 8052f2f..0c7a1331 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 4726f28..6891458 100644 --- a/libc/test/src/stdlib/bsearch_test.cpp +++ b/libc/test/src/stdlib/bsearch_test.cpp @@ -25,13 +25,14 @@ static int int_compare(const void *l, const void *r) { TEST(LlvmLibcBsearchTest, ErrorInputs) { int val = 123; - EXPECT_TRUE(__llvm_libc::bsearch(nullptr, &val, 1, sizeof(int), - int_compare) == nullptr); - EXPECT_TRUE(__llvm_libc::bsearch(&val, nullptr, 1, sizeof(int), - int_compare) == nullptr); - EXPECT_TRUE(__llvm_libc::bsearch(&val, &val, 0, sizeof(int), int_compare) == + EXPECT_TRUE(LIBC_NAMESPACE::bsearch(nullptr, &val, 1, sizeof(int), + int_compare) == nullptr); + EXPECT_TRUE(LIBC_NAMESPACE::bsearch(&val, nullptr, 1, sizeof(int), + int_compare) == nullptr); + EXPECT_TRUE(LIBC_NAMESPACE::bsearch(&val, &val, 0, sizeof(int), + int_compare) == nullptr); + EXPECT_TRUE(LIBC_NAMESPACE::bsearch(&val, &val, 1, 0, int_compare) == nullptr); - EXPECT_TRUE(__llvm_libc::bsearch(&val, &val, 1, 0, int_compare) == nullptr); } TEST(LlvmLibcBsearchTest, IntegerArray) { @@ -45,7 +46,7 @@ TEST(LlvmLibcBsearchTest, IntegerArray) { for (size_t i = 0; i < s; ++i) { int key = ARRAY[i]; void *elem = - __llvm_libc::bsearch(&key, ARRAY, s, sizeof(int), int_compare); + LIBC_NAMESPACE::bsearch(&key, ARRAY, s, sizeof(int), int_compare); ASSERT_EQ(*reinterpret_cast<int *>(elem), key); } } @@ -53,26 +54,26 @@ TEST(LlvmLibcBsearchTest, IntegerArray) { // Non existent keys for (size_t s = 1; s <= ARRAY_SIZE; ++s) { int key = 5; - ASSERT_TRUE(__llvm_libc::bsearch(&key, &ARRAY, s, sizeof(int), - int_compare) == nullptr); + ASSERT_TRUE(LIBC_NAMESPACE::bsearch(&key, &ARRAY, s, sizeof(int), + int_compare) == nullptr); key = 125; - ASSERT_TRUE(__llvm_libc::bsearch(&key, &ARRAY, s, sizeof(int), - int_compare) == nullptr); + ASSERT_TRUE(LIBC_NAMESPACE::bsearch(&key, &ARRAY, s, sizeof(int), + int_compare) == nullptr); key = 136; - ASSERT_TRUE(__llvm_libc::bsearch(&key, &ARRAY, s, sizeof(int), - int_compare) == nullptr); + ASSERT_TRUE(LIBC_NAMESPACE::bsearch(&key, &ARRAY, s, sizeof(int), + int_compare) == nullptr); key = 12345; - ASSERT_TRUE(__llvm_libc::bsearch(&key, &ARRAY, s, sizeof(int), - int_compare) == nullptr); + ASSERT_TRUE(LIBC_NAMESPACE::bsearch(&key, &ARRAY, s, sizeof(int), + int_compare) == nullptr); } } TEST(LlvmLibcBsearchTest, SameKeyAndArray) { constexpr int ARRAY[5] = {1, 2, 3, 4, 5}; constexpr size_t ARRAY_SIZE = sizeof(ARRAY) / sizeof(int); - void *elem = - __llvm_libc::bsearch(ARRAY, ARRAY, ARRAY_SIZE, sizeof(int), int_compare); + void *elem = LIBC_NAMESPACE::bsearch(ARRAY, ARRAY, ARRAY_SIZE, sizeof(int), + int_compare); EXPECT_EQ(*reinterpret_cast<int *>(elem), ARRAY[0]); } diff --git a/libc/test/src/stdlib/div_test.cpp b/libc/test/src/stdlib/div_test.cpp index 6b1f20d..d06b834 100644 --- a/libc/test/src/stdlib/div_test.cpp +++ b/libc/test/src/stdlib/div_test.cpp @@ -12,4 +12,4 @@ #include <stdlib.h> -LIST_DIV_TESTS(int, div_t, __llvm_libc::div) +LIST_DIV_TESTS(int, div_t, LIBC_NAMESPACE::div) diff --git a/libc/test/src/stdlib/labs_test.cpp b/libc/test/src/stdlib/labs_test.cpp index 1209d17..535d1da 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 d28d387..6b84163 100644 --- a/libc/test/src/stdlib/ldiv_test.cpp +++ b/libc/test/src/stdlib/ldiv_test.cpp @@ -12,4 +12,4 @@ #include <stdlib.h> -LIST_DIV_TESTS(long, ldiv_t, __llvm_libc::ldiv) +LIST_DIV_TESTS(long, ldiv_t, LIBC_NAMESPACE::ldiv) diff --git a/libc/test/src/stdlib/llabs_test.cpp b/libc/test/src/stdlib/llabs_test.cpp index 13ed4f8..a6dfa46 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 5fa0de2..d803894 100644 --- a/libc/test/src/stdlib/lldiv_test.cpp +++ b/libc/test/src/stdlib/lldiv_test.cpp @@ -12,4 +12,4 @@ #include <stdlib.h> -LIST_DIV_TESTS(long long, lldiv_t, __llvm_libc::lldiv) +LIST_DIV_TESTS(long long, lldiv_t, LIBC_NAMESPACE::lldiv) diff --git a/libc/test/src/stdlib/malloc_test.cpp b/libc/test/src/stdlib/malloc_test.cpp index 579d5dc..d9023cf 100644 --- a/libc/test/src/stdlib/malloc_test.cpp +++ b/libc/test/src/stdlib/malloc_test.cpp @@ -11,9 +11,9 @@ #include "test/UnitTest/Test.h" TEST(LlvmLibcMallocTest, Allocate) { - int *ptr = reinterpret_cast<int *>(__llvm_libc::malloc(sizeof(int))); + int *ptr = reinterpret_cast<int *>(LIBC_NAMESPACE::malloc(sizeof(int))); EXPECT_NE(reinterpret_cast<void *>(ptr), static_cast<void *>(nullptr)); *ptr = 1; EXPECT_EQ(*ptr, 1); - __llvm_libc::free(ptr); + LIBC_NAMESPACE::free(ptr); } diff --git a/libc/test/src/stdlib/qsort_r_test.cpp b/libc/test/src/stdlib/qsort_r_test.cpp index ceb58fc..2c810f4 100644 --- a/libc/test/src/stdlib/qsort_r_test.cpp +++ b/libc/test/src/stdlib/qsort_r_test.cpp @@ -33,8 +33,8 @@ TEST(LlvmLibcQsortRTest, SortedArray) { size_t count = 0; - __llvm_libc::qsort_r(array, ARRAY_SIZE, sizeof(int), int_compare_count, - &count); + LIBC_NAMESPACE::qsort_r(array, ARRAY_SIZE, sizeof(int), int_compare_count, + &count); ASSERT_LE(array[0], 10); ASSERT_LE(array[1], 23); @@ -74,8 +74,8 @@ TEST(LlvmLibcQsortRTest, ReverseSortedArray) { size_t count = 0; - __llvm_libc::qsort_r(array, ARRAY_SIZE, sizeof(int), int_compare_count, - &count); + LIBC_NAMESPACE::qsort_r(array, ARRAY_SIZE, sizeof(int), int_compare_count, + &count); for (int i = 0; i < int(ARRAY_SIZE - 1); ++i) ASSERT_LE(array[i], i + 1); @@ -127,9 +127,9 @@ TEST(LlvmLibcQsortRTest, SafeTypeErasure) { }; constexpr size_t ARRAY_SIZE = sizeof(array) / sizeof(PriorityVal); - __llvm_libc::qsort_r(array, ARRAY_SIZE, sizeof(PriorityVal), - type_erased_comp<PriorityVal>, - reinterpret_cast<void *>(compare_priority_val)); + LIBC_NAMESPACE::qsort_r(array, ARRAY_SIZE, sizeof(PriorityVal), + type_erased_comp<PriorityVal>, + reinterpret_cast<void *>(compare_priority_val)); EXPECT_EQ(array[0].priority, -1); EXPECT_EQ(array[0].size, 100); diff --git a/libc/test/src/stdlib/qsort_test.cpp b/libc/test/src/stdlib/qsort_test.cpp index 9808ad0..0822d49 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 4bebbe3..6f25708 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 70129ba..b1bdd89 100644 --- a/libc/test/src/stdlib/strtod_test.cpp +++ b/libc/test/src/stdlib/strtod_test.cpp @@ -17,13 +17,13 @@ #include <limits.h> #include <stddef.h> -using __llvm_libc::fputil::testing::ForceRoundingModeTest; -using __llvm_libc::fputil::testing::RoundingMode; +using LIBC_NAMESPACE::fputil::testing::ForceRoundingModeTest; +using LIBC_NAMESPACE::fputil::testing::RoundingMode; -using __llvm_libc::testing::ErrnoSetterMatcher::Fails; -using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; -class LlvmLibcStrToDTest : public __llvm_libc::testing::Test, +class LlvmLibcStrToDTest : public LIBC_NAMESPACE::testing::Test, ForceRoundingModeTest<RoundingMode::Nearest> { public: void run_test(const char *inputString, const ptrdiff_t expectedStrLen, @@ -44,11 +44,11 @@ public: // This is so that the result can be compared in parts. char *str_end = nullptr; - __llvm_libc::fputil::FPBits<double> expected_fp = - __llvm_libc::fputil::FPBits<double>(expectedRawData); + LIBC_NAMESPACE::fputil::FPBits<double> expected_fp = + LIBC_NAMESPACE::fputil::FPBits<double>(expectedRawData); libc_errno = 0; - double result = __llvm_libc::strtod(inputString, &str_end); + double result = LIBC_NAMESPACE::strtod(inputString, &str_end); if (expectedErrno == 0) EXPECT_THAT(result, Succeeds<double>(static_cast<double>(expected_fp))); else diff --git a/libc/test/src/stdlib/strtof_test.cpp b/libc/test/src/stdlib/strtof_test.cpp index 9151cbe..15a8a34 100644 --- a/libc/test/src/stdlib/strtof_test.cpp +++ b/libc/test/src/stdlib/strtof_test.cpp @@ -17,10 +17,10 @@ #include <limits.h> #include <stddef.h> -using __llvm_libc::fputil::testing::ForceRoundingModeTest; -using __llvm_libc::fputil::testing::RoundingMode; +using LIBC_NAMESPACE::fputil::testing::ForceRoundingModeTest; +using LIBC_NAMESPACE::fputil::testing::RoundingMode; -class LlvmLibcStrToFTest : public __llvm_libc::testing::Test, +class LlvmLibcStrToFTest : public LIBC_NAMESPACE::testing::Test, ForceRoundingModeTest<RoundingMode::Nearest> { public: void run_test(const char *inputString, const ptrdiff_t expectedStrLen, @@ -41,11 +41,11 @@ public: // This is so that the result can be compared in parts. char *str_end = nullptr; - __llvm_libc::fputil::FPBits<float> expected_fp = - __llvm_libc::fputil::FPBits<float>(expectedRawData); + LIBC_NAMESPACE::fputil::FPBits<float> expected_fp = + LIBC_NAMESPACE::fputil::FPBits<float>(expectedRawData); libc_errno = 0; - float result = __llvm_libc::strtof(inputString, &str_end); + float result = LIBC_NAMESPACE::strtof(inputString, &str_end); EXPECT_EQ(str_end - inputString, expectedStrLen); EXPECT_FP_EQ(result, static_cast<float>(expected_fp)); diff --git a/libc/test/src/stdlib/strtoint32_test.cpp b/libc/test/src/stdlib/strtoint32_test.cpp index fa5e571..4ca20f3 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 95e4761..f8d807b 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 fb92ee6..a6ce262 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 dfa1fb7..680a931 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 @@ public: // +-- 15 Exponent Bits char *str_end = nullptr; - __llvm_libc::fputil::FPBits<long double> expected_fp = - __llvm_libc::fputil::FPBits<long double>(expectedRawData); + LIBC_NAMESPACE::fputil::FPBits<long double> expected_fp = + LIBC_NAMESPACE::fputil::FPBits<long double>(expectedRawData); const int expected_errno = expectedErrno; libc_errno = 0; - long double result = __llvm_libc::strtold(inputString, &str_end); + long double result = LIBC_NAMESPACE::strtold(inputString, &str_end); - __llvm_libc::fputil::FPBits<long double> actual_fp = - __llvm_libc::fputil::FPBits<long double>(); - actual_fp = __llvm_libc::fputil::FPBits<long double>(result); + LIBC_NAMESPACE::fputil::FPBits<long double> actual_fp = + LIBC_NAMESPACE::fputil::FPBits<long double>(); + actual_fp = LIBC_NAMESPACE::fputil::FPBits<long double>(result); EXPECT_EQ(str_end - inputString, expectedStrLen); diff --git a/libc/test/src/stdlib/strtoll_test.cpp b/libc/test/src/stdlib/strtoll_test.cpp index b4b197d..8e94cdc 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 f2cd860..7ba7211 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 c254406..c9a0b8d 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 71903c9..74e172d 100644 --- a/libc/test/src/string/StrchrTest.h +++ b/libc/test/src/string/StrchrTest.h @@ -8,7 +8,7 @@ #include "test/UnitTest/Test.h" -template <auto Func> struct StrchrTest : public __llvm_libc::testing::Test { +template <auto Func> struct StrchrTest : public LIBC_NAMESPACE::testing::Test { void findsFirstCharacter() { const char *src = "abcde"; @@ -82,7 +82,7 @@ template <auto Func> struct StrchrTest : public __llvm_libc::testing::Test { } }; -template <auto Func> struct StrrchrTest : public __llvm_libc::testing::Test { +template <auto Func> struct StrrchrTest : public LIBC_NAMESPACE::testing::Test { void findsFirstCharacter() { const char *src = "abcde"; diff --git a/libc/test/src/string/bcmp_test.cpp b/libc/test/src/string/bcmp_test.cpp index 72037c7..fa89e4d 100644 --- a/libc/test/src/string/bcmp_test.cpp +++ b/libc/test/src/string/bcmp_test.cpp @@ -11,35 +11,35 @@ #include "test/UnitTest/Test.h" #include "test/UnitTest/TestLogger.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { TEST(LlvmLibcBcmpTest, CmpZeroByte) { const char *lhs = "ab"; const char *rhs = "bc"; - ASSERT_EQ(__llvm_libc::bcmp(lhs, rhs, 0), 0); + ASSERT_EQ(LIBC_NAMESPACE::bcmp(lhs, rhs, 0), 0); } TEST(LlvmLibcBcmpTest, LhsRhsAreTheSame) { const char *lhs = "ab"; const char *rhs = "ab"; - ASSERT_EQ(__llvm_libc::bcmp(lhs, rhs, 2), 0); + ASSERT_EQ(LIBC_NAMESPACE::bcmp(lhs, rhs, 2), 0); } TEST(LlvmLibcBcmpTest, LhsBeforeRhsLexically) { const char *lhs = "ab"; const char *rhs = "ac"; - ASSERT_NE(__llvm_libc::bcmp(lhs, rhs, 2), 0); + ASSERT_NE(LIBC_NAMESPACE::bcmp(lhs, rhs, 2), 0); } TEST(LlvmLibcBcmpTest, LhsAfterRhsLexically) { const char *lhs = "ac"; const char *rhs = "ab"; - ASSERT_NE(__llvm_libc::bcmp(lhs, rhs, 2), 0); + ASSERT_NE(LIBC_NAMESPACE::bcmp(lhs, rhs, 2), 0); } // Adapt CheckBcmp signature to bcmp. static inline int Adaptor(cpp::span<char> p1, cpp::span<char> p2, size_t size) { - return __llvm_libc::bcmp(p1.begin(), p2.begin(), size); + return LIBC_NAMESPACE::bcmp(p1.begin(), p2.begin(), size); } TEST(LlvmLibcBcmpTest, SizeSweep) { @@ -57,4 +57,4 @@ TEST(LlvmLibcBcmpTest, SizeSweep) { } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/src/string/bcopy_test.cpp b/libc/test/src/string/bcopy_test.cpp index 9654179..f8cb920 100644 --- a/libc/test/src/string/bcopy_test.cpp +++ b/libc/test/src/string/bcopy_test.cpp @@ -13,16 +13,16 @@ #include "test/UnitTest/MemoryMatcher.h" #include "test/UnitTest/Test.h" -using __llvm_libc::cpp::array; -using __llvm_libc::cpp::span; +using LIBC_NAMESPACE::cpp::array; +using LIBC_NAMESPACE::cpp::span; -namespace __llvm_libc { +namespace LIBC_NAMESPACE { TEST(LlvmLibcBcopyTest, MoveZeroByte) { char Buffer[] = {'a', 'b', 'y', 'z'}; const char Expected[] = {'a', 'b', 'y', 'z'}; void *const Dst = Buffer; - __llvm_libc::bcopy(Buffer + 2, Dst, 0); + LIBC_NAMESPACE::bcopy(Buffer + 2, Dst, 0); ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected)); } @@ -30,7 +30,7 @@ TEST(LlvmLibcBcopyTest, DstAndSrcPointToSameAddress) { char Buffer[] = {'a', 'b'}; const char Expected[] = {'a', 'b'}; void *const Dst = Buffer; - __llvm_libc::bcopy(Buffer, Dst, 1); + LIBC_NAMESPACE::bcopy(Buffer, Dst, 1); ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected)); } @@ -40,7 +40,7 @@ TEST(LlvmLibcBcopyTest, DstStartsBeforeSrc) { char Buffer[] = {'z', 'a', 'b', 'c', 'z'}; const char Expected[] = {'z', 'b', 'c', 'c', 'z'}; void *const Dst = Buffer + 1; - __llvm_libc::bcopy(Buffer + 2, Dst, 2); + LIBC_NAMESPACE::bcopy(Buffer + 2, Dst, 2); ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected)); } @@ -48,7 +48,7 @@ TEST(LlvmLibcBcopyTest, DstStartsAfterSrc) { char Buffer[] = {'z', 'a', 'b', 'c', 'z'}; const char Expected[] = {'z', 'a', 'a', 'b', 'z'}; void *const Dst = Buffer + 2; - __llvm_libc::bcopy(Buffer + 1, Dst, 2); + LIBC_NAMESPACE::bcopy(Buffer + 1, Dst, 2); ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected)); } @@ -60,7 +60,7 @@ TEST(LlvmLibcBcopyTest, SrcFollowDst) { char Buffer[] = {'z', 'a', 'b', 'z'}; const char Expected[] = {'z', 'b', 'b', 'z'}; void *const Dst = Buffer + 1; - __llvm_libc::bcopy(Buffer + 2, Dst, 1); + LIBC_NAMESPACE::bcopy(Buffer + 2, Dst, 1); ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected)); } @@ -68,14 +68,14 @@ TEST(LlvmLibcBcopyTest, DstFollowSrc) { char Buffer[] = {'z', 'a', 'b', 'z'}; const char Expected[] = {'z', 'a', 'a', 'z'}; void *const Dst = Buffer + 2; - __llvm_libc::bcopy(Buffer + 1, Dst, 1); + LIBC_NAMESPACE::bcopy(Buffer + 1, Dst, 1); ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected)); } // Adapt CheckMemmove signature to bcopy. static inline void Adaptor(cpp::span<char> dst, cpp::span<char> src, size_t size) { - __llvm_libc::bcopy(src.begin(), dst.begin(), size); + LIBC_NAMESPACE::bcopy(src.begin(), dst.begin(), size); } TEST(LlvmLibcBcopyTest, SizeSweep) { @@ -95,4 +95,4 @@ TEST(LlvmLibcBcopyTest, SizeSweep) { } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/src/string/bzero_test.cpp b/libc/test/src/string/bzero_test.cpp index d3ee64d..7382490 100644 --- a/libc/test/src/string/bzero_test.cpp +++ b/libc/test/src/string/bzero_test.cpp @@ -10,11 +10,11 @@ #include "src/string/bzero.h" #include "test/UnitTest/Test.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Adapt CheckMemset signature to bzero. static inline void Adaptor(cpp::span<char> p1, uint8_t value, size_t size) { - __llvm_libc::bzero(p1.begin(), size); + LIBC_NAMESPACE::bzero(p1.begin(), size); } TEST(LlvmLibcBzeroTest, SizeSweep) { @@ -26,4 +26,4 @@ TEST(LlvmLibcBzeroTest, SizeSweep) { } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/src/string/index_test.cpp b/libc/test/src/string/index_test.cpp index 22202f0..8895320 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 09f24ae..5bac865 100644 --- a/libc/test/src/string/memccpy_test.cpp +++ b/libc/test/src/string/memccpy_test.cpp @@ -11,17 +11,17 @@ #include "test/UnitTest/Test.h" #include <stddef.h> // For size_t. -class LlvmLibcMemccpyTest : public __llvm_libc::testing::Test { +class LlvmLibcMemccpyTest : public LIBC_NAMESPACE::testing::Test { public: - void check_memccpy(__llvm_libc::cpp::span<char> dst, - const __llvm_libc::cpp::span<const char> src, int end, + void check_memccpy(LIBC_NAMESPACE::cpp::span<char> dst, + const LIBC_NAMESPACE::cpp::span<const char> src, int end, size_t count, - const __llvm_libc::cpp::span<const char> expected, + const LIBC_NAMESPACE::cpp::span<const char> expected, size_t expectedCopied, bool shouldReturnNull = false) { // Making sure we don't overflow buffer. ASSERT_GE(dst.size(), count); // Making sure memccpy returns dst. - void *result = __llvm_libc::memccpy(dst.data(), src.data(), end, count); + void *result = LIBC_NAMESPACE::memccpy(dst.data(), src.data(), end, count); if (shouldReturnNull) { ASSERT_EQ(result, static_cast<void *>(nullptr)); diff --git a/libc/test/src/string/memchr_test.cpp b/libc/test/src/string/memchr_test.cpp index 1523be8..3439582 100644 --- a/libc/test/src/string/memchr_test.cpp +++ b/libc/test/src/string/memchr_test.cpp @@ -13,7 +13,7 @@ // A helper function that calls memchr and abstracts away the explicit cast for // readability purposes. const char *call_memchr(const void *src, int c, size_t size) { - return reinterpret_cast<const char *>(__llvm_libc::memchr(src, c, size)); + return reinterpret_cast<const char *>(LIBC_NAMESPACE::memchr(src, c, size)); } TEST(LlvmLibcMemChrTest, FindsCharacterAfterNullTerminator) { @@ -80,10 +80,10 @@ TEST(LlvmLibcMemChrTest, TheSourceShouldNotChange) { const unsigned char src[size] = {'a', 'b', 'c', 'd', 'e', '\0'}; const char *src_copy = reinterpret_cast<const char *>(src); // When the character is found, the source string should not change. - __llvm_libc::memchr(src, 'd', size); + LIBC_NAMESPACE::memchr(src, 'd', size); ASSERT_STREQ(reinterpret_cast<const char *>(src), src_copy); // Same case for when the character is not found. - __llvm_libc::memchr(src, 'z', size); + LIBC_NAMESPACE::memchr(src, 'z', size); ASSERT_STREQ(reinterpret_cast<const char *>(src), src_copy); } diff --git a/libc/test/src/string/memcmp_test.cpp b/libc/test/src/string/memcmp_test.cpp index ac26fd4..03a0ac1 100644 --- a/libc/test/src/string/memcmp_test.cpp +++ b/libc/test/src/string/memcmp_test.cpp @@ -11,35 +11,35 @@ #include "test/UnitTest/Test.h" #include "test/UnitTest/TestLogger.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { TEST(LlvmLibcMemcmpTest, CmpZeroByte) { const char *lhs = "ab"; const char *rhs = "yz"; - EXPECT_EQ(__llvm_libc::memcmp(lhs, rhs, 0), 0); + EXPECT_EQ(LIBC_NAMESPACE::memcmp(lhs, rhs, 0), 0); } TEST(LlvmLibcMemcmpTest, LhsRhsAreTheSame) { const char *lhs = "ab"; const char *rhs = "ab"; - EXPECT_EQ(__llvm_libc::memcmp(lhs, rhs, 2), 0); + EXPECT_EQ(LIBC_NAMESPACE::memcmp(lhs, rhs, 2), 0); } TEST(LlvmLibcMemcmpTest, LhsBeforeRhsLexically) { const char *lhs = "ab"; const char *rhs = "az"; - EXPECT_LT(__llvm_libc::memcmp(lhs, rhs, 2), 0); + EXPECT_LT(LIBC_NAMESPACE::memcmp(lhs, rhs, 2), 0); } TEST(LlvmLibcMemcmpTest, LhsAfterRhsLexically) { const char *lhs = "az"; const char *rhs = "ab"; - EXPECT_GT(__llvm_libc::memcmp(lhs, rhs, 2), 0); + EXPECT_GT(LIBC_NAMESPACE::memcmp(lhs, rhs, 2), 0); } // Adapt CheckMemcmp signature to memcmp. static inline int Adaptor(cpp::span<char> p1, cpp::span<char> p2, size_t size) { - return __llvm_libc::memcmp(p1.begin(), p2.begin(), size); + return LIBC_NAMESPACE::memcmp(p1.begin(), p2.begin(), size); } TEST(LlvmLibcMemcmpTest, SizeSweep) { @@ -57,4 +57,4 @@ TEST(LlvmLibcMemcmpTest, SizeSweep) { } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/src/string/memcpy_test.cpp b/libc/test/src/string/memcpy_test.cpp index 7fe0921..b05d420 100644 --- a/libc/test/src/string/memcpy_test.cpp +++ b/libc/test/src/string/memcpy_test.cpp @@ -10,12 +10,12 @@ #include "src/string/memcpy.h" #include "test/UnitTest/Test.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Adapt CheckMemcpy signature to memcpy. static inline void Adaptor(cpp::span<char> dst, cpp::span<char> src, size_t size) { - __llvm_libc::memcpy(dst.begin(), src.begin(), size); + LIBC_NAMESPACE::memcpy(dst.begin(), src.begin(), size); } TEST(LlvmLibcMemcpyTest, SizeSweep) { @@ -30,4 +30,4 @@ TEST(LlvmLibcMemcpyTest, SizeSweep) { } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/src/string/memmem_test.cpp b/libc/test/src/string/memmem_test.cpp index db6c9c0..56d4b7f 100644 --- a/libc/test/src/string/memmem_test.cpp +++ b/libc/test/src/string/memmem_test.cpp @@ -11,40 +11,40 @@ #include "src/string/string_utils.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { TEST(LlvmLibcMemmemTest, EmptyHaystackEmptyNeedleReturnsHaystck) { char *h = nullptr; char *n = nullptr; - void *result = __llvm_libc::memmem(h, 0, n, 0); + void *result = LIBC_NAMESPACE::memmem(h, 0, n, 0); ASSERT_EQ(static_cast<char *>(result), h); } TEST(LlvmLibcMemmemTest, EmptyHaystackNonEmptyNeedleReturnsNull) { char *h = nullptr; char n[] = {'a', 'b', 'c'}; - void *result = __llvm_libc::memmem(h, 0, n, sizeof(n)); + void *result = LIBC_NAMESPACE::memmem(h, 0, n, sizeof(n)); ASSERT_EQ(result, static_cast<void *>(nullptr)); } TEST(LlvmLibcMemmemTest, EmptyNeedleReturnsHaystack) { char h[] = {'a', 'b', 'c'}; char *n = nullptr; - void *result = __llvm_libc::memmem(h, sizeof(h), n, 0); + void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, 0); ASSERT_EQ(static_cast<char *>(result), h + 0); } TEST(LlvmLibcMemmemTest, ExactMatchReturnsHaystack) { char h[] = {'a', 'b', 'c'}; char n[] = {'a', 'b', 'c'}; - void *result = __llvm_libc::memmem(h, sizeof(h), n, sizeof(n)); + void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, sizeof(n)); ASSERT_EQ(static_cast<char *>(result), h + 0); } TEST(LlvmLibcMemmemTest, ReturnFirstMatchOfNeedle) { char h[] = {'a', 'a', 'b', 'c'}; char n[] = {'a'}; - void *result = __llvm_libc::memmem(h, sizeof(h), n, sizeof(n)); + void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, sizeof(n)); ASSERT_EQ(static_cast<char *>(result), h + 0); } @@ -52,13 +52,13 @@ TEST(LlvmLibcMemmemTest, ReturnFirstExactMatchOfNeedle) { { char h[] = {'a', 'b', 'a', 'c', 'a', 'a'}; char n[] = {'a', 'a'}; - void *result = __llvm_libc::memmem(h, sizeof(h), n, sizeof(n)); + void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, sizeof(n)); ASSERT_EQ(static_cast<char *>(result), h + 4); } { char h[] = {'a', 'a', 'b', 'a', 'b', 'a'}; char n[] = {'a', 'b', 'a'}; - void *result = __llvm_libc::memmem(h, sizeof(h), n, sizeof(n)); + void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, sizeof(n)); ASSERT_EQ(static_cast<char *>(result), h + 1); } } @@ -66,7 +66,7 @@ TEST(LlvmLibcMemmemTest, ReturnFirstExactMatchOfNeedle) { TEST(LlvmLibcMemmemTest, NullTerminatorDoesNotInterruptMatch) { char h[] = {'\0', 'a', 'b'}; char n[] = {'a', 'b'}; - void *result = __llvm_libc::memmem(h, sizeof(h), n, sizeof(n)); + void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, sizeof(n)); ASSERT_EQ(static_cast<char *>(result), h + 1); } @@ -74,25 +74,25 @@ TEST(LlvmLibcMemmemTest, ReturnNullIfNoExactMatch) { { char h[] = {'a'}; char n[] = {'a', 'a'}; - void *result = __llvm_libc::memmem(h, sizeof(h), n, sizeof(n)); + void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, sizeof(n)); ASSERT_EQ(result, static_cast<void *>(nullptr)); } { char h[] = {'a', 'A'}; char n[] = {'a', 'a'}; - void *result = __llvm_libc::memmem(h, sizeof(h), n, sizeof(n)); + void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, sizeof(n)); ASSERT_EQ(result, static_cast<void *>(nullptr)); } { char h[] = {'a'}; char n[] = {'a', '\0'}; - void *result = __llvm_libc::memmem(h, sizeof(h), n, sizeof(n)); + void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, sizeof(n)); ASSERT_EQ(result, static_cast<void *>(nullptr)); } { char h[] = {'\0'}; char n[] = {'\0', '\0'}; - void *result = __llvm_libc::memmem(h, sizeof(h), n, sizeof(n)); + void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, sizeof(n)); ASSERT_EQ(result, static_cast<void *>(nullptr)); } } @@ -101,13 +101,13 @@ TEST(LlvmLibcMemmemTest, ReturnMatchOfSpecifiedNeedleLength) { { char h[] = {'a', 'b', 'c'}; char n[] = {'x', 'y', 'z'}; - void *result = __llvm_libc::memmem(h, sizeof(h), n, 0); + void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, 0); ASSERT_EQ(static_cast<char *>(result), h + 0); } { char h[] = {'a', 'b', 'c'}; char n[] = {'b', 'c', 'a'}; - void *result = __llvm_libc::memmem(h, sizeof(h), n, 2); + void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, 2); ASSERT_EQ(static_cast<char *>(result), h + 1); } } @@ -116,14 +116,14 @@ TEST(LlvmLibcMemmemTest, ReturnNullIfInadequateHaystackLength) { { char h[] = {'a', 'b', 'c'}; char n[] = {'c'}; - void *result = __llvm_libc::memmem(h, 2, n, sizeof(n)); + void *result = LIBC_NAMESPACE::memmem(h, 2, n, sizeof(n)); ASSERT_EQ(result, static_cast<void *>(nullptr)); } { char h[] = {'a', 'b', 'c'}; char n[] = {'a', 'b', 'c'}; - void *result = __llvm_libc::memmem(h, 2, n, sizeof(n)); + void *result = LIBC_NAMESPACE::memmem(h, 2, n, sizeof(n)); ASSERT_EQ(result, static_cast<void *>(nullptr)); } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/src/string/memmove_test.cpp b/libc/test/src/string/memmove_test.cpp index 57ab0d4..b076e86 100644 --- a/libc/test/src/string/memmove_test.cpp +++ b/libc/test/src/string/memmove_test.cpp @@ -13,16 +13,16 @@ #include "test/UnitTest/MemoryMatcher.h" #include "test/UnitTest/Test.h" -using __llvm_libc::cpp::array; -using __llvm_libc::cpp::span; +using LIBC_NAMESPACE::cpp::array; +using LIBC_NAMESPACE::cpp::span; -namespace __llvm_libc { +namespace LIBC_NAMESPACE { TEST(LlvmLibcMemmoveTest, MoveZeroByte) { char Buffer[] = {'a', 'b', 'y', 'z'}; const char Expected[] = {'a', 'b', 'y', 'z'}; void *const Dst = Buffer; - void *const Ret = __llvm_libc::memmove(Dst, Buffer + 2, 0); + void *const Ret = LIBC_NAMESPACE::memmove(Dst, Buffer + 2, 0); EXPECT_EQ(Ret, Dst); ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected)); } @@ -31,7 +31,7 @@ TEST(LlvmLibcMemmoveTest, DstAndSrcPointToSameAddress) { char Buffer[] = {'a', 'b'}; const char Expected[] = {'a', 'b'}; void *const Dst = Buffer; - void *const Ret = __llvm_libc::memmove(Dst, Buffer, 1); + void *const Ret = LIBC_NAMESPACE::memmove(Dst, Buffer, 1); EXPECT_EQ(Ret, Dst); ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected)); } @@ -42,7 +42,7 @@ TEST(LlvmLibcMemmoveTest, DstStartsBeforeSrc) { char Buffer[] = {'z', 'a', 'b', 'c', 'z'}; const char Expected[] = {'z', 'b', 'c', 'c', 'z'}; void *const Dst = Buffer + 1; - void *const Ret = __llvm_libc::memmove(Dst, Buffer + 2, 2); + void *const Ret = LIBC_NAMESPACE::memmove(Dst, Buffer + 2, 2); EXPECT_EQ(Ret, Dst); ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected)); } @@ -51,7 +51,7 @@ TEST(LlvmLibcMemmoveTest, DstStartsAfterSrc) { char Buffer[] = {'z', 'a', 'b', 'c', 'z'}; const char Expected[] = {'z', 'a', 'a', 'b', 'z'}; void *const Dst = Buffer + 2; - void *const Ret = __llvm_libc::memmove(Dst, Buffer + 1, 2); + void *const Ret = LIBC_NAMESPACE::memmove(Dst, Buffer + 1, 2); EXPECT_EQ(Ret, Dst); ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected)); } @@ -64,7 +64,7 @@ TEST(LlvmLibcMemmoveTest, SrcFollowDst) { char Buffer[] = {'z', 'a', 'b', 'z'}; const char Expected[] = {'z', 'b', 'b', 'z'}; void *const Dst = Buffer + 1; - void *const Ret = __llvm_libc::memmove(Dst, Buffer + 2, 1); + void *const Ret = LIBC_NAMESPACE::memmove(Dst, Buffer + 2, 1); EXPECT_EQ(Ret, Dst); ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected)); } @@ -73,7 +73,7 @@ TEST(LlvmLibcMemmoveTest, DstFollowSrc) { char Buffer[] = {'z', 'a', 'b', 'z'}; const char Expected[] = {'z', 'a', 'a', 'z'}; void *const Dst = Buffer + 2; - void *const Ret = __llvm_libc::memmove(Dst, Buffer + 1, 1); + void *const Ret = LIBC_NAMESPACE::memmove(Dst, Buffer + 1, 1); EXPECT_EQ(Ret, Dst); ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected)); } @@ -81,7 +81,7 @@ TEST(LlvmLibcMemmoveTest, DstFollowSrc) { // Adapt CheckMemmove signature to op implementation signatures. static inline void Adaptor(cpp::span<char> dst, cpp::span<char> src, size_t size) { - __llvm_libc::memmove(dst.begin(), src.begin(), size); + LIBC_NAMESPACE::memmove(dst.begin(), src.begin(), size); } TEST(LlvmLibcMemmoveTest, SizeSweep) { @@ -101,4 +101,4 @@ TEST(LlvmLibcMemmoveTest, SizeSweep) { } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/src/string/memory_utils/memory_check_utils.h b/libc/test/src/string/memory_utils/memory_check_utils.h index dee375e..9504230 100644 --- a/libc/test/src/string/memory_utils/memory_check_utils.h +++ b/libc/test/src/string/memory_utils/memory_check_utils.h @@ -17,7 +17,7 @@ #include <stdint.h> // uintxx_t #include <stdlib.h> // malloc/free -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Simple structure to allocate a buffer of a particular size. // When ASAN is present it also poisons the whole memory. @@ -198,6 +198,6 @@ inline bool CheckMemmove(cpp::span<char> buffer, size_t size, int overlap) { return true; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LIBC_TEST_SRC_STRING_MEMORY_UTILS_MEMORY_CHECK_UTILS_H diff --git a/libc/test/src/string/memory_utils/op_tests.cpp b/libc/test/src/string/memory_utils/op_tests.cpp index f1223b8..15ac960 100644 --- a/libc/test/src/string/memory_utils/op_tests.cpp +++ b/libc/test/src/string/memory_utils/op_tests.cpp @@ -14,7 +14,7 @@ #include "src/string/memory_utils/op_x86.h" #include "test/UnitTest/Test.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { template <typename T> struct has_head_tail { template <typename C> static char sfinae(decltype(&C::head_tail)); @@ -343,4 +343,4 @@ TYPED_TEST(LlvmLibcOpTest, Memcmp, MemcmpImplementations) { } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/src/string/memory_utils/utils_test.cpp b/libc/test/src/string/memory_utils/utils_test.cpp index 8968e0d..8e9052d 100644 --- a/libc/test/src/string/memory_utils/utils_test.cpp +++ b/libc/test/src/string/memory_utils/utils_test.cpp @@ -10,7 +10,7 @@ #include "src/string/memory_utils/utils.h" #include "test/UnitTest/Test.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { TEST(LlvmLibcUtilsTest, IsPowerOfTwoOrZero) { static const cpp::array<bool, 65> kExpectedValues{ @@ -197,4 +197,4 @@ TEST(LlvmLibcUtilsTest, LoadStoreAligned) { } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/src/string/mempcpy_test.cpp b/libc/test/src/string/mempcpy_test.cpp index 5259874..43ad5a0 100644 --- a/libc/test/src/string/mempcpy_test.cpp +++ b/libc/test/src/string/mempcpy_test.cpp @@ -15,7 +15,7 @@ TEST(LlvmLibcMempcpyTest, Simple) { const char *src = "12345"; char dest[10]; - void *result = __llvm_libc::mempcpy(dest, src, 6); + void *result = LIBC_NAMESPACE::mempcpy(dest, src, 6); ASSERT_EQ(static_cast<char *>(result), dest + 6); ASSERT_STREQ(src, dest); } @@ -23,6 +23,6 @@ TEST(LlvmLibcMempcpyTest, Simple) { TEST(LlvmLibcMempcpyTest, ZeroCount) { const char *src = "12345"; char dest[10]; - void *result = __llvm_libc::mempcpy(dest, src, 0); + void *result = LIBC_NAMESPACE::mempcpy(dest, src, 0); ASSERT_EQ(static_cast<char *>(result), dest + 0); } diff --git a/libc/test/src/string/memrchr_test.cpp b/libc/test/src/string/memrchr_test.cpp index c8e81ec..421cb9b 100644 --- a/libc/test/src/string/memrchr_test.cpp +++ b/libc/test/src/string/memrchr_test.cpp @@ -13,7 +13,7 @@ // A helper function that calls memrchr and abstracts away the explicit cast for // readability purposes. const char *call_memrchr(const void *src, int c, size_t size) { - return reinterpret_cast<const char *>(__llvm_libc::memrchr(src, c, size)); + return reinterpret_cast<const char *>(LIBC_NAMESPACE::memrchr(src, c, size)); } TEST(LlvmLibcMemRChrTest, FindsCharacterAfterNullTerminator) { diff --git a/libc/test/src/string/memset_test.cpp b/libc/test/src/string/memset_test.cpp index 1aa8edd..3a54498 100644 --- a/libc/test/src/string/memset_test.cpp +++ b/libc/test/src/string/memset_test.cpp @@ -10,11 +10,11 @@ #include "src/string/memset.h" #include "test/UnitTest/Test.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Adapt CheckMemset signature to memset. static inline void Adaptor(cpp::span<char> p1, uint8_t value, size_t size) { - __llvm_libc::memset(p1.begin(), value, size); + LIBC_NAMESPACE::memset(p1.begin(), value, size); } TEST(LlvmLibcMemsetTest, SizeSweep) { @@ -27,4 +27,4 @@ TEST(LlvmLibcMemsetTest, SizeSweep) { } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/src/string/rindex_test.cpp b/libc/test/src/string/rindex_test.cpp index 1e59696..10513919 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 56e53c1..523eaf1 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 2448ea5..247fa92 100644 --- a/libc/test/src/string/stpncpy_test.cpp +++ b/libc/test/src/string/stpncpy_test.cpp @@ -11,16 +11,16 @@ #include "test/UnitTest/Test.h" #include <stddef.h> // For size_t. -class LlvmLibcStpncpyTest : public __llvm_libc::testing::Test { +class LlvmLibcStpncpyTest : public LIBC_NAMESPACE::testing::Test { public: - void check_stpncpy(__llvm_libc::cpp::span<char> dst, - const __llvm_libc::cpp::span<const char> src, size_t n, - const __llvm_libc::cpp::span<const char> expected, + void check_stpncpy(LIBC_NAMESPACE::cpp::span<char> dst, + const LIBC_NAMESPACE::cpp::span<const char> src, size_t n, + const LIBC_NAMESPACE::cpp::span<const char> expected, size_t expectedCopied) { // Making sure we don't overflow buffer. ASSERT_GE(dst.size(), n); // Making sure stpncpy returns a pointer to the end of dst. - ASSERT_EQ(__llvm_libc::stpncpy(dst.data(), src.data(), n), + ASSERT_EQ(LIBC_NAMESPACE::stpncpy(dst.data(), src.data(), n), dst.data() + expectedCopied); // Expected must be of the same size as dst. ASSERT_EQ(dst.size(), expected.size()); diff --git a/libc/test/src/string/strcasecmp_test.cpp b/libc/test/src/string/strcasecmp_test.cpp index 2eb16ee..df78881 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 6345ac5..5b8604a 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 2fd4212..e4f6c1ee 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 684b631..6ad8344 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 e4ca729..273cf40 100644 --- a/libc/test/src/string/strchrnul_test.cpp +++ b/libc/test/src/string/strchrnul_test.cpp @@ -13,7 +13,7 @@ TEST(LlvmLibcStrChrNulTest, FindsFirstCharacter) { const char *src = "abcde"; // Should return original string since 'a' is the first character. - ASSERT_STREQ(__llvm_libc::strchrnul(src, 'a'), "abcde"); + ASSERT_STREQ(LIBC_NAMESPACE::strchrnul(src, 'a'), "abcde"); // Source string should not change. ASSERT_STREQ(src, "abcde"); } @@ -22,7 +22,7 @@ TEST(LlvmLibcStrChrNulTest, FindsMiddleCharacter) { const char *src = "abcde"; // Should return characters after (and including) 'c'. - ASSERT_STREQ(__llvm_libc::strchrnul(src, 'c'), "cde"); + ASSERT_STREQ(LIBC_NAMESPACE::strchrnul(src, 'c'), "cde"); // Source string should not change. ASSERT_STREQ(src, "abcde"); } @@ -31,7 +31,7 @@ TEST(LlvmLibcStrChrNulTest, FindsLastCharacterThatIsNotNullTerminator) { const char *src = "abcde"; // Should return 'e' and null-terminator. - ASSERT_STREQ(__llvm_libc::strchrnul(src, 'e'), "e"); + ASSERT_STREQ(LIBC_NAMESPACE::strchrnul(src, 'e'), "e"); // Source string should not change. ASSERT_STREQ(src, "abcde"); } @@ -40,7 +40,7 @@ TEST(LlvmLibcStrChrNulTest, FindsNullTerminator) { const char *src = "abcde"; // Should return null terminator. - ASSERT_STREQ(__llvm_libc::strchrnul(src, '\0'), ""); + ASSERT_STREQ(LIBC_NAMESPACE::strchrnul(src, '\0'), ""); // Source string should not change. ASSERT_STREQ(src, "abcde"); } @@ -51,7 +51,7 @@ TEST(LlvmLibcStrChrNulTest, // Since 'z' is not within the string, should return a pointer to the source // string's null terminator. - char *result = __llvm_libc::strchrnul(src, 'z'); + char *result = LIBC_NAMESPACE::strchrnul(src, 'z'); ASSERT_EQ(*result, '\0'); char *term = const_cast<char *>(src) + 4; @@ -61,36 +61,36 @@ TEST(LlvmLibcStrChrNulTest, TEST(LlvmLibcStrChrNulTest, TheSourceShouldNotChange) { const char *src = "abcde"; // When the character is found, the source string should not change. - __llvm_libc::strchrnul(src, 'd'); + LIBC_NAMESPACE::strchrnul(src, 'd'); ASSERT_STREQ(src, "abcde"); // Same case for when the character is not found. - __llvm_libc::strchrnul(src, 'z'); + LIBC_NAMESPACE::strchrnul(src, 'z'); ASSERT_STREQ(src, "abcde"); // Same case for when looking for null terminator. - __llvm_libc::strchrnul(src, '\0'); + LIBC_NAMESPACE::strchrnul(src, '\0'); ASSERT_STREQ(src, "abcde"); } TEST(LlvmLibcStrChrNulTest, ShouldFindFirstOfDuplicates) { // '1' is duplicated in the string, but it should find the first copy. - ASSERT_STREQ(__llvm_libc::strchrnul("abc1def1ghi", '1'), "1def1ghi"); + ASSERT_STREQ(LIBC_NAMESPACE::strchrnul("abc1def1ghi", '1'), "1def1ghi"); const char *dups = "XXXXX"; // Should return original string since 'X' is the first character. - ASSERT_STREQ(__llvm_libc::strchrnul(dups, 'X'), dups); + ASSERT_STREQ(LIBC_NAMESPACE::strchrnul(dups, 'X'), dups); } TEST(LlvmLibcStrChrNulTest, EmptyStringShouldOnlyMatchNullTerminator) { // Null terminator should match. - ASSERT_STREQ(__llvm_libc::strchrnul("", '\0'), ""); + ASSERT_STREQ(LIBC_NAMESPACE::strchrnul("", '\0'), ""); // All other characters should not match. - char *result = __llvm_libc::strchrnul("", 'Z'); + char *result = LIBC_NAMESPACE::strchrnul("", 'Z'); ASSERT_EQ(*result, '\0'); - result = __llvm_libc::strchrnul("", '3'); + result = LIBC_NAMESPACE::strchrnul("", '3'); ASSERT_EQ(*result, '\0'); - result = __llvm_libc::strchrnul("", '*'); + result = LIBC_NAMESPACE::strchrnul("", '*'); ASSERT_EQ(*result, '\0'); } diff --git a/libc/test/src/string/strcmp_test.cpp b/libc/test/src/string/strcmp_test.cpp index 78dd8c1..ef58dc6 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 256c3c7..a10f98f 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 7508b56..1a1227a 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 2f3565c..d83b3cf 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 ee46882..b1d4df3 100644 --- a/libc/test/src/string/strdup_test.cpp +++ b/libc/test/src/string/strdup_test.cpp @@ -16,7 +16,7 @@ TEST(LlvmLibcStrDupTest, EmptyString) { const char *empty = ""; libc_errno = 0; - char *result = __llvm_libc::strdup(empty); + char *result = LIBC_NAMESPACE::strdup(empty); ASSERT_EQ(libc_errno, 0); ASSERT_NE(result, static_cast<char *>(nullptr)); @@ -29,7 +29,7 @@ TEST(LlvmLibcStrDupTest, AnyString) { const char *abc = "abc"; libc_errno = 0; - char *result = __llvm_libc::strdup(abc); + char *result = LIBC_NAMESPACE::strdup(abc); ASSERT_EQ(libc_errno, 0); ASSERT_NE(result, static_cast<char *>(nullptr)); @@ -40,7 +40,7 @@ TEST(LlvmLibcStrDupTest, AnyString) { TEST(LlvmLibcStrDupTest, NullPtr) { libc_errno = 0; - char *result = __llvm_libc::strdup(nullptr); + char *result = LIBC_NAMESPACE::strdup(nullptr); ASSERT_EQ(libc_errno, 0); ASSERT_EQ(result, static_cast<char *>(nullptr)); diff --git a/libc/test/src/string/strerror_r_test.cpp b/libc/test/src/string/strerror_r_test.cpp index 6ac3cdf..868362e 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 20a8fba..ec9827b 100644 --- a/libc/test/src/string/strerror_test.cpp +++ b/libc/test/src/string/strerror_test.cpp @@ -10,7 +10,7 @@ #include "test/UnitTest/Test.h" TEST(LlvmLibcStrErrorTest, KnownErrors) { - ASSERT_STREQ(__llvm_libc::strerror(0), "Success"); + ASSERT_STREQ(LIBC_NAMESPACE::strerror(0), "Success"); const char *message_array[] = { "Success", @@ -150,13 +150,16 @@ TEST(LlvmLibcStrErrorTest, KnownErrors) { }; for (size_t i = 0; i < (sizeof(message_array) / sizeof(char *)); ++i) { - EXPECT_STREQ(__llvm_libc::strerror(static_cast<int>(i)), message_array[i]); + EXPECT_STREQ(LIBC_NAMESPACE::strerror(static_cast<int>(i)), + message_array[i]); } } TEST(LlvmLibcStrErrorTest, UnknownErrors) { - ASSERT_STREQ(__llvm_libc::strerror(-1), "Unknown error -1"); - ASSERT_STREQ(__llvm_libc::strerror(134), "Unknown error 134"); - ASSERT_STREQ(__llvm_libc::strerror(2147483647), "Unknown error 2147483647"); - ASSERT_STREQ(__llvm_libc::strerror(-2147483648), "Unknown error -2147483648"); + ASSERT_STREQ(LIBC_NAMESPACE::strerror(-1), "Unknown error -1"); + ASSERT_STREQ(LIBC_NAMESPACE::strerror(134), "Unknown error 134"); + ASSERT_STREQ(LIBC_NAMESPACE::strerror(2147483647), + "Unknown error 2147483647"); + ASSERT_STREQ(LIBC_NAMESPACE::strerror(-2147483648), + "Unknown error -2147483648"); } diff --git a/libc/test/src/string/strlcat_test.cpp b/libc/test/src/string/strlcat_test.cpp index 50c4b2e..1ffa4b0 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 41e244b..5a1e30c 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 41b5fbe..4eb9d47 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 cf62843..b4173c4 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 1469221..9b52788 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 b3971f6..1724a54 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 69265f8..b71ed66 100644 --- a/libc/test/src/string/strncpy_test.cpp +++ b/libc/test/src/string/strncpy_test.cpp @@ -11,15 +11,15 @@ #include "test/UnitTest/Test.h" #include <stddef.h> // For size_t. -class LlvmLibcStrncpyTest : public __llvm_libc::testing::Test { +class LlvmLibcStrncpyTest : public LIBC_NAMESPACE::testing::Test { public: - void check_strncpy(__llvm_libc::cpp::span<char> dst, - const __llvm_libc::cpp::span<const char> src, size_t n, - const __llvm_libc::cpp::span<const char> expected) { + void check_strncpy(LIBC_NAMESPACE::cpp::span<char> dst, + const LIBC_NAMESPACE::cpp::span<const char> src, size_t n, + const LIBC_NAMESPACE::cpp::span<const char> expected) { // Making sure we don't overflow buffer. ASSERT_GE(dst.size(), n); // Making sure strncpy returns dst. - ASSERT_EQ(__llvm_libc::strncpy(dst.data(), src.data(), n), dst.data()); + ASSERT_EQ(LIBC_NAMESPACE::strncpy(dst.data(), src.data(), n), dst.data()); // Expected must be of the same size as dst. ASSERT_EQ(dst.size(), expected.size()); // Expected and dst are the same. diff --git a/libc/test/src/string/strndup_test.cpp b/libc/test/src/string/strndup_test.cpp index 53cdd36..3adcd9b 100644 --- a/libc/test/src/string/strndup_test.cpp +++ b/libc/test/src/string/strndup_test.cpp @@ -13,7 +13,7 @@ TEST(LlvmLibcstrndupTest, EmptyString) { const char *empty = ""; - char *result = __llvm_libc::strndup(empty, 1); + char *result = LIBC_NAMESPACE::strndup(empty, 1); ASSERT_NE(result, static_cast<char *>(nullptr)); ASSERT_NE(empty, const_cast<const char *>(result)); ASSERT_STREQ(empty, result); @@ -23,21 +23,21 @@ TEST(LlvmLibcstrndupTest, EmptyString) { TEST(LlvmLibcstrndupTest, AnyString) { const char *abc = "abc"; - char *result = __llvm_libc::strndup(abc, 3); + char *result = LIBC_NAMESPACE::strndup(abc, 3); ASSERT_NE(result, static_cast<char *>(nullptr)); ASSERT_NE(abc, const_cast<const char *>(result)); ASSERT_STREQ(abc, result); ::free(result); - result = __llvm_libc::strndup(abc, 1); + result = LIBC_NAMESPACE::strndup(abc, 1); ASSERT_NE(result, static_cast<char *>(nullptr)); ASSERT_NE(abc, const_cast<const char *>(result)); ASSERT_STREQ("a", result); ::free(result); - result = __llvm_libc::strndup(abc, 10); + result = LIBC_NAMESPACE::strndup(abc, 10); ASSERT_NE(result, static_cast<char *>(nullptr)); ASSERT_NE(abc, const_cast<const char *>(result)); @@ -46,7 +46,7 @@ TEST(LlvmLibcstrndupTest, AnyString) { } TEST(LlvmLibcstrndupTest, NullPtr) { - char *result = __llvm_libc::strndup(nullptr, 0); + char *result = LIBC_NAMESPACE::strndup(nullptr, 0); ASSERT_EQ(result, static_cast<char *>(nullptr)); } diff --git a/libc/test/src/string/strnlen_test.cpp b/libc/test/src/string/strnlen_test.cpp index e260cd65..bd1002c 100644 --- a/libc/test/src/string/strnlen_test.cpp +++ b/libc/test/src/string/strnlen_test.cpp @@ -12,35 +12,35 @@ TEST(LlvmLibcStrNLenTest, EmptyString) { const char *empty = ""; - ASSERT_EQ(static_cast<size_t>(0), __llvm_libc::strnlen(empty, 0)); + ASSERT_EQ(static_cast<size_t>(0), LIBC_NAMESPACE::strnlen(empty, 0)); // If N is greater than string length, this should still return 0. - ASSERT_EQ(static_cast<size_t>(0), __llvm_libc::strnlen(empty, 1)); + ASSERT_EQ(static_cast<size_t>(0), LIBC_NAMESPACE::strnlen(empty, 1)); } TEST(LlvmLibcStrNLenTest, OneCharacterString) { const char *single = "X"; - ASSERT_EQ(static_cast<size_t>(1), __llvm_libc::strnlen(single, 1)); + ASSERT_EQ(static_cast<size_t>(1), LIBC_NAMESPACE::strnlen(single, 1)); // If N is zero, this should return 0. - ASSERT_EQ(static_cast<size_t>(0), __llvm_libc::strnlen(single, 0)); + ASSERT_EQ(static_cast<size_t>(0), LIBC_NAMESPACE::strnlen(single, 0)); // If N is greater than string length, this should still return 1. - ASSERT_EQ(static_cast<size_t>(1), __llvm_libc::strnlen(single, 2)); + ASSERT_EQ(static_cast<size_t>(1), LIBC_NAMESPACE::strnlen(single, 2)); } TEST(LlvmLibcStrNLenTest, ManyCharacterString) { const char *many = "123456789"; - ASSERT_EQ(static_cast<size_t>(9), __llvm_libc::strnlen(many, 9)); + ASSERT_EQ(static_cast<size_t>(9), LIBC_NAMESPACE::strnlen(many, 9)); // If N is smaller than the string length, it should return N. - ASSERT_EQ(static_cast<size_t>(3), __llvm_libc::strnlen(many, 3)); + ASSERT_EQ(static_cast<size_t>(3), LIBC_NAMESPACE::strnlen(many, 3)); // If N is zero, this should return 0. - ASSERT_EQ(static_cast<size_t>(0), __llvm_libc::strnlen(many, 0)); + ASSERT_EQ(static_cast<size_t>(0), LIBC_NAMESPACE::strnlen(many, 0)); // If N is greater than the string length, this should still return 9. - ASSERT_EQ(static_cast<size_t>(9), __llvm_libc::strnlen(many, 42)); + ASSERT_EQ(static_cast<size_t>(9), LIBC_NAMESPACE::strnlen(many, 42)); } TEST(LlvmLibcStrNLenTest, CharactersAfterNullTerminatorShouldNotBeIncluded) { const char str[5] = {'a', 'b', 'c', '\0', 'd'}; - ASSERT_EQ(static_cast<size_t>(3), __llvm_libc::strnlen(str, 3)); + ASSERT_EQ(static_cast<size_t>(3), LIBC_NAMESPACE::strnlen(str, 3)); // This should only read up to the null terminator. - ASSERT_EQ(static_cast<size_t>(3), __llvm_libc::strnlen(str, 4)); - ASSERT_EQ(static_cast<size_t>(3), __llvm_libc::strnlen(str, 5)); + ASSERT_EQ(static_cast<size_t>(3), LIBC_NAMESPACE::strnlen(str, 4)); + ASSERT_EQ(static_cast<size_t>(3), LIBC_NAMESPACE::strnlen(str, 5)); } diff --git a/libc/test/src/string/strpbrk_test.cpp b/libc/test/src/string/strpbrk_test.cpp index fe10f87..fbe14da 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 02659c0..e415edd 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 7c0863b..0daa29f 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 aa55230..48b5d17 100644 --- a/libc/test/src/string/strsignal_test.cpp +++ b/libc/test/src/string/strsignal_test.cpp @@ -12,7 +12,7 @@ #include <signal.h> TEST(LlvmLibcStrSignalTest, KnownSignals) { - ASSERT_STREQ(__llvm_libc::strsignal(1), "Hangup"); + ASSERT_STREQ(LIBC_NAMESPACE::strsignal(1), "Hangup"); const char *message_array[] = { "Unknown signal 0", // unknown @@ -67,18 +67,20 @@ TEST(LlvmLibcStrSignalTest, KnownSignals) { for (size_t i = 0; i < (sizeof(message_array) / sizeof(char *)); ++i) { ASSERT_EQ(static_cast<size_t>(static_cast<int>(i)), i); - EXPECT_STREQ(__llvm_libc::strsignal(static_cast<int>(i)), message_array[i]); + EXPECT_STREQ(LIBC_NAMESPACE::strsignal(static_cast<int>(i)), + message_array[i]); } for (int i = 0; i < SIGRTMAX - SIGRTMIN; ++i) { - EXPECT_STREQ(__llvm_libc::strsignal(i + SIGRTMIN), rt_message_array[i]); + EXPECT_STREQ(LIBC_NAMESPACE::strsignal(i + SIGRTMIN), rt_message_array[i]); } } TEST(LlvmLibcStrsignalTest, UnknownSignals) { - ASSERT_STREQ(__llvm_libc::strsignal(-1), "Unknown signal -1"); - ASSERT_STREQ(__llvm_libc::strsignal(65), "Unknown signal 65"); - ASSERT_STREQ(__llvm_libc::strsignal(2147483647), "Unknown signal 2147483647"); - ASSERT_STREQ(__llvm_libc::strsignal(-2147483648), + ASSERT_STREQ(LIBC_NAMESPACE::strsignal(-1), "Unknown signal -1"); + ASSERT_STREQ(LIBC_NAMESPACE::strsignal(65), "Unknown signal 65"); + ASSERT_STREQ(LIBC_NAMESPACE::strsignal(2147483647), + "Unknown signal 2147483647"); + ASSERT_STREQ(LIBC_NAMESPACE::strsignal(-2147483648), "Unknown signal -2147483648"); } diff --git a/libc/test/src/string/strspn_test.cpp b/libc/test/src/string/strspn_test.cpp index d527609..cdd12af0 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 2008d1c..3de138c 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 fa436e0..fdc27ba 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 24033c4..b820653 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 0512556..b704dbf 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 4fdb4a2..83c73f5 100644 --- a/libc/test/src/sys/mman/linux/madvise_test.cpp +++ b/libc/test/src/sys/mman/linux/madvise_test.cpp @@ -15,28 +15,30 @@ #include <sys/mman.h> -using __llvm_libc::testing::ErrnoSetterMatcher::Fails; -using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; TEST(LlvmLibcMadviseTest, NoError) { size_t alloc_size = 128; libc_errno = 0; - void *addr = __llvm_libc::mmap(nullptr, alloc_size, PROT_READ, - MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); + void *addr = LIBC_NAMESPACE::mmap(nullptr, alloc_size, PROT_READ, + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); EXPECT_EQ(0, libc_errno); EXPECT_NE(addr, MAP_FAILED); - EXPECT_THAT(__llvm_libc::madvise(addr, alloc_size, MADV_RANDOM), Succeeds()); + EXPECT_THAT(LIBC_NAMESPACE::madvise(addr, alloc_size, MADV_RANDOM), + Succeeds()); int *array = reinterpret_cast<int *>(addr); // Reading from the memory should not crash the test. // Since we used the MAP_ANONYMOUS flag, the contents of the newly // allocated memory should be initialized to zero. EXPECT_EQ(array[0], 0); - EXPECT_THAT(__llvm_libc::munmap(addr, alloc_size), Succeeds()); + EXPECT_THAT(LIBC_NAMESPACE::munmap(addr, alloc_size), Succeeds()); } TEST(LlvmLibcMadviseTest, Error_BadPtr) { libc_errno = 0; - EXPECT_THAT(__llvm_libc::madvise(nullptr, 8, MADV_SEQUENTIAL), Fails(ENOMEM)); + EXPECT_THAT(LIBC_NAMESPACE::madvise(nullptr, 8, MADV_SEQUENTIAL), + Fails(ENOMEM)); } diff --git a/libc/test/src/sys/mman/linux/mmap_test.cpp b/libc/test/src/sys/mman/linux/mmap_test.cpp index d74701c..9b13b8b 100644 --- a/libc/test/src/sys/mman/linux/mmap_test.cpp +++ b/libc/test/src/sys/mman/linux/mmap_test.cpp @@ -14,14 +14,14 @@ #include <sys/mman.h> -using __llvm_libc::testing::ErrnoSetterMatcher::Fails; -using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; TEST(LlvmLibcMMapTest, NoError) { size_t alloc_size = 128; libc_errno = 0; - void *addr = __llvm_libc::mmap(nullptr, alloc_size, PROT_READ, - MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); + void *addr = LIBC_NAMESPACE::mmap(nullptr, alloc_size, PROT_READ, + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); EXPECT_EQ(0, libc_errno); EXPECT_NE(addr, MAP_FAILED); @@ -30,14 +30,14 @@ TEST(LlvmLibcMMapTest, NoError) { // Since we used the MAP_ANONYMOUS flag, the contents of the newly // allocated memory should be initialized to zero. EXPECT_EQ(array[0], 0); - EXPECT_THAT(__llvm_libc::munmap(addr, alloc_size), Succeeds()); + EXPECT_THAT(LIBC_NAMESPACE::munmap(addr, alloc_size), Succeeds()); } TEST(LlvmLibcMMapTest, Error_InvalidSize) { libc_errno = 0; - void *addr = __llvm_libc::mmap(nullptr, 0, PROT_READ, - MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); + void *addr = LIBC_NAMESPACE::mmap(nullptr, 0, PROT_READ, + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); EXPECT_THAT(addr, Fails(EINVAL, MAP_FAILED)); - EXPECT_THAT(__llvm_libc::munmap(0, 0), Fails(EINVAL)); + EXPECT_THAT(LIBC_NAMESPACE::munmap(0, 0), Fails(EINVAL)); } diff --git a/libc/test/src/sys/mman/linux/mprotect_test.cpp b/libc/test/src/sys/mman/linux/mprotect_test.cpp index 5f2f5f2..7127f77 100644 --- a/libc/test/src/sys/mman/linux/mprotect_test.cpp +++ b/libc/test/src/sys/mman/linux/mprotect_test.cpp @@ -16,14 +16,14 @@ #include <signal.h> #include <sys/mman.h> -using __llvm_libc::testing::ErrnoSetterMatcher::Fails; -using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; TEST(LlvmLibcMProtectTest, NoError) { size_t alloc_size = 128; libc_errno = 0; - void *addr = __llvm_libc::mmap(nullptr, alloc_size, PROT_READ, - MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); + void *addr = LIBC_NAMESPACE::mmap(nullptr, alloc_size, PROT_READ, + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); EXPECT_EQ(0, libc_errno); EXPECT_NE(addr, MAP_FAILED); @@ -35,12 +35,13 @@ TEST(LlvmLibcMProtectTest, NoError) { // By setting the memory protection to read and write, we should be able to // modify that memory. - EXPECT_THAT(__llvm_libc::mprotect(addr, alloc_size, PROT_READ | PROT_WRITE), - Succeeds()); + EXPECT_THAT( + LIBC_NAMESPACE::mprotect(addr, alloc_size, PROT_READ | PROT_WRITE), + Succeeds()); array[0] = 1; EXPECT_EQ(array[0], 1); - EXPECT_THAT(__llvm_libc::munmap(addr, alloc_size), Succeeds()); + EXPECT_THAT(LIBC_NAMESPACE::munmap(addr, alloc_size), Succeeds()); } // This test is disabled currently due to flakeyness. It will be re-enabled once @@ -53,9 +54,9 @@ TEST(LlvmLibcMProtectTest, Error_InvalidWrite) { [] { size_t alloc_size = 128; void *addr = - __llvm_libc::mmap(nullptr, alloc_size, PROT_READ | PROT_WRITE, + LIBC_NAMESPACE::mmap(nullptr, alloc_size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); - __llvm_libc::mprotect(addr, alloc_size, PROT_READ); + LIBC_NAMESPACE::mprotect(addr, alloc_size, PROT_READ); (reinterpret_cast<char *>(addr))[0] = 'A'; }, diff --git a/libc/test/src/sys/mman/linux/posix_madvise_test.cpp b/libc/test/src/sys/mman/linux/posix_madvise_test.cpp index b271a71..59cf01a 100644 --- a/libc/test/src/sys/mman/linux/posix_madvise_test.cpp +++ b/libc/test/src/sys/mman/linux/posix_madvise_test.cpp @@ -15,35 +15,36 @@ #include <sys/mman.h> -using __llvm_libc::testing::ErrnoSetterMatcher::Fails; -using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; TEST(LlvmLibcPosixMadviseTest, NoError) { size_t alloc_size = 128; libc_errno = 0; - void *addr = __llvm_libc::mmap(nullptr, alloc_size, PROT_READ, - MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); + void *addr = LIBC_NAMESPACE::mmap(nullptr, alloc_size, PROT_READ, + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); EXPECT_EQ(0, libc_errno); EXPECT_NE(addr, MAP_FAILED); - EXPECT_EQ(__llvm_libc::posix_madvise(addr, alloc_size, POSIX_MADV_RANDOM), 0); + EXPECT_EQ(LIBC_NAMESPACE::posix_madvise(addr, alloc_size, POSIX_MADV_RANDOM), + 0); int *array = reinterpret_cast<int *>(addr); // Reading from the memory should not crash the test. // Since we used the MAP_ANONYMOUS flag, the contents of the newly // allocated memory should be initialized to zero. EXPECT_EQ(array[0], 0); - EXPECT_THAT(__llvm_libc::munmap(addr, alloc_size), Succeeds()); + EXPECT_THAT(LIBC_NAMESPACE::munmap(addr, alloc_size), Succeeds()); } TEST(LlvmLibcPosixMadviseTest, Error_BadPtr) { libc_errno = 0; // posix_madvise is a no-op on DONTNEED, so it shouldn't fail even with the // nullptr. - EXPECT_EQ(__llvm_libc::posix_madvise(nullptr, 8, POSIX_MADV_DONTNEED), 0); + EXPECT_EQ(LIBC_NAMESPACE::posix_madvise(nullptr, 8, POSIX_MADV_DONTNEED), 0); // posix_madvise doesn't set errno, but the return value is actually the error // code. - EXPECT_EQ(__llvm_libc::posix_madvise(nullptr, 8, POSIX_MADV_SEQUENTIAL), + EXPECT_EQ(LIBC_NAMESPACE::posix_madvise(nullptr, 8, POSIX_MADV_SEQUENTIAL), ENOMEM); } diff --git a/libc/test/src/sys/random/linux/getrandom_test.cpp b/libc/test/src/sys/random/linux/getrandom_test.cpp index 839297b..5a595af 100644 --- a/libc/test/src/sys/random/linux/getrandom_test.cpp +++ b/libc/test/src/sys/random/linux/getrandom_test.cpp @@ -14,23 +14,23 @@ #include "test/UnitTest/Test.h" TEST(LlvmLibcGetRandomTest, InvalidFlag) { - __llvm_libc::cpp::array<char, 10> buffer; + LIBC_NAMESPACE::cpp::array<char, 10> buffer; libc_errno = 0; - ASSERT_THAT(__llvm_libc::getrandom(buffer.data(), buffer.size(), -1), - __llvm_libc::testing::ErrnoSetterMatcher::Fails(EINVAL)); + ASSERT_THAT(LIBC_NAMESPACE::getrandom(buffer.data(), buffer.size(), -1), + LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails(EINVAL)); } TEST(LlvmLibcGetRandomTest, InvalidBuffer) { libc_errno = 0; - ASSERT_THAT(__llvm_libc::getrandom(nullptr, 65536, 0), - __llvm_libc::testing::ErrnoSetterMatcher::Fails(EFAULT)); + ASSERT_THAT(LIBC_NAMESPACE::getrandom(nullptr, 65536, 0), + LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails(EFAULT)); } TEST(LlvmLibcGetRandomTest, ReturnsSize) { - __llvm_libc::cpp::array<char, 10> buffer; + LIBC_NAMESPACE::cpp::array<char, 10> buffer; for (size_t i = 0; i < buffer.size(); ++i) { // Without GRND_RANDOM set this should never fail. - ASSERT_EQ(__llvm_libc::getrandom(buffer.data(), i, 0), + ASSERT_EQ(LIBC_NAMESPACE::getrandom(buffer.data(), i, 0), static_cast<ssize_t>(i)); } } @@ -38,12 +38,12 @@ TEST(LlvmLibcGetRandomTest, ReturnsSize) { TEST(LlvmLibcGetRandomTest, CheckValue) { // Probability of picking one particular value amongst 256 possibilities a // hundred times in a row is (1/256)^100 = 1.49969681e-241. - __llvm_libc::cpp::array<char, 100> buffer; + LIBC_NAMESPACE::cpp::array<char, 100> buffer; for (char &c : buffer) c = 0; - __llvm_libc::getrandom(buffer.data(), buffer.size(), 0); + LIBC_NAMESPACE::getrandom(buffer.data(), buffer.size(), 0); bool all_zeros = true; for (char c : buffer) diff --git a/libc/test/src/sys/resource/getrlimit_setrlimit_test.cpp b/libc/test/src/sys/resource/getrlimit_setrlimit_test.cpp index b385cf8..7e6bb0a 100644 --- a/libc/test/src/sys/resource/getrlimit_setrlimit_test.cpp +++ b/libc/test/src/sys/resource/getrlimit_setrlimit_test.cpp @@ -19,8 +19,8 @@ #include <sys/resource.h> TEST(LlvmLibcResourceLimitsTest, SetNoFileLimit) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; // The test strategy is to first create initialize two file descriptors // successfully. Next, close the files and set the file descriptor limit @@ -30,47 +30,47 @@ TEST(LlvmLibcResourceLimitsTest, SetNoFileLimit) { constexpr const char *TEST_FILE2 = "testdata/resource_limits2.test"; libc_errno = 0; - int fd1 = __llvm_libc::open(TEST_FILE1, O_CREAT | O_WRONLY, S_IRWXU); + int fd1 = LIBC_NAMESPACE::open(TEST_FILE1, O_CREAT | O_WRONLY, S_IRWXU); ASSERT_GT(fd1, 0); ASSERT_EQ(libc_errno, 0); - int fd2 = __llvm_libc::open(TEST_FILE2, O_CREAT | O_WRONLY, S_IRWXU); + int fd2 = LIBC_NAMESPACE::open(TEST_FILE2, O_CREAT | O_WRONLY, S_IRWXU); ASSERT_GT(fd2, 0); ASSERT_EQ(libc_errno, 0); - ASSERT_THAT(__llvm_libc::close(fd1), Succeeds(0)); - ASSERT_THAT(__llvm_libc::close(fd2), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(fd1), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(fd2), Succeeds(0)); struct rlimit limits { 4, 4 }; - ASSERT_THAT(__llvm_libc::setrlimit(RLIMIT_NOFILE, &limits), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::setrlimit(RLIMIT_NOFILE, &limits), Succeeds(0)); // One can now only open one of the files successfully. - fd1 = __llvm_libc::open(TEST_FILE1, O_RDONLY); + fd1 = LIBC_NAMESPACE::open(TEST_FILE1, O_RDONLY); ASSERT_GT(fd1, 0); ASSERT_EQ(libc_errno, 0); - fd2 = __llvm_libc::open(TEST_FILE2, O_RDONLY); + fd2 = LIBC_NAMESPACE::open(TEST_FILE2, O_RDONLY); ASSERT_LT(fd2, 0); ASSERT_NE(libc_errno, 0); libc_errno = 0; - ASSERT_THAT(__llvm_libc::close(fd1), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(fd1), Succeeds(0)); - fd2 = __llvm_libc::open(TEST_FILE2, O_RDONLY); + fd2 = LIBC_NAMESPACE::open(TEST_FILE2, O_RDONLY); ASSERT_GT(fd2, 0); ASSERT_EQ(libc_errno, 0); - fd1 = __llvm_libc::open(TEST_FILE1, O_RDONLY); + fd1 = LIBC_NAMESPACE::open(TEST_FILE1, O_RDONLY); ASSERT_LT(fd1, 0); ASSERT_NE(libc_errno, 0); libc_errno = 0; - ASSERT_THAT(__llvm_libc::close(fd2), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(fd2), Succeeds(0)); - ASSERT_THAT(__llvm_libc::unlink(TEST_FILE1), Succeeds(0)); - ASSERT_THAT(__llvm_libc::unlink(TEST_FILE2), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE1), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE2), Succeeds(0)); struct rlimit current_limits; - ASSERT_THAT(__llvm_libc::getrlimit(RLIMIT_NOFILE, ¤t_limits), + ASSERT_THAT(LIBC_NAMESPACE::getrlimit(RLIMIT_NOFILE, ¤t_limits), Succeeds(0)); ASSERT_EQ(current_limits.rlim_cur, rlim_t(4)); ASSERT_EQ(current_limits.rlim_max, rlim_t(4)); diff --git a/libc/test/src/sys/select/select_failure_test.cpp b/libc/test/src/sys/select/select_failure_test.cpp index 44d5b2e..61df532 100644 --- a/libc/test/src/sys/select/select_failure_test.cpp +++ b/libc/test/src/sys/select/select_failure_test.cpp @@ -15,7 +15,7 @@ #include <sys/select.h> #include <unistd.h> -using __llvm_libc::testing::ErrnoSetterMatcher::Fails; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; TEST(LlvmLibcSelectTest, SelectInvalidFD) { fd_set set; @@ -23,6 +23,6 @@ TEST(LlvmLibcSelectTest, SelectInvalidFD) { struct timeval timeout { 0, 0 }; - ASSERT_THAT(__llvm_libc::select(-1, &set, nullptr, nullptr, &timeout), + ASSERT_THAT(LIBC_NAMESPACE::select(-1, &set, nullptr, nullptr, &timeout), Fails(EINVAL)); } diff --git a/libc/test/src/sys/select/select_ui_test.cpp b/libc/test/src/sys/select/select_ui_test.cpp index e10d1aa..2e6bace 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 9af01ad..6e4665a 100644 --- a/libc/test/src/sys/sendfile/sendfile_test.cpp +++ b/libc/test/src/sys/sendfile/sendfile_test.cpp @@ -20,11 +20,11 @@ #include <fcntl.h> #include <sys/stat.h> -namespace cpp = __llvm_libc::cpp; +namespace cpp = LIBC_NAMESPACE::cpp; TEST(LlvmLibcSendfileTest, CreateAndTransfer) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; // The test strategy is to // 1. Create a temporary file with known data. @@ -37,30 +37,30 @@ TEST(LlvmLibcSendfileTest, CreateAndTransfer) { constexpr ssize_t IN_SIZE = ssize_t(sizeof(IN_DATA)); libc_errno = 0; - int in_fd = __llvm_libc::open(IN_FILE, O_CREAT | O_WRONLY, S_IRWXU); + int in_fd = LIBC_NAMESPACE::open(IN_FILE, O_CREAT | O_WRONLY, S_IRWXU); ASSERT_GT(in_fd, 0); ASSERT_EQ(libc_errno, 0); - ASSERT_EQ(__llvm_libc::write(in_fd, IN_DATA, IN_SIZE), IN_SIZE); - ASSERT_THAT(__llvm_libc::close(in_fd), Succeeds(0)); + ASSERT_EQ(LIBC_NAMESPACE::write(in_fd, IN_DATA, IN_SIZE), IN_SIZE); + ASSERT_THAT(LIBC_NAMESPACE::close(in_fd), Succeeds(0)); - in_fd = __llvm_libc::open(IN_FILE, O_RDONLY); + in_fd = LIBC_NAMESPACE::open(IN_FILE, O_RDONLY); ASSERT_GT(in_fd, 0); ASSERT_EQ(libc_errno, 0); - int out_fd = __llvm_libc::open(OUT_FILE, O_CREAT | O_WRONLY, S_IRWXU); + int out_fd = LIBC_NAMESPACE::open(OUT_FILE, O_CREAT | O_WRONLY, S_IRWXU); ASSERT_GT(out_fd, 0); ASSERT_EQ(libc_errno, 0); - ssize_t size = __llvm_libc::sendfile(in_fd, out_fd, nullptr, IN_SIZE); + ssize_t size = LIBC_NAMESPACE::sendfile(in_fd, out_fd, nullptr, IN_SIZE); ASSERT_EQ(size, IN_SIZE); - ASSERT_THAT(__llvm_libc::close(in_fd), Succeeds(0)); - ASSERT_THAT(__llvm_libc::close(out_fd), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(in_fd), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(out_fd), Succeeds(0)); - out_fd = __llvm_libc::open(OUT_FILE, O_RDONLY); + out_fd = LIBC_NAMESPACE::open(OUT_FILE, O_RDONLY); ASSERT_GT(out_fd, 0); ASSERT_EQ(libc_errno, 0); char buf[IN_SIZE]; - ASSERT_EQ(IN_SIZE, __llvm_libc::read(out_fd, buf, IN_SIZE)); + ASSERT_EQ(IN_SIZE, LIBC_NAMESPACE::read(out_fd, buf, IN_SIZE)); ASSERT_EQ(cpp::string_view(buf), cpp::string_view(IN_DATA)); - ASSERT_THAT(__llvm_libc::unlink(IN_FILE), Succeeds(0)); - ASSERT_THAT(__llvm_libc::unlink(OUT_FILE), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::unlink(IN_FILE), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::unlink(OUT_FILE), Succeeds(0)); } diff --git a/libc/test/src/sys/socket/linux/socket_test.cpp b/libc/test/src/sys/socket/linux/socket_test.cpp index 6826594..9037888 100644 --- a/libc/test/src/sys/socket/linux/socket_test.cpp +++ b/libc/test/src/sys/socket/linux/socket_test.cpp @@ -16,9 +16,9 @@ #include <sys/socket.h> // For AF_LOCAL and SOCK_DGRAM TEST(LlvmLibcSocketTest, LocalSocket) { - int sock = __llvm_libc::socket(AF_LOCAL, SOCK_DGRAM, 0); + int sock = LIBC_NAMESPACE::socket(AF_LOCAL, SOCK_DGRAM, 0); ASSERT_GE(sock, 0); ASSERT_EQ(libc_errno, 0); - __llvm_libc::close(sock); + LIBC_NAMESPACE::close(sock); } diff --git a/libc/test/src/sys/stat/chmod_test.cpp b/libc/test/src/sys/stat/chmod_test.cpp index f12d20d..c476b92 100644 --- a/libc/test/src/sys/stat/chmod_test.cpp +++ b/libc/test/src/sys/stat/chmod_test.cpp @@ -18,8 +18,8 @@ #include <sys/stat.h> TEST(LlvmLibcChmodTest, ChangeAndOpen) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; // The test file is initially writable. We open it for writing and ensure // that it indeed can be opened for writing. Next, we close the file and @@ -30,34 +30,36 @@ TEST(LlvmLibcChmodTest, ChangeAndOpen) { constexpr ssize_t WRITE_SIZE = ssize_t(sizeof(WRITE_DATA)); libc_errno = 0; - int fd = __llvm_libc::open(TEST_FILE, O_APPEND | O_WRONLY); + int fd = LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_WRONLY); ASSERT_GT(fd, 0); ASSERT_EQ(libc_errno, 0); - ASSERT_EQ(__llvm_libc::write(fd, WRITE_DATA, sizeof(WRITE_DATA)), WRITE_SIZE); - ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0)); + ASSERT_EQ(LIBC_NAMESPACE::write(fd, WRITE_DATA, sizeof(WRITE_DATA)), + WRITE_SIZE); + ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0)); - fd = __llvm_libc::open(TEST_FILE, O_PATH); + fd = LIBC_NAMESPACE::open(TEST_FILE, O_PATH); ASSERT_GT(fd, 0); ASSERT_EQ(libc_errno, 0); - ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0)); - EXPECT_THAT(__llvm_libc::chmod(TEST_FILE, S_IRUSR), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0)); + EXPECT_THAT(LIBC_NAMESPACE::chmod(TEST_FILE, S_IRUSR), Succeeds(0)); // Opening for writing should fail. - EXPECT_EQ(__llvm_libc::open(TEST_FILE, O_APPEND | O_WRONLY), -1); + EXPECT_EQ(LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_WRONLY), -1); EXPECT_NE(libc_errno, 0); libc_errno = 0; // But opening for reading should succeed. - fd = __llvm_libc::open(TEST_FILE, O_APPEND | O_RDONLY); + fd = LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_RDONLY); EXPECT_GT(fd, 0); EXPECT_EQ(libc_errno, 0); - EXPECT_THAT(__llvm_libc::close(fd), Succeeds(0)); - EXPECT_THAT(__llvm_libc::chmod(TEST_FILE, S_IRWXU), Succeeds(0)); + EXPECT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0)); + EXPECT_THAT(LIBC_NAMESPACE::chmod(TEST_FILE, S_IRWXU), Succeeds(0)); } TEST(LlvmLibcChmodTest, NonExistentFile) { libc_errno = 0; - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - ASSERT_THAT(__llvm_libc::chmod("non-existent-file", S_IRUSR), Fails(ENOENT)); + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + ASSERT_THAT(LIBC_NAMESPACE::chmod("non-existent-file", S_IRUSR), + Fails(ENOENT)); libc_errno = 0; } diff --git a/libc/test/src/sys/stat/fchmod_test.cpp b/libc/test/src/sys/stat/fchmod_test.cpp index 0a6c9f4a..5a32b5c 100644 --- a/libc/test/src/sys/stat/fchmod_test.cpp +++ b/libc/test/src/sys/stat/fchmod_test.cpp @@ -18,8 +18,8 @@ #include <sys/stat.h> TEST(LlvmLibcChmodTest, ChangeAndOpen) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; // The test file is initially writable. We open it for writing and ensure // that it indeed can be opened for writing. Next, we close the file and @@ -30,34 +30,35 @@ TEST(LlvmLibcChmodTest, ChangeAndOpen) { constexpr ssize_t WRITE_SIZE = ssize_t(sizeof(WRITE_DATA)); libc_errno = 0; - int fd = __llvm_libc::open(TEST_FILE, O_APPEND | O_WRONLY); + int fd = LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_WRONLY); ASSERT_GT(fd, 0); ASSERT_EQ(libc_errno, 0); - ASSERT_EQ(__llvm_libc::write(fd, WRITE_DATA, sizeof(WRITE_DATA)), WRITE_SIZE); - ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0)); + ASSERT_EQ(LIBC_NAMESPACE::write(fd, WRITE_DATA, sizeof(WRITE_DATA)), + WRITE_SIZE); + ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0)); - fd = __llvm_libc::open(TEST_FILE, O_APPEND | O_WRONLY); + fd = LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_WRONLY); ASSERT_GT(fd, 0); ASSERT_EQ(libc_errno, 0); - EXPECT_THAT(__llvm_libc::fchmod(fd, S_IRUSR), Succeeds(0)); - ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0)); + EXPECT_THAT(LIBC_NAMESPACE::fchmod(fd, S_IRUSR), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0)); // Opening for writing should fail. - EXPECT_EQ(__llvm_libc::open(TEST_FILE, O_APPEND | O_WRONLY), -1); + EXPECT_EQ(LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_WRONLY), -1); EXPECT_NE(libc_errno, 0); libc_errno = 0; // But opening for reading should succeed. - fd = __llvm_libc::open(TEST_FILE, O_APPEND | O_RDONLY); + fd = LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_RDONLY); EXPECT_GT(fd, 0); EXPECT_EQ(libc_errno, 0); - EXPECT_THAT(__llvm_libc::fchmod(fd, S_IRWXU), Succeeds(0)); - EXPECT_THAT(__llvm_libc::close(fd), Succeeds(0)); + EXPECT_THAT(LIBC_NAMESPACE::fchmod(fd, S_IRWXU), Succeeds(0)); + EXPECT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0)); } TEST(LlvmLibcChmodTest, NonExistentFile) { libc_errno = 0; - ASSERT_EQ(__llvm_libc::fchmod(-1, S_IRUSR), -1); + ASSERT_EQ(LIBC_NAMESPACE::fchmod(-1, S_IRUSR), -1); ASSERT_NE(libc_errno, 0); libc_errno = 0; } diff --git a/libc/test/src/sys/stat/fchmodat_test.cpp b/libc/test/src/sys/stat/fchmodat_test.cpp index 578d0b0f..077d21d 100644 --- a/libc/test/src/sys/stat/fchmodat_test.cpp +++ b/libc/test/src/sys/stat/fchmodat_test.cpp @@ -18,8 +18,8 @@ #include <sys/stat.h> TEST(LlvmLibcFchmodatTest, ChangeAndOpen) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; // The test file is initially writable. We open it for writing and ensure // that it indeed can be opened for writing. Next, we close the file and @@ -32,39 +32,41 @@ TEST(LlvmLibcFchmodatTest, ChangeAndOpen) { constexpr ssize_t WRITE_SIZE = ssize_t(sizeof(WRITE_DATA)); libc_errno = 0; - int fd = __llvm_libc::open(TEST_FILE, O_CREAT | O_WRONLY, S_IRWXU); + int fd = LIBC_NAMESPACE::open(TEST_FILE, O_CREAT | O_WRONLY, S_IRWXU); ASSERT_GT(fd, 0); ASSERT_EQ(libc_errno, 0); - ASSERT_EQ(__llvm_libc::write(fd, WRITE_DATA, sizeof(WRITE_DATA)), WRITE_SIZE); - ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0)); + ASSERT_EQ(LIBC_NAMESPACE::write(fd, WRITE_DATA, sizeof(WRITE_DATA)), + WRITE_SIZE); + ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0)); - int dirfd = __llvm_libc::open(TEST_DIR, O_DIRECTORY); + int dirfd = LIBC_NAMESPACE::open(TEST_DIR, O_DIRECTORY); ASSERT_GT(dirfd, 0); ASSERT_EQ(libc_errno, 0); - EXPECT_THAT(__llvm_libc::fchmodat(dirfd, TEST_FILE_BASENAME, S_IRUSR, 0), + EXPECT_THAT(LIBC_NAMESPACE::fchmodat(dirfd, TEST_FILE_BASENAME, S_IRUSR, 0), Succeeds(0)); // Opening for writing should fail. - EXPECT_EQ(__llvm_libc::open(TEST_FILE, O_APPEND | O_WRONLY), -1); + EXPECT_EQ(LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_WRONLY), -1); EXPECT_NE(libc_errno, 0); libc_errno = 0; // But opening for reading should succeed. - fd = __llvm_libc::open(TEST_FILE, O_APPEND | O_RDONLY); + fd = LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_RDONLY); EXPECT_GT(fd, 0); EXPECT_EQ(libc_errno, 0); - EXPECT_THAT(__llvm_libc::close(fd), Succeeds(0)); - EXPECT_THAT(__llvm_libc::fchmodat(dirfd, TEST_FILE_BASENAME, S_IRWXU, 0), + EXPECT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0)); + EXPECT_THAT(LIBC_NAMESPACE::fchmodat(dirfd, TEST_FILE_BASENAME, S_IRWXU, 0), Succeeds(0)); - EXPECT_THAT(__llvm_libc::close(dirfd), Succeeds(0)); + EXPECT_THAT(LIBC_NAMESPACE::close(dirfd), Succeeds(0)); } TEST(LlvmLibcFchmodatTest, NonExistentFile) { libc_errno = 0; - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - ASSERT_THAT(__llvm_libc::fchmodat(AT_FDCWD, "non-existent-file", S_IRUSR, 0), - Fails(ENOENT)); + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + ASSERT_THAT( + LIBC_NAMESPACE::fchmodat(AT_FDCWD, "non-existent-file", S_IRUSR, 0), + Fails(ENOENT)); libc_errno = 0; } diff --git a/libc/test/src/sys/stat/fstat_test.cpp b/libc/test/src/sys/stat/fstat_test.cpp index 8220181..22e407f 100644 --- a/libc/test/src/sys/stat/fstat_test.cpp +++ b/libc/test/src/sys/stat/fstat_test.cpp @@ -18,8 +18,8 @@ #include <sys/stat.h> TEST(LlvmLibcFStatTest, CreatAndReadMode) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; // The test file is initially writable. We open it for writing and ensure // that it indeed can be opened for writing. Next, we close the file and @@ -28,23 +28,23 @@ TEST(LlvmLibcFStatTest, CreatAndReadMode) { constexpr const char *TEST_FILE = "testdata/fstat.test"; libc_errno = 0; - int fd = __llvm_libc::open(TEST_FILE, O_CREAT | O_WRONLY, S_IRWXU); + int fd = LIBC_NAMESPACE::open(TEST_FILE, O_CREAT | O_WRONLY, S_IRWXU); ASSERT_GT(fd, 0); ASSERT_EQ(libc_errno, 0); struct stat statbuf; - ASSERT_THAT(__llvm_libc::fstat(fd, &statbuf), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::fstat(fd, &statbuf), Succeeds(0)); ASSERT_EQ(int(statbuf.st_mode), int(S_IRWXU | S_IFREG)); - ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0)); - ASSERT_THAT(__llvm_libc::unlink(TEST_FILE), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE), Succeeds(0)); } TEST(LlvmLibcFStatTest, NonExistentFile) { libc_errno = 0; - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; struct stat statbuf; - ASSERT_THAT(__llvm_libc::fstat(-1, &statbuf), Fails(EBADF)); + ASSERT_THAT(LIBC_NAMESPACE::fstat(-1, &statbuf), Fails(EBADF)); libc_errno = 0; } diff --git a/libc/test/src/sys/stat/lstat_test.cpp b/libc/test/src/sys/stat/lstat_test.cpp index a3edae1..6eae08d 100644 --- a/libc/test/src/sys/stat/lstat_test.cpp +++ b/libc/test/src/sys/stat/lstat_test.cpp @@ -18,8 +18,8 @@ #include <sys/stat.h> TEST(LlvmLibcLStatTest, CreatAndReadMode) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; // The test file is initially writable. We open it for writing and ensure // that it indeed can be opened for writing. Next, we close the file and @@ -28,23 +28,24 @@ TEST(LlvmLibcLStatTest, CreatAndReadMode) { constexpr const char *TEST_FILE = "testdata/lstat.test"; libc_errno = 0; - int fd = __llvm_libc::open(TEST_FILE, O_CREAT | O_WRONLY, S_IRWXU); + int fd = LIBC_NAMESPACE::open(TEST_FILE, O_CREAT | O_WRONLY, S_IRWXU); ASSERT_GT(fd, 0); ASSERT_EQ(libc_errno, 0); - ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0)); struct stat statbuf; - ASSERT_THAT(__llvm_libc::lstat(TEST_FILE, &statbuf), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::lstat(TEST_FILE, &statbuf), Succeeds(0)); ASSERT_EQ(int(statbuf.st_mode), int(S_IRWXU | S_IFREG)); - ASSERT_THAT(__llvm_libc::unlink(TEST_FILE), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE), Succeeds(0)); } TEST(LlvmLibcLStatTest, NonExistentFile) { libc_errno = 0; - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; struct stat statbuf; - ASSERT_THAT(__llvm_libc::lstat("non-existent-file", &statbuf), Fails(ENOENT)); + ASSERT_THAT(LIBC_NAMESPACE::lstat("non-existent-file", &statbuf), + Fails(ENOENT)); libc_errno = 0; } diff --git a/libc/test/src/sys/stat/mkdirat_test.cpp b/libc/test/src/sys/stat/mkdirat_test.cpp index 584f6eb..ae11af4 100644 --- a/libc/test/src/sys/stat/mkdirat_test.cpp +++ b/libc/test/src/sys/stat/mkdirat_test.cpp @@ -14,14 +14,16 @@ #include <fcntl.h> TEST(LlvmLibcMkdiratTest, CreateAndRemove) { - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; constexpr const char *TEST_DIR = "testdata/mkdirat.testdir"; - ASSERT_THAT(__llvm_libc::mkdirat(AT_FDCWD, TEST_DIR, S_IRWXU), Succeeds(0)); - ASSERT_THAT(__llvm_libc::rmdir(TEST_DIR), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::mkdirat(AT_FDCWD, TEST_DIR, S_IRWXU), + Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::rmdir(TEST_DIR), Succeeds(0)); } TEST(LlvmLibcMkdiratTest, BadPath) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - ASSERT_THAT(__llvm_libc::mkdirat(AT_FDCWD, "non-existent-dir/test", S_IRWXU), - Fails(ENOENT)); + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + ASSERT_THAT( + LIBC_NAMESPACE::mkdirat(AT_FDCWD, "non-existent-dir/test", S_IRWXU), + Fails(ENOENT)); } diff --git a/libc/test/src/sys/stat/stat_test.cpp b/libc/test/src/sys/stat/stat_test.cpp index dd9bb1c..1711c86 100644 --- a/libc/test/src/sys/stat/stat_test.cpp +++ b/libc/test/src/sys/stat/stat_test.cpp @@ -18,8 +18,8 @@ #include <sys/stat.h> TEST(LlvmLibcStatTest, CreatAndReadMode) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; // The test file is initially writable. We open it for writing and ensure // that it indeed can be opened for writing. Next, we close the file and @@ -28,23 +28,24 @@ TEST(LlvmLibcStatTest, CreatAndReadMode) { constexpr const char *TEST_FILE = "testdata/stat.test"; libc_errno = 0; - int fd = __llvm_libc::open(TEST_FILE, O_CREAT | O_WRONLY, S_IRWXU); + int fd = LIBC_NAMESPACE::open(TEST_FILE, O_CREAT | O_WRONLY, S_IRWXU); ASSERT_GT(fd, 0); ASSERT_EQ(libc_errno, 0); - ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0)); struct stat statbuf; - ASSERT_THAT(__llvm_libc::stat(TEST_FILE, &statbuf), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::stat(TEST_FILE, &statbuf), Succeeds(0)); ASSERT_EQ(int(statbuf.st_mode), int(S_IRWXU | S_IFREG)); - ASSERT_THAT(__llvm_libc::unlink(TEST_FILE), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE), Succeeds(0)); } TEST(LlvmLibcStatTest, NonExistentFile) { libc_errno = 0; - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; struct stat statbuf; - ASSERT_THAT(__llvm_libc::stat("non-existent-file", &statbuf), Fails(ENOENT)); + ASSERT_THAT(LIBC_NAMESPACE::stat("non-existent-file", &statbuf), + Fails(ENOENT)); libc_errno = 0; } diff --git a/libc/test/src/sys/utsname/uname_test.cpp b/libc/test/src/sys/utsname/uname_test.cpp index 58d7db7..79822c1 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 a7ea9ee..70d4d43 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 64441e7..b2ace26 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 01a78c2..3048f9c 100644 --- a/libc/test/src/termios/termios_test.cpp +++ b/libc/test/src/termios/termios_test.cpp @@ -21,8 +21,8 @@ #include <termios.h> -using __llvm_libc::testing::ErrnoSetterMatcher::Fails; -using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; // We just list a bunch of smoke tests here as it is not possible to // test functionality at the least because we want to run the tests @@ -31,34 +31,34 @@ using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; TEST(LlvmLibcTermiosTest, SpeedSmokeTest) { struct termios t; libc_errno = 0; - ASSERT_THAT(__llvm_libc::cfsetispeed(&t, B50), Succeeds(0)); - ASSERT_EQ(__llvm_libc::cfgetispeed(&t), speed_t(B50)); - ASSERT_THAT(__llvm_libc::cfsetospeed(&t, B75), Succeeds(0)); - ASSERT_EQ(__llvm_libc::cfgetospeed(&t), speed_t(B75)); + ASSERT_THAT(LIBC_NAMESPACE::cfsetispeed(&t, B50), Succeeds(0)); + ASSERT_EQ(LIBC_NAMESPACE::cfgetispeed(&t), speed_t(B50)); + ASSERT_THAT(LIBC_NAMESPACE::cfsetospeed(&t, B75), Succeeds(0)); + ASSERT_EQ(LIBC_NAMESPACE::cfgetospeed(&t), speed_t(B75)); libc_errno = 0; - ASSERT_THAT(__llvm_libc::cfsetispeed(&t, ~CBAUD), Fails(EINVAL)); + ASSERT_THAT(LIBC_NAMESPACE::cfsetispeed(&t, ~CBAUD), Fails(EINVAL)); libc_errno = 0; - ASSERT_THAT(__llvm_libc::cfsetospeed(&t, ~CBAUD), Fails(EINVAL)); + ASSERT_THAT(LIBC_NAMESPACE::cfsetospeed(&t, ~CBAUD), Fails(EINVAL)); } TEST(LlvmLibcTermiosTest, GetAttrSmokeTest) { struct termios t; libc_errno = 0; - int fd = __llvm_libc::open("/dev/tty", O_RDONLY); + int fd = LIBC_NAMESPACE::open("/dev/tty", O_RDONLY); if (fd < 0) return; // When /dev/tty is not available, no point continuing. ASSERT_EQ(libc_errno, 0); - ASSERT_THAT(__llvm_libc::tcgetattr(fd, &t), Succeeds(0)); - ASSERT_EQ(__llvm_libc::close(fd), 0); + ASSERT_THAT(LIBC_NAMESPACE::tcgetattr(fd, &t), Succeeds(0)); + ASSERT_EQ(LIBC_NAMESPACE::close(fd), 0); } TEST(LlvmLibcTermiosTest, TcGetSidSmokeTest) { libc_errno = 0; - int fd = __llvm_libc::open("/dev/tty", O_RDONLY); + int fd = LIBC_NAMESPACE::open("/dev/tty", O_RDONLY); if (fd < 0) return; // When /dev/tty is not available, no point continuing. ASSERT_EQ(libc_errno, 0); - ASSERT_GT(__llvm_libc::tcgetsid(fd), pid_t(0)); - ASSERT_EQ(__llvm_libc::close(fd), 0); + ASSERT_GT(LIBC_NAMESPACE::tcgetsid(fd), pid_t(0)); + ASSERT_EQ(LIBC_NAMESPACE::close(fd), 0); } diff --git a/libc/test/src/time/TmHelper.h b/libc/test/src/time/TmHelper.h index 54d9f4e..1920203 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 fb2d57b..7cdc2c4 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 @@ public: }; } // 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 9682f18..1abaa13 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 3df2edf..4b5ceb5 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 58f9c61..6367ae7 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 fc7e5b5..a3dffc6 100644 --- a/libc/test/src/time/clock_test.cpp +++ b/libc/test/src/time/clock_test.cpp @@ -13,9 +13,9 @@ #include <time.h> TEST(LlvmLibcClockTest, SmokeTest) { - clock_t c1 = __llvm_libc::clock(); + clock_t c1 = LIBC_NAMESPACE::clock(); ASSERT_GT(c1, clock_t(0)); - clock_t c2 = __llvm_libc::clock(); + clock_t c2 = LIBC_NAMESPACE::clock(); ASSERT_GE(c2, c1); } diff --git a/libc/test/src/time/difftime_test.cpp b/libc/test/src/time/difftime_test.cpp index dc22494..187df4a 100644 --- a/libc/test/src/time/difftime_test.cpp +++ b/libc/test/src/time/difftime_test.cpp @@ -12,23 +12,23 @@ #include "test/UnitTest/ErrnoSetterMatcher.h" #include "test/UnitTest/Test.h" -using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; -using __llvm_libc::time_utils::TimeConstants; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; +using LIBC_NAMESPACE::time_utils::TimeConstants; TEST(LlvmLibcDifftime, SmokeTest) { time_t t1_seconds = TimeConstants::SECONDS_PER_HOUR; time_t t2_seconds = 0; - __llvm_libc::fputil::FPBits<long double> expected_fp = - __llvm_libc::fputil::FPBits<long double>(); - expected_fp = __llvm_libc::fputil::FPBits<long double>( + LIBC_NAMESPACE::fputil::FPBits<long double> expected_fp = + LIBC_NAMESPACE::fputil::FPBits<long double>(); + expected_fp = LIBC_NAMESPACE::fputil::FPBits<long double>( static_cast<long double>(t1_seconds)); - double result = __llvm_libc::difftime(t1_seconds, t2_seconds); + double result = LIBC_NAMESPACE::difftime(t1_seconds, t2_seconds); - __llvm_libc::fputil::FPBits<long double> actual_fp = - __llvm_libc::fputil::FPBits<long double>(); - actual_fp = __llvm_libc::fputil::FPBits<long double>( + LIBC_NAMESPACE::fputil::FPBits<long double> actual_fp = + LIBC_NAMESPACE::fputil::FPBits<long double>(); + actual_fp = LIBC_NAMESPACE::fputil::FPBits<long double>( static_cast<long double>(result)); EXPECT_EQ(actual_fp.bits, expected_fp.bits); diff --git a/libc/test/src/time/gettimeofday_test.cpp b/libc/test/src/time/gettimeofday_test.cpp index a852d4f..4425078 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 0d210b6..2276b48 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 4d990b3..6b1d029a 100644 --- a/libc/test/src/time/gmtime_test.cpp +++ b/libc/test/src/time/gmtime_test.cpp @@ -15,9 +15,9 @@ #include <limits.h> -using __llvm_libc::testing::ErrnoSetterMatcher::Fails; -using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; -using __llvm_libc::time_utils::TimeConstants; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; +using LIBC_NAMESPACE::time_utils::TimeConstants; TEST(LlvmLibcGmTime, OutOfRange) { if (sizeof(time_t) < sizeof(int64_t)) @@ -25,7 +25,7 @@ TEST(LlvmLibcGmTime, OutOfRange) { time_t seconds = 1 + INT_MAX * static_cast<int64_t>( TimeConstants::NUMBER_OF_SECONDS_IN_LEAP_YEAR); - struct tm *tm_data = __llvm_libc::gmtime(&seconds); + struct tm *tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TRUE(tm_data == nullptr); EXPECT_EQ(libc_errno, EOVERFLOW); @@ -33,7 +33,7 @@ TEST(LlvmLibcGmTime, OutOfRange) { seconds = INT_MIN * static_cast<int64_t>( TimeConstants::NUMBER_OF_SECONDS_IN_LEAP_YEAR) - 1; - tm_data = __llvm_libc::gmtime(&seconds); + tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TRUE(tm_data == nullptr); EXPECT_EQ(libc_errno, EOVERFLOW); } @@ -43,7 +43,7 @@ TEST(LlvmLibcGmTime, InvalidSeconds) { struct tm *tm_data = nullptr; // -1 second from 1970-01-01 00:00:00 returns 1969-12-31 23:59:59. seconds = -1; - tm_data = __llvm_libc::gmtime(&seconds); + tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{59, // sec 59, // min 23, // hr @@ -56,7 +56,7 @@ TEST(LlvmLibcGmTime, InvalidSeconds) { *tm_data); // 60 seconds from 1970-01-01 00:00:00 returns 1970-01-01 00:01:00. seconds = 60; - tm_data = __llvm_libc::gmtime(&seconds); + tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{0, // sec 1, // min 0, // hr @@ -74,7 +74,7 @@ TEST(LlvmLibcGmTime, InvalidMinutes) { struct tm *tm_data = nullptr; // -1 minute from 1970-01-01 00:00:00 returns 1969-12-31 23:59:00. seconds = -TimeConstants::SECONDS_PER_MIN; - tm_data = __llvm_libc::gmtime(&seconds); + tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{0, // sec 59, // min 23, // hr @@ -87,7 +87,7 @@ TEST(LlvmLibcGmTime, InvalidMinutes) { *tm_data); // 60 minutes from 1970-01-01 00:00:00 returns 1970-01-01 01:00:00. seconds = 60 * TimeConstants::SECONDS_PER_MIN; - tm_data = __llvm_libc::gmtime(&seconds); + tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{0, // sec 0, // min 1, // hr @@ -105,7 +105,7 @@ TEST(LlvmLibcGmTime, InvalidHours) { struct tm *tm_data = nullptr; // -1 hour from 1970-01-01 00:00:00 returns 1969-12-31 23:00:00. seconds = -TimeConstants::SECONDS_PER_HOUR; - tm_data = __llvm_libc::gmtime(&seconds); + tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{0, // sec 0, // min 23, // hr @@ -118,7 +118,7 @@ TEST(LlvmLibcGmTime, InvalidHours) { *tm_data); // 24 hours from 1970-01-01 00:00:00 returns 1970-01-02 00:00:00. seconds = 24 * TimeConstants::SECONDS_PER_HOUR; - tm_data = __llvm_libc::gmtime(&seconds); + tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{0, // sec 0, // min 0, // hr @@ -135,7 +135,7 @@ TEST(LlvmLibcGmTime, InvalidYear) { // -1 year from 1970-01-01 00:00:00 returns 1969-01-01 00:00:00. time_t seconds = -TimeConstants::DAYS_PER_NON_LEAP_YEAR * TimeConstants::SECONDS_PER_DAY; - struct tm *tm_data = __llvm_libc::gmtime(&seconds); + struct tm *tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{0, // sec 0, // min 0, // hr @@ -153,7 +153,7 @@ TEST(LlvmLibcGmTime, InvalidMonths) { struct tm *tm_data = nullptr; // -1 month from 1970-01-01 00:00:00 returns 1969-12-01 00:00:00. seconds = -31 * TimeConstants::SECONDS_PER_DAY; - tm_data = __llvm_libc::gmtime(&seconds); + tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{0, // sec 0, // min 0, // hr @@ -167,7 +167,7 @@ TEST(LlvmLibcGmTime, InvalidMonths) { // 1970-13-01 00:00:00 returns 1971-01-01 00:00:00. seconds = TimeConstants::DAYS_PER_NON_LEAP_YEAR * TimeConstants::SECONDS_PER_DAY; - tm_data = __llvm_libc::gmtime(&seconds); + tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{0, // sec 0, // min 0, // hr @@ -185,7 +185,7 @@ TEST(LlvmLibcGmTime, InvalidDays) { struct tm *tm_data = nullptr; // -1 day from 1970-01-01 00:00:00 returns 1969-12-31 00:00:00. seconds = -1 * TimeConstants::SECONDS_PER_DAY; - tm_data = __llvm_libc::gmtime(&seconds); + tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{0, // sec 0, // min 0, // hr @@ -199,7 +199,7 @@ TEST(LlvmLibcGmTime, InvalidDays) { // 1970-01-32 00:00:00 returns 1970-02-01 00:00:00. seconds = 31 * TimeConstants::SECONDS_PER_DAY; - tm_data = __llvm_libc::gmtime(&seconds); + tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{0, // sec 0, // min 0, // hr @@ -213,7 +213,7 @@ TEST(LlvmLibcGmTime, InvalidDays) { // 1970-02-29 00:00:00 returns 1970-03-01 00:00:00. seconds = 59 * TimeConstants::SECONDS_PER_DAY; - tm_data = __llvm_libc::gmtime(&seconds); + tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{0, // sec 0, // min 0, // hr @@ -228,7 +228,7 @@ TEST(LlvmLibcGmTime, InvalidDays) { // 1972-02-30 00:00:00 returns 1972-03-01 00:00:00. seconds = ((2 * TimeConstants::DAYS_PER_NON_LEAP_YEAR) + 60) * TimeConstants::SECONDS_PER_DAY; - tm_data = __llvm_libc::gmtime(&seconds); + tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{0, // sec 0, // min 0, // hr @@ -245,7 +245,7 @@ TEST(LlvmLibcGmTime, EndOf32BitEpochYear) { // Test for maximum value of a signed 32-bit integer. // Test implementation can encode time for Tue 19 January 2038 03:14:07 UTC. time_t seconds = 0x7FFFFFFF; - struct tm *tm_data = __llvm_libc::gmtime(&seconds); + struct tm *tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{7, // sec 14, // min 3, // hr @@ -263,7 +263,7 @@ TEST(LlvmLibcGmTime, Max64BitYear) { return; // Mon Jan 1 12:50:50 2170 (200 years from 1970), time_t seconds = 6311479850; - struct tm *tm_data = __llvm_libc::gmtime(&seconds); + struct tm *tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{50, // sec 50, // min 12, // hr @@ -277,7 +277,7 @@ TEST(LlvmLibcGmTime, Max64BitYear) { // Test for Tue Jan 1 12:50:50 in 2,147,483,647th year. seconds = 67767976202043050; - tm_data = __llvm_libc::gmtime(&seconds); + tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{50, // sec 50, // min 12, // hr diff --git a/libc/test/src/time/mktime_test.cpp b/libc/test/src/time/mktime_test.cpp index 6cf115e..753363e 100644 --- a/libc/test/src/time/mktime_test.cpp +++ b/libc/test/src/time/mktime_test.cpp @@ -15,9 +15,9 @@ #include <limits.h> -using __llvm_libc::testing::ErrnoSetterMatcher::Fails; -using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; -using __llvm_libc::time_utils::Month; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; +using LIBC_NAMESPACE::time_utils::Month; static inline constexpr int tm_year(int year) { return year - TimeConstants::TIME_YEAR_BASE; @@ -29,7 +29,7 @@ TEST(LlvmLibcMkTime, FailureSetsErrno) { .tm_mday = INT_MAX, .tm_mon = INT_MAX - 1, .tm_year = tm_year(INT_MAX), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), Fails(EOVERFLOW)); + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Fails(EOVERFLOW)); } TEST(LlvmLibcMkTime, InvalidSeconds) { @@ -40,7 +40,7 @@ TEST(LlvmLibcMkTime, InvalidSeconds) { .tm_mon = Month::JANUARY, .tm_year = tm_year(1970), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), Succeeds(-1)); + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(-1)); EXPECT_TM_EQ((tm{.tm_sec = 59, .tm_min = 59, .tm_hour = 23, @@ -59,7 +59,7 @@ TEST(LlvmLibcMkTime, InvalidSeconds) { .tm_mon = Month::JANUARY, .tm_year = tm_year(1970), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), Succeeds(60)); + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(60)); EXPECT_TM_EQ((tm{.tm_sec = 0, .tm_min = 1, .tm_hour = 0, @@ -80,7 +80,7 @@ TEST(LlvmLibcMkTime, InvalidMinutes) { .tm_mon = Month::JANUARY, .tm_year = tm_year(1970), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(-TimeConstants::SECONDS_PER_MIN)); EXPECT_TM_EQ((tm{.tm_sec = 0, .tm_min = 59, @@ -100,7 +100,7 @@ TEST(LlvmLibcMkTime, InvalidMinutes) { .tm_mon = Month::JANUARY, .tm_year = tm_year(1970), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(60 * TimeConstants::SECONDS_PER_MIN)); EXPECT_TM_EQ((tm{.tm_sec = 0, .tm_min = 0, @@ -122,7 +122,7 @@ TEST(LlvmLibcMkTime, InvalidHours) { .tm_mon = Month::JANUARY, .tm_year = tm_year(1970), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(-TimeConstants::SECONDS_PER_HOUR)); EXPECT_TM_EQ((tm{.tm_sec = 0, .tm_min = 0, @@ -142,7 +142,7 @@ TEST(LlvmLibcMkTime, InvalidHours) { .tm_mon = Month::JANUARY, .tm_year = tm_year(1970), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(24 * TimeConstants::SECONDS_PER_HOUR)); EXPECT_TM_EQ((tm{.tm_sec = 0, .tm_min = 0, @@ -163,7 +163,7 @@ TEST(LlvmLibcMkTime, InvalidYear) { .tm_mon = Month::JANUARY, .tm_year = tm_year(1969), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(-TimeConstants::DAYS_PER_NON_LEAP_YEAR * TimeConstants::SECONDS_PER_DAY)); EXPECT_TM_EQ((tm{.tm_sec = 0, @@ -187,7 +187,7 @@ TEST(LlvmLibcMkTime, InvalidEndOf32BitEpochYear) { .tm_mon = Month::JANUARY, .tm_year = tm_year(2038), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), Fails(EOVERFLOW)); + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Fails(EOVERFLOW)); } { @@ -197,7 +197,7 @@ TEST(LlvmLibcMkTime, InvalidEndOf32BitEpochYear) { .tm_mon = Month::JANUARY, .tm_year = tm_year(2038), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), Fails(EOVERFLOW)); + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Fails(EOVERFLOW)); } { @@ -207,7 +207,7 @@ TEST(LlvmLibcMkTime, InvalidEndOf32BitEpochYear) { .tm_mon = Month::JANUARY, .tm_year = tm_year(2038), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), Fails(EOVERFLOW)); + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Fails(EOVERFLOW)); } { @@ -217,7 +217,7 @@ TEST(LlvmLibcMkTime, InvalidEndOf32BitEpochYear) { .tm_mon = Month::JANUARY, .tm_year = tm_year(2038), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), Fails(EOVERFLOW)); + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Fails(EOVERFLOW)); } { @@ -227,7 +227,7 @@ TEST(LlvmLibcMkTime, InvalidEndOf32BitEpochYear) { .tm_mon = Month::FEBRUARY, .tm_year = tm_year(2038), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), Fails(EOVERFLOW)); + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Fails(EOVERFLOW)); } { @@ -237,7 +237,7 @@ TEST(LlvmLibcMkTime, InvalidEndOf32BitEpochYear) { .tm_mon = Month::JANUARY, .tm_year = tm_year(2039), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), Fails(EOVERFLOW)); + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Fails(EOVERFLOW)); } } @@ -248,7 +248,7 @@ TEST(LlvmLibcMkTime, InvalidMonths) { .tm_sec = 0, .tm_min = 0, .tm_hour = 0, .tm_mday = 0, .tm_mon = -1, .tm_year = tm_year(1970), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(-32 * TimeConstants::SECONDS_PER_DAY)); EXPECT_TM_EQ((tm{.tm_sec = 0, .tm_min = 0, @@ -267,7 +267,7 @@ TEST(LlvmLibcMkTime, InvalidMonths) { .tm_sec = 0, .tm_min = 0, .tm_hour = 0, .tm_mday = 1, .tm_mon = 12, .tm_year = tm_year(1970), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(TimeConstants::DAYS_PER_NON_LEAP_YEAR * TimeConstants::SECONDS_PER_DAY)); EXPECT_TM_EQ((tm{.tm_sec = 0, @@ -290,7 +290,7 @@ TEST(LlvmLibcMkTime, InvalidDays) { .tm_mon = Month::JANUARY, .tm_year = tm_year(1970), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(-1 * TimeConstants::SECONDS_PER_DAY)); EXPECT_TM_EQ((tm{.tm_sec = 0, .tm_min = 0, @@ -310,7 +310,7 @@ TEST(LlvmLibcMkTime, InvalidDays) { .tm_mon = Month::JANUARY, .tm_year = tm_year(1970), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(31 * TimeConstants::SECONDS_PER_DAY)); EXPECT_TM_EQ((tm{.tm_sec = 0, .tm_min = 0, @@ -330,7 +330,7 @@ TEST(LlvmLibcMkTime, InvalidDays) { .tm_mon = Month::FEBRUARY, .tm_year = tm_year(1970), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(59 * TimeConstants::SECONDS_PER_DAY)); EXPECT_TM_EQ((tm{.tm_sec = 0, .tm_min = 0, @@ -350,7 +350,7 @@ TEST(LlvmLibcMkTime, InvalidDays) { .tm_mon = Month::FEBRUARY, .tm_year = tm_year(1972), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(((2 * TimeConstants::DAYS_PER_NON_LEAP_YEAR) + 60) * TimeConstants::SECONDS_PER_DAY)); EXPECT_TM_EQ((tm{.tm_sec = 0, @@ -373,7 +373,7 @@ TEST(LlvmLibcMkTime, EndOf32BitEpochYear) { .tm_mon = Month::JANUARY, .tm_year = tm_year(2038), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), Succeeds(0x7FFFFFFF)); + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(0x7FFFFFFF)); EXPECT_TM_EQ((tm{.tm_sec = 7, .tm_min = 14, .tm_hour = 3, @@ -395,7 +395,7 @@ TEST(LlvmLibcMkTime, Max64BitYear) { .tm_mon = Month::JANUARY, .tm_year = tm_year(2170), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), Succeeds(6311479850)); + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(6311479850)); EXPECT_TM_EQ((tm{.tm_sec = 50, .tm_min = 50, .tm_hour = 12, @@ -414,7 +414,7 @@ TEST(LlvmLibcMkTime, Max64BitYear) { .tm_mon = Month::JANUARY, .tm_year = tm_year(2147483647), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), Succeeds(67767976202043050)); + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(67767976202043050)); EXPECT_TM_EQ((tm{.tm_sec = 50, .tm_min = 50, .tm_hour = 12, diff --git a/libc/test/src/time/nanosleep_test.cpp b/libc/test/src/time/nanosleep_test.cpp index e89d4fd..2826ed1 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 92fd8e4..1d938e8 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 2fb11fe..f2e2293 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 f0fa9de..ed1fe96 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 a19fb29..dfdeacd 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 bde5b96..ff870db 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 11a540c..279cfbf 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 9a0f805..38c4391 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 3e04acd..27d4489 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 217ab95..ae743b3 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 6ac6aba..aa8e2e6 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 0fcf941..1ca7c99 100644 --- a/libc/test/src/unistd/getopt_test.cpp +++ b/libc/test/src/unistd/getopt_test.cpp @@ -15,7 +15,7 @@ #include <stdio.h> -using __llvm_libc::cpp::array; +using LIBC_NAMESPACE::cpp::array; namespace test_globals { char *optarg; @@ -29,7 +29,7 @@ unsigned optpos; // This can't be a constructor because it will get run before the constructor // which sets the default state in getopt. void set_state(FILE *errstream) { - __llvm_libc::impl::set_getopt_state( + LIBC_NAMESPACE::impl::set_getopt_state( &test_globals::optarg, &test_globals::optind, &test_globals::optopt, &test_globals::optpos, &test_globals::opterr, errstream); } @@ -52,16 +52,18 @@ static cookie_io_functions_t cookie{nullptr, &cookie_write, nullptr, nullptr}; // doesn't currently support fmemopen but does have fopencookie. In the future // just use that instead. This memopen does no error checking for the size // of the buffer, etc. -FILE *memopen(char **pos) { return __llvm_libc::fopencookie(pos, "w", cookie); } +FILE *memopen(char **pos) { + return LIBC_NAMESPACE::fopencookie(pos, "w", cookie); +} -struct LlvmLibcGetoptTest : public __llvm_libc::testing::Test { +struct LlvmLibcGetoptTest : public LIBC_NAMESPACE::testing::Test { FILE *errstream; char buf[256]; char *pos = buf; void reset_errstream() { pos = buf; } const char *get_error_msg() { - __llvm_libc::fflush(errstream); + LIBC_NAMESPACE::fflush(errstream); return buf; } @@ -85,32 +87,32 @@ TEST_F(LlvmLibcGetoptTest, NoMatch) { array<char *, 3> argv{"prog"_c, "arg1"_c, nullptr}; // optind >= argc - EXPECT_EQ(__llvm_libc::getopt(1, argv.data(), "..."), -1); + EXPECT_EQ(LIBC_NAMESPACE::getopt(1, argv.data(), "..."), -1); // argv[optind] == nullptr test_globals::optind = 2; - EXPECT_EQ(__llvm_libc::getopt(100, argv.data(), "..."), -1); + EXPECT_EQ(LIBC_NAMESPACE::getopt(100, argv.data(), "..."), -1); // argv[optind][0] != '-' test_globals::optind = 1; - EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), "a"), -1); + EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), "a"), -1); ASSERT_EQ(test_globals::optind, 1); // argv[optind] == "-" argv[1] = "-"_c; - EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), "a"), -1); + EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), "a"), -1); ASSERT_EQ(test_globals::optind, 1); // argv[optind] == "--", then return -1 and incremement optind argv[1] = "--"_c; - EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), "a"), -1); + EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), "a"), -1); EXPECT_EQ(test_globals::optind, 2); } TEST_F(LlvmLibcGetoptTest, WrongMatch) { array<char *, 3> argv{"prog"_c, "-b"_c, nullptr}; - EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), "a"), int('?')); + EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), "a"), int('?')); EXPECT_EQ(test_globals::optopt, (int)'b'); EXPECT_EQ(test_globals::optind, 1); EXPECT_STREQ(get_error_msg(), "prog: illegal option -- b\n"); @@ -121,7 +123,7 @@ TEST_F(LlvmLibcGetoptTest, OpterrFalse) { test_globals::opterr = 0; set_state(errstream); - EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), "a"), int('?')); + EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), "a"), int('?')); EXPECT_EQ(test_globals::optopt, (int)'b'); EXPECT_EQ(test_globals::optind, 1); EXPECT_STREQ(get_error_msg(), ""); @@ -130,11 +132,11 @@ TEST_F(LlvmLibcGetoptTest, OpterrFalse) { TEST_F(LlvmLibcGetoptTest, MissingArg) { array<char *, 3> argv{"prog"_c, "-b"_c, nullptr}; - EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), ":b:"), (int)':'); + EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), ":b:"), (int)':'); ASSERT_EQ(test_globals::optind, 1); EXPECT_STREQ(get_error_msg(), "prog: option requires an argument -- b\n"); reset_errstream(); - EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), "b:"), int('?')); + EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), "b:"), int('?')); EXPECT_EQ(test_globals::optind, 1); EXPECT_STREQ(get_error_msg(), "prog: option requires an argument -- b\n"); } @@ -142,7 +144,7 @@ TEST_F(LlvmLibcGetoptTest, MissingArg) { TEST_F(LlvmLibcGetoptTest, ParseArgInCurrent) { array<char *, 3> argv{"prog"_c, "-barg"_c, nullptr}; - EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), "b:"), (int)'b'); + EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), "b:"), (int)'b'); EXPECT_STREQ(test_globals::optarg, "arg"); EXPECT_EQ(test_globals::optind, 2); } @@ -150,7 +152,7 @@ TEST_F(LlvmLibcGetoptTest, ParseArgInCurrent) { TEST_F(LlvmLibcGetoptTest, ParseArgInNext) { array<char *, 4> argv{"prog"_c, "-b"_c, "arg"_c, nullptr}; - EXPECT_EQ(__llvm_libc::getopt(3, argv.data(), "b:"), (int)'b'); + EXPECT_EQ(LIBC_NAMESPACE::getopt(3, argv.data(), "b:"), (int)'b'); EXPECT_STREQ(test_globals::optarg, "arg"); EXPECT_EQ(test_globals::optind, 3); } @@ -158,10 +160,10 @@ TEST_F(LlvmLibcGetoptTest, ParseArgInNext) { TEST_F(LlvmLibcGetoptTest, ParseMutliInOne) { array<char *, 3> argv{"prog"_c, "-abc"_c, nullptr}; - EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), "abc"), (int)'a'); + EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), "abc"), (int)'a'); ASSERT_EQ(test_globals::optind, 1); - EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), "abc"), (int)'b'); + EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), "abc"), (int)'b'); ASSERT_EQ(test_globals::optind, 1); - EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), "abc"), (int)'c'); + EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), "abc"), (int)'c'); EXPECT_EQ(test_globals::optind, 2); } diff --git a/libc/test/src/unistd/getpid_test.cpp b/libc/test/src/unistd/getpid_test.cpp index fc88053..9d6c926 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 e972476..3e674af 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 8f2d9d9..a76eee6 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 538101d..fce4a3e5 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 7acb9dc..b1b9383 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 dcb6bff..2ef41cd 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 cb04db4..1a13d54 100644 --- a/libc/test/src/unistd/lseek_test.cpp +++ b/libc/test/src/unistd/lseek_test.cpp @@ -17,44 +17,45 @@ #include <unistd.h> TEST(LlvmLibcUniStd, LseekTest) { - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; constexpr const char *TEST_FILE = "testdata/lseek.test"; - int fd = __llvm_libc::open(TEST_FILE, O_RDONLY); + int fd = LIBC_NAMESPACE::open(TEST_FILE, O_RDONLY); ASSERT_EQ(libc_errno, 0); ASSERT_GT(fd, 0); constexpr const char LSEEK_TEST[] = "lseek test"; constexpr int LSEEK_TEST_SIZE = sizeof(LSEEK_TEST) - 1; char read_buf[20]; - ASSERT_THAT(__llvm_libc::read(fd, read_buf, LSEEK_TEST_SIZE), + ASSERT_THAT(LIBC_NAMESPACE::read(fd, read_buf, LSEEK_TEST_SIZE), Succeeds(LSEEK_TEST_SIZE)); read_buf[LSEEK_TEST_SIZE] = '\0'; EXPECT_STREQ(read_buf, LSEEK_TEST); // Seek to the beginning of the file and re-read. - ASSERT_THAT(__llvm_libc::lseek(fd, 0, SEEK_SET), Succeeds(0)); - ASSERT_THAT(__llvm_libc::read(fd, read_buf, LSEEK_TEST_SIZE), + ASSERT_THAT(LIBC_NAMESPACE::lseek(fd, 0, SEEK_SET), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::read(fd, read_buf, LSEEK_TEST_SIZE), Succeeds(LSEEK_TEST_SIZE)); read_buf[LSEEK_TEST_SIZE] = '\0'; EXPECT_STREQ(read_buf, LSEEK_TEST); // Seek to the beginning of the file from the end and re-read. - ASSERT_THAT(__llvm_libc::lseek(fd, -LSEEK_TEST_SIZE, SEEK_END), Succeeds(0)); - ASSERT_THAT(__llvm_libc::read(fd, read_buf, LSEEK_TEST_SIZE), + ASSERT_THAT(LIBC_NAMESPACE::lseek(fd, -LSEEK_TEST_SIZE, SEEK_END), + Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::read(fd, read_buf, LSEEK_TEST_SIZE), Succeeds(LSEEK_TEST_SIZE)); read_buf[LSEEK_TEST_SIZE] = '\0'; EXPECT_STREQ(read_buf, LSEEK_TEST); - ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0)); } TEST(LlvmLibcUniStd, LseekFailsTest) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; constexpr const char *TEST_FILE = "testdata/lseek.test"; - int fd = __llvm_libc::open(TEST_FILE, O_RDONLY); + int fd = LIBC_NAMESPACE::open(TEST_FILE, O_RDONLY); ASSERT_EQ(libc_errno, 0); ASSERT_GT(fd, 0); - EXPECT_THAT(__llvm_libc::lseek(fd, -1, SEEK_CUR), Fails(EINVAL)); - ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0)); + EXPECT_THAT(LIBC_NAMESPACE::lseek(fd, -1, SEEK_CUR), Fails(EINVAL)); + ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0)); } diff --git a/libc/test/src/unistd/pread_pwrite_test.cpp b/libc/test/src/unistd/pread_pwrite_test.cpp index 4d0158a..6819f55 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 ed819a9..20b51bb 100644 --- a/libc/test/src/unistd/read_write_test.cpp +++ b/libc/test/src/unistd/read_write_test.cpp @@ -16,42 +16,42 @@ #include "test/UnitTest/Test.h" TEST(LlvmLibcUniStd, WriteAndReadBackTest) { - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; constexpr const char *TEST_FILE = "__unistd_read_write.test"; - int write_fd = __llvm_libc::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU); + int write_fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU); ASSERT_EQ(libc_errno, 0); ASSERT_GT(write_fd, 0); constexpr const char HELLO[] = "hello"; constexpr int HELLO_SIZE = sizeof(HELLO); - ASSERT_THAT(__llvm_libc::write(write_fd, HELLO, HELLO_SIZE), + ASSERT_THAT(LIBC_NAMESPACE::write(write_fd, HELLO, HELLO_SIZE), Succeeds(HELLO_SIZE)); - ASSERT_THAT(__llvm_libc::fsync(write_fd), Succeeds(0)); - ASSERT_THAT(__llvm_libc::close(write_fd), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::fsync(write_fd), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(write_fd), Succeeds(0)); - int read_fd = __llvm_libc::open(TEST_FILE, O_RDONLY); + int read_fd = LIBC_NAMESPACE::open(TEST_FILE, O_RDONLY); ASSERT_EQ(libc_errno, 0); ASSERT_GT(read_fd, 0); char read_buf[10]; - ASSERT_THAT(__llvm_libc::read(read_fd, read_buf, HELLO_SIZE), + ASSERT_THAT(LIBC_NAMESPACE::read(read_fd, read_buf, HELLO_SIZE), Succeeds(HELLO_SIZE)); EXPECT_STREQ(read_buf, HELLO); - ASSERT_THAT(__llvm_libc::close(read_fd), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(read_fd), Succeeds(0)); // TODO: 'remove' the test file after the test. } TEST(LlvmLibcUniStd, WriteFails) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; - EXPECT_THAT(__llvm_libc::write(-1, "", 1), Fails(EBADF)); - EXPECT_THAT(__llvm_libc::write(1, reinterpret_cast<const void *>(-1), 1), + EXPECT_THAT(LIBC_NAMESPACE::write(-1, "", 1), Fails(EBADF)); + EXPECT_THAT(LIBC_NAMESPACE::write(1, reinterpret_cast<const void *>(-1), 1), Fails(EFAULT)); } TEST(LlvmLibcUniStd, ReadFails) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; - EXPECT_THAT(__llvm_libc::read(-1, nullptr, 1), Fails(EBADF)); - EXPECT_THAT(__llvm_libc::read(0, reinterpret_cast<void *>(-1), 1), + EXPECT_THAT(LIBC_NAMESPACE::read(-1, nullptr, 1), Fails(EBADF)); + EXPECT_THAT(LIBC_NAMESPACE::read(0, reinterpret_cast<void *>(-1), 1), Fails(EFAULT)); } diff --git a/libc/test/src/unistd/readlink_test.cpp b/libc/test/src/unistd/readlink_test.cpp index dbb957f..b2d018a 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 39127c0..19f0cee 100644 --- a/libc/test/src/unistd/readlinkat_test.cpp +++ b/libc/test/src/unistd/readlinkat_test.cpp @@ -16,10 +16,10 @@ #include <fcntl.h> -namespace cpp = __llvm_libc::cpp; +namespace cpp = LIBC_NAMESPACE::cpp; TEST(LlvmLibcReadlinkatTest, CreateAndUnlink) { - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; constexpr const char LINK_VAL[] = "readlinkat_test_value"; constexpr const char LINK[] = "testdata/readlinkat.test.link"; libc_errno = 0; @@ -28,20 +28,20 @@ TEST(LlvmLibcReadlinkatTest, CreateAndUnlink) { // 1. Create a symlink with value LINK_VAL. // 2. Read the symlink with readlink. The link value read should be LINK_VAL // 3. Cleanup the symlink created in step #1. - ASSERT_THAT(__llvm_libc::symlink(LINK_VAL, LINK), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::symlink(LINK_VAL, LINK), Succeeds(0)); char buf[sizeof(LINK_VAL)]; - ssize_t len = __llvm_libc::readlinkat(AT_FDCWD, LINK, buf, sizeof(buf)); + ssize_t len = LIBC_NAMESPACE::readlinkat(AT_FDCWD, LINK, buf, sizeof(buf)); ASSERT_EQ(libc_errno, 0); ASSERT_EQ(cpp::string_view(buf, len), cpp::string_view(LINK_VAL)); - ASSERT_THAT(__llvm_libc::unlink(LINK), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::unlink(LINK), Succeeds(0)); } TEST(LlvmLibcReadlinkatTest, ReadlinkInNonExistentPath) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; char buf[8]; - ASSERT_THAT( - __llvm_libc::readlinkat(AT_FDCWD, "non-existent-link", buf, sizeof(buf)), - Fails(ENOENT)); + ASSERT_THAT(LIBC_NAMESPACE::readlinkat(AT_FDCWD, "non-existent-link", buf, + sizeof(buf)), + Fails(ENOENT)); } diff --git a/libc/test/src/unistd/rmdir_test.cpp b/libc/test/src/unistd/rmdir_test.cpp index 3fcf328..69228ce 100644 --- a/libc/test/src/unistd/rmdir_test.cpp +++ b/libc/test/src/unistd/rmdir_test.cpp @@ -15,13 +15,14 @@ #include <fcntl.h> TEST(LlvmLibcRmdirTest, CreateAndRemove) { - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; constexpr const char *TEST_DIR = "testdata/rmdir.testdir"; - ASSERT_THAT(__llvm_libc::mkdir(TEST_DIR, S_IRWXU), Succeeds(0)); - ASSERT_THAT(__llvm_libc::rmdir(TEST_DIR), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::mkdir(TEST_DIR, S_IRWXU), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::rmdir(TEST_DIR), Succeeds(0)); } TEST(LlvmLibcRmdirTest, RemoveNonExistentDir) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - ASSERT_THAT(__llvm_libc::rmdir("testdata/non-existent-dir"), Fails(ENOENT)); + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + ASSERT_THAT(LIBC_NAMESPACE::rmdir("testdata/non-existent-dir"), + Fails(ENOENT)); } diff --git a/libc/test/src/unistd/swab_test.cpp b/libc/test/src/unistd/swab_test.cpp index 9b94924..f75120d 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 7017d4b..84d963b 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 e629c14..b030878 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 03b9a54..4a53f67 100644 --- a/libc/test/src/unistd/syscall_test.cpp +++ b/libc/test/src/unistd/syscall_test.cpp @@ -15,7 +15,7 @@ #include <sys/syscall.h> // For syscall numbers. #include <unistd.h> -using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; // We only do a smoke test here. Actual functionality tests are // done by the unit tests of the syscall wrappers like mmap. @@ -24,11 +24,11 @@ using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; // There is no function named "syscall" in llvm-libc, we instead use a macro to // set up the arguments properly. We still need to specify the namespace though // because the macro generates a call to the actual internal function -// (__llvm_libc_syscall) which is inside the namespace. +// (LIBC_NAMESPACE_syscall) which is inside the namespace. TEST(LlvmLibcSyscallTest, TrivialCall) { libc_errno = 0; - ASSERT_GE(__llvm_libc::syscall(SYS_gettid), 0l); + ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_gettid), 0l); ASSERT_EQ(libc_errno, 0); } @@ -37,9 +37,10 @@ TEST(LlvmLibcSyscallTest, SymlinkCreateDestroy) { constexpr const char LINK[] = "testdata/syscall_readlink.test.link"; #ifdef SYS_symlink - ASSERT_GE(__llvm_libc::syscall(SYS_symlink, LINK_VAL, LINK), 0l); + ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_symlink, LINK_VAL, LINK), 0l); #elif defined(SYS_symlinkat) - ASSERT_GE(__llvm_libc::syscall(SYS_symlinkat, LINK_VAL, AT_FDCWD, LINK), 0l); + ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_symlinkat, LINK_VAL, AT_FDCWD, LINK), + 0l); #else #error "symlink and symlinkat syscalls not available." #endif @@ -48,18 +49,18 @@ TEST(LlvmLibcSyscallTest, SymlinkCreateDestroy) { char buf[sizeof(LINK_VAL)]; #ifdef SYS_readlink - ASSERT_GE(__llvm_libc::syscall(SYS_readlink, LINK, buf, sizeof(buf)), 0l); + ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_readlink, LINK, buf, sizeof(buf)), 0l); #elif defined(SYS_readlinkat) ASSERT_GE( - __llvm_libc::syscall(SYS_readlinkat, AT_FDCWD, LINK, buf, sizeof(buf)), + LIBC_NAMESPACE::syscall(SYS_readlinkat, AT_FDCWD, LINK, buf, sizeof(buf)), 0l); #endif ASSERT_EQ(libc_errno, 0); #ifdef SYS_unlink - ASSERT_GE(__llvm_libc::syscall(SYS_unlink, LINK), 0l); + ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_unlink, LINK), 0l); #elif defined(SYS_unlinkat) - ASSERT_GE(__llvm_libc::syscall(SYS_unlinkat, AT_FDCWD, LINK, 0), 0l); + ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_unlinkat, AT_FDCWD, LINK, 0), 0l); #else #error "unlink and unlinkat syscalls not available." #endif @@ -74,23 +75,24 @@ TEST(LlvmLibcSyscallTest, FileReadWrite) { #ifdef SYS_open int fd = - __llvm_libc::syscall(SYS_open, TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU); + LIBC_NAMESPACE::syscall(SYS_open, TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU); #elif defined(SYS_openat) - int fd = __llvm_libc::syscall(SYS_openat, AT_FDCWD, TEST_FILE, - O_WRONLY | O_CREAT, S_IRWXU); + int fd = LIBC_NAMESPACE::syscall(SYS_openat, AT_FDCWD, TEST_FILE, + O_WRONLY | O_CREAT, S_IRWXU); #else #error "open and openat syscalls not available." #endif ASSERT_GT(fd, 0); ASSERT_EQ(libc_errno, 0); - ASSERT_GE(__llvm_libc::syscall(SYS_pwrite64, fd, HELLO, HELLO_SIZE, 0), 0l); + ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_pwrite64, fd, HELLO, HELLO_SIZE, 0), + 0l); ASSERT_EQ(libc_errno, 0); - ASSERT_GE(__llvm_libc::syscall(SYS_fsync, fd), 0l); + ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_fsync, fd), 0l); ASSERT_EQ(libc_errno, 0); - ASSERT_GE(__llvm_libc::syscall(SYS_close, fd), 0l); + ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_close, fd), 0l); ASSERT_EQ(libc_errno, 0); } @@ -109,40 +111,41 @@ TEST(LlvmLibcSyscallTest, FileLinkCreateDestroy) { // 4. Cleanup the file and its link. #ifdef SYS_open - int write_fd = __llvm_libc::syscall(SYS_open, TEST_FILE_PATH, - O_WRONLY | O_CREAT, S_IRWXU); + int write_fd = LIBC_NAMESPACE::syscall(SYS_open, TEST_FILE_PATH, + O_WRONLY | O_CREAT, S_IRWXU); #elif defined(SYS_openat) - int write_fd = __llvm_libc::syscall(SYS_openat, AT_FDCWD, TEST_FILE_PATH, - O_WRONLY | O_CREAT, S_IRWXU); + int write_fd = LIBC_NAMESPACE::syscall(SYS_openat, AT_FDCWD, TEST_FILE_PATH, + O_WRONLY | O_CREAT, S_IRWXU); #else #error "open and openat syscalls not available." #endif ASSERT_GT(write_fd, 0); ASSERT_EQ(libc_errno, 0); - ASSERT_GE(__llvm_libc::syscall(SYS_close, write_fd), 0l); + ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_close, write_fd), 0l); ASSERT_EQ(libc_errno, 0); #ifdef SYS_open - int dir_fd = __llvm_libc::syscall(SYS_open, TEST_DIR, O_DIRECTORY, 0); + int dir_fd = LIBC_NAMESPACE::syscall(SYS_open, TEST_DIR, O_DIRECTORY, 0); #elif defined(SYS_openat) int dir_fd = - __llvm_libc::syscall(SYS_openat, AT_FDCWD, TEST_DIR, O_DIRECTORY, 0); + LIBC_NAMESPACE::syscall(SYS_openat, AT_FDCWD, TEST_DIR, O_DIRECTORY, 0); #else #error "open and openat syscalls not available." #endif ASSERT_GT(dir_fd, 0); ASSERT_EQ(libc_errno, 0); - ASSERT_GE(__llvm_libc::syscall(SYS_linkat, dir_fd, TEST_FILE, dir_fd, - TEST_FILE_LINK, 0), + ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_linkat, dir_fd, TEST_FILE, dir_fd, + TEST_FILE_LINK, 0), 0l); ASSERT_EQ(libc_errno, 0); #ifdef SYS_open - int link_fd = __llvm_libc::syscall(SYS_open, TEST_FILE_LINK_PATH, O_PATH, 0); + int link_fd = + LIBC_NAMESPACE::syscall(SYS_open, TEST_FILE_LINK_PATH, O_PATH, 0); #elif defined(SYS_openat) - int link_fd = __llvm_libc::syscall(SYS_openat, AT_FDCWD, TEST_FILE_LINK_PATH, - O_PATH, 0); + int link_fd = LIBC_NAMESPACE::syscall(SYS_openat, AT_FDCWD, + TEST_FILE_LINK_PATH, O_PATH, 0); #else #error "open and openat syscalls not available." #endif @@ -150,9 +153,9 @@ TEST(LlvmLibcSyscallTest, FileLinkCreateDestroy) { ASSERT_EQ(libc_errno, 0); #ifdef SYS_unlink - ASSERT_GE(__llvm_libc::syscall(SYS_unlink, TEST_FILE_PATH), 0l); + ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_unlink, TEST_FILE_PATH), 0l); #elif defined(SYS_unlinkat) - ASSERT_GE(__llvm_libc::syscall(SYS_unlinkat, AT_FDCWD, TEST_FILE_PATH, 0), + ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_unlinkat, AT_FDCWD, TEST_FILE_PATH, 0), 0l); #else #error "unlink and unlinkat syscalls not available." @@ -160,15 +163,16 @@ TEST(LlvmLibcSyscallTest, FileLinkCreateDestroy) { ASSERT_EQ(libc_errno, 0); #ifdef SYS_unlink - ASSERT_GE(__llvm_libc::syscall(SYS_unlink, TEST_FILE_LINK_PATH), 0l); + ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_unlink, TEST_FILE_LINK_PATH), 0l); #elif defined(SYS_unlinkat) ASSERT_GE( - __llvm_libc::syscall(SYS_unlinkat, AT_FDCWD, TEST_FILE_LINK_PATH, 0), 0l); + LIBC_NAMESPACE::syscall(SYS_unlinkat, AT_FDCWD, TEST_FILE_LINK_PATH, 0), + 0l); #else #error "unlink and unlinkat syscalls not available." #endif ASSERT_EQ(libc_errno, 0); - ASSERT_GE(__llvm_libc::syscall(SYS_close, dir_fd), 0l); + ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_close, dir_fd), 0l); ASSERT_EQ(libc_errno, 0); } diff --git a/libc/test/src/unistd/sysconf_test.cpp b/libc/test/src/unistd/sysconf_test.cpp index eda2e56..85bc125 100644 --- a/libc/test/src/unistd/sysconf_test.cpp +++ b/libc/test/src/unistd/sysconf_test.cpp @@ -12,6 +12,6 @@ #include <unistd.h> TEST(LlvmLibcSysconfTest, PagesizeTest) { - long pagesize = __llvm_libc::sysconf(_SC_PAGESIZE); + long pagesize = LIBC_NAMESPACE::sysconf(_SC_PAGESIZE); ASSERT_GT(pagesize, 0l); } diff --git a/libc/test/src/unistd/truncate_test.cpp b/libc/test/src/unistd/truncate_test.cpp index 4885a12..1594032 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 ff55123..8a64f88 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 ecb9d3a..5953085 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 cfac485..b5fcb45 100644 --- a/libc/test/src/wchar/btowc_test.cpp +++ b/libc/test/src/wchar/btowc_test.cpp @@ -17,8 +17,8 @@ TEST(LlvmLibcBtowc, DefaultLocale) { // everything else returns WEOF. for (int c = 0; c < 255; ++c) { if (c < 128) - EXPECT_EQ(__llvm_libc::btowc(c), static_cast<wint_t>(c)); + EXPECT_EQ(LIBC_NAMESPACE::btowc(c), static_cast<wint_t>(c)); else - EXPECT_EQ(__llvm_libc::btowc(c), WEOF); + EXPECT_EQ(LIBC_NAMESPACE::btowc(c), WEOF); } } diff --git a/libc/test/src/wchar/wctob_test.cpp b/libc/test/src/wchar/wctob_test.cpp index 7a8d6ee..3f91188 100644 --- a/libc/test/src/wchar/wctob_test.cpp +++ b/libc/test/src/wchar/wctob_test.cpp @@ -17,8 +17,8 @@ TEST(LlvmLibcWctob, DefaultLocale) { // itself and everything else returns EOF. for (wint_t c = 0; c < 32767; ++c) { if (c < 128) - EXPECT_EQ(__llvm_libc::wctob(c), static_cast<int>(c)); + EXPECT_EQ(LIBC_NAMESPACE::wctob(c), static_cast<int>(c)); else - EXPECT_EQ(__llvm_libc::wctob(c), EOF); + EXPECT_EQ(LIBC_NAMESPACE::wctob(c), EOF); } } diff --git a/libc/test/utils/FPUtil/x86_long_double_test.cpp b/libc/test/utils/FPUtil/x86_long_double_test.cpp index e116482..6ca9b16 100644 --- a/libc/test/utils/FPUtil/x86_long_double_test.cpp +++ b/libc/test/utils/FPUtil/x86_long_double_test.cpp @@ -11,7 +11,7 @@ #include <math.h> -using FPBits = __llvm_libc::fputil::FPBits<long double>; +using FPBits = LIBC_NAMESPACE::fputil::FPBits<long double>; TEST(LlvmLibcX86LongDoubleTest, is_nan) { // In the nan checks below, we use the macro isnan from math.h to ensure that diff --git a/libc/test/utils/UnitTest/testfilter_test.cpp b/libc/test/utils/UnitTest/testfilter_test.cpp index 8a62f7d..567b5e2 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 86f0220..551b97c 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 e9f13fe..e23a3c2 100644 --- a/libc/utils/MPFRWrapper/MPFRUtils.cpp +++ b/libc/utils/MPFRWrapper/MPFRUtils.cpp @@ -23,9 +23,9 @@ #include "mpfr_inc.h" -template <typename T> using FPBits = __llvm_libc::fputil::FPBits<T>; +template <typename T> using FPBits = LIBC_NAMESPACE::fputil::FPBits<T>; -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { namespace mpfr { @@ -51,7 +51,7 @@ template <> struct ExtraPrecision<long double> { template <typename T> static inline unsigned int get_precision(double ulp_tolerance) { if (ulp_tolerance <= 0.5) { - return __llvm_libc::fputil::FloatProperties<T>::MANTISSA_PRECISION; + return LIBC_NAMESPACE::fputil::FloatProperties<T>::MANTISSA_PRECISION; } else { return ExtraPrecision<T>::VALUE; } @@ -1011,4 +1011,4 @@ template long double round<long double>(long double, RoundingMode); } // namespace mpfr } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/utils/MPFRWrapper/MPFRUtils.h b/libc/utils/MPFRWrapper/MPFRUtils.h index 0ba5ab6..baac2d0 100644 --- a/libc/utils/MPFRWrapper/MPFRUtils.h +++ b/libc/utils/MPFRWrapper/MPFRUtils.h @@ -15,7 +15,7 @@ #include <stdint.h> -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { namespace mpfr { @@ -87,12 +87,12 @@ enum class Operation : int { EndTernaryOperationsSingleOutput, }; -using __llvm_libc::fputil::testing::ForceRoundingMode; -using __llvm_libc::fputil::testing::RoundingMode; +using LIBC_NAMESPACE::fputil::testing::ForceRoundingMode; +using LIBC_NAMESPACE::fputil::testing::RoundingMode; template <typename T> struct BinaryInput { static_assert( - __llvm_libc::cpp::is_floating_point_v<T>, + LIBC_NAMESPACE::cpp::is_floating_point_v<T>, "Template parameter of BinaryInput must be a floating point type."); using Type = T; @@ -101,7 +101,7 @@ template <typename T> struct BinaryInput { template <typename T> struct TernaryInput { static_assert( - __llvm_libc::cpp::is_floating_point_v<T>, + LIBC_NAMESPACE::cpp::is_floating_point_v<T>, "Template parameter of TernaryInput must be a floating point type."); using Type = T; @@ -316,7 +316,7 @@ template <typename T> bool round_to_long(T x, RoundingMode mode, long &result); } // namespace mpfr } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE // GET_MPFR_DUMMY_ARG is going to be added to the end of GET_MPFR_MACRO as a // simple way to avoid the compiler warning `gnu-zero-variadic-macro-arguments`. @@ -326,14 +326,15 @@ template <typename T> bool round_to_long(T x, RoundingMode mode, long &result); #define EXPECT_MPFR_MATCH_DEFAULT(op, input, match_value, ulp_tolerance) \ EXPECT_THAT(match_value, \ - __llvm_libc::testing::mpfr::get_mpfr_matcher<op>( \ + LIBC_NAMESPACE::testing::mpfr::get_mpfr_matcher<op>( \ input, match_value, ulp_tolerance, \ - __llvm_libc::testing::mpfr::RoundingMode::Nearest)) + LIBC_NAMESPACE::testing::mpfr::RoundingMode::Nearest)) #define EXPECT_MPFR_MATCH_ROUNDING(op, input, match_value, ulp_tolerance, \ rounding) \ - EXPECT_THAT(match_value, __llvm_libc::testing::mpfr::get_mpfr_matcher<op>( \ - input, match_value, ulp_tolerance, rounding)) + EXPECT_THAT(match_value, \ + LIBC_NAMESPACE::testing::mpfr::get_mpfr_matcher<op>( \ + input, match_value, ulp_tolerance, rounding)) #define EXPECT_MPFR_MATCH(...) \ GET_MPFR_MACRO(__VA_ARGS__, EXPECT_MPFR_MATCH_ROUNDING, \ @@ -342,8 +343,8 @@ template <typename T> bool round_to_long(T x, RoundingMode mode, long &result); #define TEST_MPFR_MATCH_ROUNDING(op, input, match_value, ulp_tolerance, \ rounding) \ - __llvm_libc::testing::mpfr::get_mpfr_matcher<op>(input, match_value, \ - ulp_tolerance, rounding) \ + LIBC_NAMESPACE::testing::mpfr::get_mpfr_matcher<op>(input, match_value, \ + ulp_tolerance, rounding) \ .match(match_value) #define TEST_MPFR_MATCH(...) \ @@ -353,7 +354,7 @@ template <typename T> bool round_to_long(T x, RoundingMode mode, long &result); #define EXPECT_MPFR_MATCH_ALL_ROUNDING(op, input, match_value, ulp_tolerance) \ { \ - namespace mpfr = __llvm_libc::testing::mpfr; \ + namespace mpfr = LIBC_NAMESPACE::testing::mpfr; \ mpfr::ForceRoundingMode __r1(mpfr::RoundingMode::Nearest); \ if (__r1.success) \ EXPECT_MPFR_MATCH(op, input, match_value, ulp_tolerance, \ @@ -374,20 +375,21 @@ template <typename T> bool round_to_long(T x, RoundingMode mode, long &result); #define TEST_MPFR_MATCH_ROUNDING_SILENTLY(op, input, match_value, \ ulp_tolerance, rounding) \ - __llvm_libc::testing::mpfr::get_silent_mpfr_matcher<op>( \ + LIBC_NAMESPACE::testing::mpfr::get_silent_mpfr_matcher<op>( \ input, match_value, ulp_tolerance, rounding) \ .match(match_value) #define ASSERT_MPFR_MATCH_DEFAULT(op, input, match_value, ulp_tolerance) \ ASSERT_THAT(match_value, \ - __llvm_libc::testing::mpfr::get_mpfr_matcher<op>( \ + LIBC_NAMESPACE::testing::mpfr::get_mpfr_matcher<op>( \ input, match_value, ulp_tolerance, \ - __llvm_libc::testing::mpfr::RoundingMode::Nearest)) + LIBC_NAMESPACE::testing::mpfr::RoundingMode::Nearest)) #define ASSERT_MPFR_MATCH_ROUNDING(op, input, match_value, ulp_tolerance, \ rounding) \ - ASSERT_THAT(match_value, __llvm_libc::testing::mpfr::get_mpfr_matcher<op>( \ - input, match_value, ulp_tolerance, rounding)) + ASSERT_THAT(match_value, \ + LIBC_NAMESPACE::testing::mpfr::get_mpfr_matcher<op>( \ + input, match_value, ulp_tolerance, rounding)) #define ASSERT_MPFR_MATCH(...) \ GET_MPFR_MACRO(__VA_ARGS__, ASSERT_MPFR_MATCH_ROUNDING, \ @@ -396,7 +398,7 @@ template <typename T> bool round_to_long(T x, RoundingMode mode, long &result); #define ASSERT_MPFR_MATCH_ALL_ROUNDING(op, input, match_value, ulp_tolerance) \ { \ - namespace mpfr = __llvm_libc::testing::mpfr; \ + namespace mpfr = LIBC_NAMESPACE::testing::mpfr; \ mpfr::ForceRoundingMode __r1(mpfr::RoundingMode::Nearest); \ if (__r1.success) \ ASSERT_MPFR_MATCH(op, input, match_value, ulp_tolerance, \ diff --git a/libc/utils/gpu/loader/amdgpu/Loader.cpp b/libc/utils/gpu/loader/amdgpu/Loader.cpp index 1d0247a..1fb67e8 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 a772cd1d..fa6a4e3 100644 --- a/libc/utils/gpu/server/rpc_server.cpp +++ b/libc/utils/gpu/server/rpc_server.cpp @@ -19,7 +19,7 @@ #include <variant> #include <vector> -using namespace __llvm_libc; +using namespace LIBC_NAMESPACE; static_assert(sizeof(rpc_buffer_t) == sizeof(rpc::Buffer), "Buffer size mismatch"); diff --git a/libc/utils/gpu/server/rpc_server.h b/libc/utils/gpu/server/rpc_server.h index 2fde000..6b87830 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 { |