diff --git a/libc/benchmarks/CMakeLists.txt b/libc/benchmarks/CMakeLists.txt index 48f5f48ff8322487f0838478a3f66d88aa261296..4978da65850ccba9ac601eb671c6c30794e75185 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 95077cd6591530e14359de8da7835c2cb5f2d453..c50ae00ffa105eacfff01c422a4a6c0d0bc91592 100644 --- a/libc/benchmarks/LibcDefaultImplementations.cpp +++ b/libc/benchmarks/LibcDefaultImplementations.cpp @@ -2,7 +2,7 @@ #include "llvm/ADT/ArrayRef.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { extern void *memcpy(void *__restrict, const void *__restrict, size_t); extern void *memmove(void *, const void *, size_t); @@ -11,7 +11,7 @@ extern void bzero(void *, size_t); extern int memcmp(const void *, const void *, size_t); extern int bcmp(const void *, const void *, size_t); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE // List of implementations to test. @@ -23,31 +23,31 @@ using llvm::libc_benchmarks::MemsetConfiguration; llvm::ArrayRef getMemcpyConfigurations() { static constexpr MemcpyConfiguration kMemcpyConfigurations[] = { - {__llvm_libc::memcpy, "__llvm_libc::memcpy"}}; + {LIBC_NAMESPACE::memcpy, "LIBC_NAMESPACE::memcpy"}}; return llvm::ArrayRef(kMemcpyConfigurations); } llvm::ArrayRef getMemmoveConfigurations() { static constexpr MemmoveConfiguration kMemmoveConfigurations[] = { - {__llvm_libc::memmove, "__llvm_libc::memmove"}}; + {LIBC_NAMESPACE::memmove, "LIBC_NAMESPACE::memmove"}}; return llvm::ArrayRef(kMemmoveConfigurations); } llvm::ArrayRef getMemcmpConfigurations() { static constexpr MemcmpOrBcmpConfiguration kMemcmpConfiguration[] = { - {__llvm_libc::memcmp, "__llvm_libc::memcmp"}}; + {LIBC_NAMESPACE::memcmp, "LIBC_NAMESPACE::memcmp"}}; return llvm::ArrayRef(kMemcmpConfiguration); } llvm::ArrayRef getBcmpConfigurations() { static constexpr MemcmpOrBcmpConfiguration kBcmpConfigurations[] = { - {__llvm_libc::bcmp, "__llvm_libc::bcmp"}}; + {LIBC_NAMESPACE::bcmp, "LIBC_NAMESPACE::bcmp"}}; return llvm::ArrayRef(kBcmpConfigurations); } llvm::ArrayRef getMemsetConfigurations() { static constexpr MemsetConfiguration kMemsetConfigurations[] = { - {__llvm_libc::memset, "__llvm_libc::memset"}}; + {LIBC_NAMESPACE::memset, "LIBC_NAMESPACE::memset"}}; return llvm::ArrayRef(kMemsetConfigurations); } llvm::ArrayRef getBzeroConfigurations() { static constexpr BzeroConfiguration kBzeroConfigurations[] = { - {__llvm_libc::bzero, "__llvm_libc::bzero"}}; + {LIBC_NAMESPACE::bzero, "LIBC_NAMESPACE::bzero"}}; return llvm::ArrayRef(kBzeroConfigurations); } diff --git a/libc/benchmarks/LibcMemoryBenchmark.h b/libc/benchmarks/LibcMemoryBenchmark.h index f00bed4f6931176b0cc5d0a8d81d8392699486d0..5ba8b936a0cafa685541099cec0537cd8436955f 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 4fc6777cec45d00fa7ec752fddd26383df6a9418..acd7c30717597a162eb99246d0692d451e5d247b 100644 --- a/libc/benchmarks/LibcMemoryBenchmarkMain.cpp +++ b/libc/benchmarks/LibcMemoryBenchmarkMain.cpp @@ -21,7 +21,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { extern void *memcpy(void *__restrict, const void *__restrict, size_t); extern void *memmove(void *, const void *, size_t); @@ -30,7 +30,7 @@ extern void bzero(void *, size_t); extern int memcmp(const void *, const void *, size_t); extern int bcmp(const void *, const void *, size_t); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE namespace llvm { namespace libc_benchmarks { diff --git a/libc/benchmarks/automemcpy/lib/CodeGen.cpp b/libc/benchmarks/automemcpy/lib/CodeGen.cpp index f4060099bddd77c7aae5fab317221d49b8dec5bc..3837bd97d9f9a703e59a5017ace4c6291adc6209 100644 --- a/libc/benchmarks/automemcpy/lib/CodeGen.cpp +++ b/libc/benchmarks/automemcpy/lib/CodeGen.cpp @@ -62,7 +62,7 @@ namespace functions { // static void memcpy_0xB20D4702493C397E(char *__restrict dst, // const char *__restrict src, // size_t size) { -// using namespace __llvm_libc::x86; +// using namespace LIBC_NAMESPACE::x86; // if(size == 0) return; // if(size == 1) return copy<_1>(dst, src); // if(size < 4) return copy>(dst, src, size); @@ -249,7 +249,7 @@ static raw_ostream &operator<<(raw_ostream &Stream, const auto &Ctx = FI.Ctx; Stream << "static " << Ctx.FunctionReturnType << ' ' << FI.Name << Ctx.FunctionArgs << " {\n"; - Stream << kIndent << "using namespace __llvm_libc::" << FI.ElementClass + Stream << kIndent << "using namespace LIBC_NAMESPACE::" << FI.ElementClass << ";\n"; for (const auto &I : FI.Individuals) if (I.Element.Size == 0) @@ -428,7 +428,7 @@ namespace configurations { // ------------------------------------------------------------ // e.g. // llvm::ArrayRef getMemcpyConfigurations() { -// using namespace __llvm_libc; +// using namespace LIBC_NAMESPACE; // static constexpr MemcpyConfiguration kConfigurations[] = { // {Wrap, "memcpy_0xE00E29EE73994E2B"}, // {Wrap, "memcpy_0x8661D80472487AB5"}, @@ -504,7 +504,7 @@ static raw_ostream &operator<<(raw_ostream &Stream, const Configuration &C) { if (C.Descriptors.empty()) Stream << kIndent << "return {};\n"; else { - Stream << kIndent << "using namespace __llvm_libc;\n"; + Stream << kIndent << "using namespace LIBC_NAMESPACE;\n"; Stream << kIndent << "static constexpr " << C.Type << " kConfigurations[] = {\n"; Stream << C.Descriptors; @@ -542,11 +542,11 @@ static void Serialize(raw_ostream &Stream, Stream << "using llvm::libc_benchmarks::MemmoveConfiguration;\n"; Stream << "using llvm::libc_benchmarks::MemsetConfiguration;\n"; Stream << "\n"; - Stream << "namespace __llvm_libc {\n"; + Stream << "namespace LIBC_NAMESPACE {\n"; Stream << "\n"; codegen::functions::Serialize(Stream, Descriptors); Stream << "\n"; - Stream << "} // namespace __llvm_libc\n"; + Stream << "} // namespace LIBC_NAMESPACE\n"; Stream << "\n"; Stream << "namespace llvm {\n"; Stream << "namespace automemcpy {\n"; diff --git a/libc/benchmarks/automemcpy/unittests/CodeGenTest.cpp b/libc/benchmarks/automemcpy/unittests/CodeGenTest.cpp index b0c5f3a05734de1842080c805e0320b995963853..5084b1d67dcd5e3d7d5157db2802a5d5d50e4af9 100644 --- a/libc/benchmarks/automemcpy/unittests/CodeGenTest.cpp +++ b/libc/benchmarks/automemcpy/unittests/CodeGenTest.cpp @@ -63,14 +63,14 @@ using llvm::libc_benchmarks::MemcpyConfiguration; using llvm::libc_benchmarks::MemmoveConfiguration; using llvm::libc_benchmarks::MemsetConfiguration; -namespace __llvm_libc { +namespace LIBC_NAMESPACE { static void memcpy_0xE00E29EE73994E2B(char *__restrict dst, const char *__restrict src, size_t size) { - using namespace __llvm_libc::x86; + using namespace LIBC_NAMESPACE::x86; return copy(dst, src, size); } static void memcpy_0x7381B60C7BE75EF9(char *__restrict dst, const char *__restrict src, size_t size) { - using namespace __llvm_libc::x86; + using namespace LIBC_NAMESPACE::x86; if(size == 0) return; if(size == 1) return copy<_1>(dst, src); if(size == 2) return copy<_2>(dst, src); @@ -84,7 +84,7 @@ static void memcpy_0x7381B60C7BE75EF9(char *__restrict dst, const char *__restri return copy>(dst, src, size); } static int memcmp_0x348D7BA6DB0EE033(const char * lhs, const char * rhs, size_t size) { - using namespace __llvm_libc::x86; + using namespace LIBC_NAMESPACE::x86; if(size == 0) return 0; if(size == 1) return three_way_compare<_1>(lhs, rhs); if(size < 4) return three_way_compare>(lhs, rhs, size); @@ -95,7 +95,7 @@ static int memcmp_0x348D7BA6DB0EE033(const char * lhs, const char * rhs, size_t return three_way_compare::Then>>(lhs, rhs, size); } static void memset_0x71E761699B999863(char * dst, int value, size_t size) { - using namespace __llvm_libc::x86; + using namespace LIBC_NAMESPACE::x86; if(size == 0) return; if(size == 1) return splat_set<_1>(dst, value); if(size < 4) return splat_set>(dst, value, size); @@ -108,7 +108,7 @@ static void memset_0x71E761699B999863(char * dst, int value, size_t size) { return splat_set::Then>>(dst, value, size); } static void memset_0x3DF0F44E2ED6A50F(char * dst, int value, size_t size) { - using namespace __llvm_libc::x86; + using namespace LIBC_NAMESPACE::x86; if(size == 0) return; if(size == 1) return splat_set<_1>(dst, value); if(size < 4) return splat_set>(dst, value, size); @@ -121,7 +121,7 @@ static void memset_0x3DF0F44E2ED6A50F(char * dst, int value, size_t size) { return splat_set::Then>>(dst, value, size); } static void bzero_0x475977492C218AD4(char * dst, size_t size) { - using namespace __llvm_libc::x86; + using namespace LIBC_NAMESPACE::x86; if(size == 0) return; if(size == 1) return splat_set<_1>(dst, 0); if(size == 2) return splat_set<_2>(dst, 0); @@ -134,7 +134,7 @@ static void bzero_0x475977492C218AD4(char * dst, size_t size) { return splat_set::Then>>(dst, 0, size); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE namespace llvm { namespace automemcpy { @@ -163,7 +163,7 @@ void *Wrap(void *__restrict dst, const void *__restrict src, size_t size) { return dst; } llvm::ArrayRef getMemcpyConfigurations() { - using namespace __llvm_libc; + using namespace LIBC_NAMESPACE; static constexpr MemcpyConfiguration kConfigurations[] = { {Wrap, "memcpy_0xE00E29EE73994E2B"}, {Wrap, "memcpy_0x7381B60C7BE75EF9"}, @@ -178,7 +178,7 @@ int Wrap(const void *lhs, const void *rhs, size_t size) { reinterpret_cast(rhs), size); } llvm::ArrayRef getMemcmpConfigurations() { - using namespace __llvm_libc; + using namespace LIBC_NAMESPACE; static constexpr MemcmpOrBcmpConfiguration kConfigurations[] = { {Wrap, "memcmp_0x348D7BA6DB0EE033"}, }; @@ -194,7 +194,7 @@ template void *Wrap(void *dst, int value, size_t size) { return dst; } llvm::ArrayRef getMemsetConfigurations() { - using namespace __llvm_libc; + using namespace LIBC_NAMESPACE; static constexpr MemsetConfiguration kConfigurations[] = { {Wrap, "memset_0x71E761699B999863"}, {Wrap, "memset_0x3DF0F44E2ED6A50F"}, @@ -207,7 +207,7 @@ template void Wrap(void *dst, size_t size) { Foo(reinterpret_cast(dst), size); } llvm::ArrayRef getBzeroConfigurations() { - using namespace __llvm_libc; + using namespace LIBC_NAMESPACE; static constexpr BzeroConfiguration kConfigurations[] = { {Wrap, "bzero_0x475977492C218AD4"}, }; diff --git a/libc/config/linux/app.h b/libc/config/linux/app.h index 40a45078f6c8f35296d69b148d8e1a001f477ce3..5521991e3e1c36d43c49719da84635a154421585 100644 --- a/libc/config/linux/app.h +++ b/libc/config/linux/app.h @@ -13,7 +13,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Data structure to capture properties of the linux/ELF TLS image. struct TLSImage { @@ -106,6 +106,6 @@ void init_tls(TLSDescriptor &tls); // Cleanup the TLS area as described in |tls_descriptor|. void cleanup_tls(uintptr_t tls_addr, uintptr_t tls_size); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_CONFIG_LINUX_APP_H diff --git a/libc/docs/dev/clang_tidy_checks.rst b/libc/docs/dev/clang_tidy_checks.rst index e635f84a5a1a4629978486e548209ac491d358f7..18c011e67b4b916f85861145e73d5cff8c5f5b94 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 4b03217b18c33fa48b337b5ce0320296cc65cb2d..a28f7b9d717d4d0d2545bdc2814d5a9e0f7e5684 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 0fdbb7c3c3d74d8f3d8c3e6407702c1feecca177..389981a42f76c165a38347b5553d3f5bce59c582 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 e690e5168d27b81e421bfd9a48a469459ee815da..2b84ad3ab46213789f41476bc3b75b38cdb01750 100644 --- a/libc/fuzzing/math/Compare.h +++ b/libc/fuzzing/math/Compare.h @@ -13,10 +13,11 @@ #include "src/__support/FPUtil/FPBits.h" template -__llvm_libc::cpp::enable_if_t<__llvm_libc::cpp::is_floating_point_v, bool> +LIBC_NAMESPACE::cpp::enable_if_t, + bool> ValuesEqual(T x1, T x2) { - __llvm_libc::fputil::FPBits bits1(x1); - __llvm_libc::fputil::FPBits bits2(x2); + LIBC_NAMESPACE::fputil::FPBits bits1(x1); + LIBC_NAMESPACE::fputil::FPBits bits2(x2); // If either is NaN, we want both to be NaN. if (bits1.is_nan() || bits2.is_nan()) return bits2.is_nan() && bits2.is_nan(); @@ -26,7 +27,7 @@ ValuesEqual(T x1, T x2) { } template -__llvm_libc::cpp::enable_if_t<__llvm_libc::cpp::is_integral_v, bool> +LIBC_NAMESPACE::cpp::enable_if_t, bool> ValuesEqual(T x1, T x2) { return x1 == x2; } diff --git a/libc/fuzzing/math/RemQuoDiff.h b/libc/fuzzing/math/RemQuoDiff.h index b934bc88587699178983cbdba3af4c81bbadd702..2a96224961767372abfa7de42d6df3a4a1efcd39 100644 --- a/libc/fuzzing/math/RemQuoDiff.h +++ b/libc/fuzzing/math/RemQuoDiff.h @@ -44,8 +44,8 @@ void RemQuoDiff(RemQuoFunc func1, RemQuoFunc func2, const uint8_t *data, if ((q1 & 0x7) != (q2 & 0x7)) __builtin_trap(); - __llvm_libc::fputil::FPBits bits1(remainder1); - __llvm_libc::fputil::FPBits bits2(remainder2); + LIBC_NAMESPACE::fputil::FPBits bits1(remainder1); + LIBC_NAMESPACE::fputil::FPBits bits2(remainder2); if (bits1.uintval() != bits2.uintval()) __builtin_trap(); } diff --git a/libc/fuzzing/math/math_differential_fuzz.cpp b/libc/fuzzing/math/math_differential_fuzz.cpp index f315b6a99e1e52b109cf31b275148ff8966c4d4d..0e66377cfba90d5b6a154d4af7efbc69952ccf1a 100644 --- a/libc/fuzzing/math/math_differential_fuzz.cpp +++ b/libc/fuzzing/math/math_differential_fuzz.cpp @@ -70,83 +70,89 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { - SingleInputSingleOutputDiff(&__llvm_libc::ceilf, &::ceilf, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::ceil, &::ceil, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::ceill, &::ceill, data, - size); + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::ceilf, &::ceilf, data, + size); + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::ceil, &::ceil, data, + size); + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::ceill, &::ceill, + data, size); - SingleInputSingleOutputDiff(&__llvm_libc::floorf, &::floorf, data, + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::floorf, &::floorf, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::floor, &::floor, data, + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::floor, &::floor, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::floorl, &::floorl, + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::floorl, &::floorl, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::roundf, &::roundf, data, + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::roundf, &::roundf, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::round, &::round, data, + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::round, &::round, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::roundl, &::roundl, + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::roundl, &::roundl, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::truncf, &::truncf, data, + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::truncf, &::truncf, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::trunc, &::trunc, data, + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::trunc, &::trunc, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::truncl, &::truncl, + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::truncl, &::truncl, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::logbf, &::logbf, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::logb, &::logb, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::logbl, &::logbl, data, - size); + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::logbf, &::logbf, data, + size); + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::logb, &::logb, data, + size); + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::logbl, &::logbl, + data, size); - TwoInputSingleOutputDiff(&__llvm_libc::hypotf, &::hypotf, data, - size); + TwoInputSingleOutputDiff(&LIBC_NAMESPACE::hypotf, &::hypotf, + data, size); - TwoInputSingleOutputDiff(&__llvm_libc::remainderf, + TwoInputSingleOutputDiff(&LIBC_NAMESPACE::remainderf, &::remainderf, data, size); - TwoInputSingleOutputDiff(&__llvm_libc::remainder, + TwoInputSingleOutputDiff(&LIBC_NAMESPACE::remainder, &::remainder, data, size); - TwoInputSingleOutputDiff(&__llvm_libc::remainderl, - &::remainderl, data, size); + TwoInputSingleOutputDiff( + &LIBC_NAMESPACE::remainderl, &::remainderl, data, size); - TwoInputSingleOutputDiff(&__llvm_libc::fdimf, &::fdimf, data, + TwoInputSingleOutputDiff(&LIBC_NAMESPACE::fdimf, &::fdimf, data, size); - TwoInputSingleOutputDiff(&__llvm_libc::fdim, &::fdim, data, + TwoInputSingleOutputDiff(&LIBC_NAMESPACE::fdim, &::fdim, data, size); - TwoInputSingleOutputDiff(&__llvm_libc::fdiml, + TwoInputSingleOutputDiff(&LIBC_NAMESPACE::fdiml, &::fdiml, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::sqrtf, &::sqrtf, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::sqrt, &::sqrt, data, size); - SingleInputSingleOutputDiff(&__llvm_libc::sqrtl, &::sqrtl, data, - size); + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::sqrtf, &::sqrtf, data, + size); + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::sqrt, &::sqrt, data, + size); + SingleInputSingleOutputDiff(&LIBC_NAMESPACE::sqrtl, &::sqrtl, + data, size); - SingleInputSingleOutputWithSideEffectDiff(&__llvm_libc::frexpf, + SingleInputSingleOutputWithSideEffectDiff(&LIBC_NAMESPACE::frexpf, &::frexpf, data, size); - SingleInputSingleOutputWithSideEffectDiff(&__llvm_libc::frexp, + SingleInputSingleOutputWithSideEffectDiff(&LIBC_NAMESPACE::frexp, &::frexp, data, size); SingleInputSingleOutputWithSideEffectDiff( - &__llvm_libc::frexpl, &::frexpl, data, size); + &LIBC_NAMESPACE::frexpl, &::frexpl, data, size); - SingleInputSingleOutputWithSideEffectDiff(&__llvm_libc::modff, - &::modff, data, size); + SingleInputSingleOutputWithSideEffectDiff( + &LIBC_NAMESPACE::modff, &::modff, data, size); SingleInputSingleOutputWithSideEffectDiff( - &__llvm_libc::modf, &::modf, data, size); + &LIBC_NAMESPACE::modf, &::modf, data, size); SingleInputSingleOutputWithSideEffectDiff( - &__llvm_libc::modfl, &::modfl, data, size); + &LIBC_NAMESPACE::modfl, &::modfl, data, size); - TwoInputSingleOutputDiff(&__llvm_libc::ldexpf, &::ldexpf, data, + TwoInputSingleOutputDiff(&LIBC_NAMESPACE::ldexpf, &::ldexpf, data, size); - TwoInputSingleOutputDiff(&__llvm_libc::ldexp, &::ldexp, data, + TwoInputSingleOutputDiff(&LIBC_NAMESPACE::ldexp, &::ldexp, data, size); - TwoInputSingleOutputDiff(&__llvm_libc::ldexpl, &::ldexpl, + TwoInputSingleOutputDiff(&LIBC_NAMESPACE::ldexpl, &::ldexpl, data, size); - RemQuoDiff(&__llvm_libc::remquof, &::remquof, data, size); - RemQuoDiff(&__llvm_libc::remquo, &::remquo, data, size); - RemQuoDiff(&__llvm_libc::remquol, &::remquol, data, size); + RemQuoDiff(&LIBC_NAMESPACE::remquof, &::remquof, data, size); + RemQuoDiff(&LIBC_NAMESPACE::remquo, &::remquo, data, size); + RemQuoDiff(&LIBC_NAMESPACE::remquol, &::remquol, data, size); return 0; } diff --git a/libc/fuzzing/math/nextafter_differential_fuzz.cpp b/libc/fuzzing/math/nextafter_differential_fuzz.cpp index f4a7891df2aabe99be7c0de76befb648efb7cc76..2e6d58995a31fa20aef3deef9778a02c774004fb 100644 --- a/libc/fuzzing/math/nextafter_differential_fuzz.cpp +++ b/libc/fuzzing/math/nextafter_differential_fuzz.cpp @@ -18,9 +18,9 @@ #include "src/math/nextafterl.h" extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { - TwoInputSingleOutputDiff(&__llvm_libc::nextafterf, + TwoInputSingleOutputDiff(&LIBC_NAMESPACE::nextafterf, &::nextafterf, data, size); - TwoInputSingleOutputDiff(&__llvm_libc::nextafter, + TwoInputSingleOutputDiff(&LIBC_NAMESPACE::nextafter, &::nextafter, data, size); return 0; } diff --git a/libc/fuzzing/stdio/printf_float_conv_fuzz.cpp b/libc/fuzzing/stdio/printf_float_conv_fuzz.cpp index 7d8335b817085eeb900552c0d76d689f410280ad..dd3902eebda61718d45bef97f0418eccc3953a3e 100644 --- a/libc/fuzzing/stdio/printf_float_conv_fuzz.cpp +++ b/libc/fuzzing/stdio/printf_float_conv_fuzz.cpp @@ -38,7 +38,7 @@ enum class TestResult { inline TestResult test_vals(const char *fmt, double num, int prec, int width) { // Call snprintf on a nullptr to get the buffer size. - int buffer_size = __llvm_libc::snprintf(nullptr, 0, fmt, width, prec, num); + int buffer_size = LIBC_NAMESPACE::snprintf(nullptr, 0, fmt, width, prec, num); if (buffer_size < 0) { return TestResult::BufferSizeFailed; @@ -50,8 +50,8 @@ inline TestResult test_vals(const char *fmt, double num, int prec, int width) { int test_result = 0; int reference_result = 0; - test_result = - __llvm_libc::snprintf(test_buff, buffer_size + 1, fmt, width, prec, num); + test_result = LIBC_NAMESPACE::snprintf(test_buff, buffer_size + 1, fmt, width, + prec, num); reference_result = mpfr_snprintf(reference_buff, buffer_size + 1, fmt, width, prec, num); @@ -84,7 +84,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { int prec = 0; int width = 0; - __llvm_libc::fputil::FPBits::UIntType raw_num = 0; + LIBC_NAMESPACE::fputil::FPBits::UIntType raw_num = 0; // Copy as many bytes of data as will fit into num, prec, and with. Any extras // are ignored. @@ -98,7 +98,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { } } - num = __llvm_libc::fputil::FPBits(raw_num).get_val(); + num = LIBC_NAMESPACE::fputil::FPBits(raw_num).get_val(); if (width > MAX_SIZE) { width = MAX_SIZE; diff --git a/libc/fuzzing/stdio/printf_parser_fuzz.cpp b/libc/fuzzing/stdio/printf_parser_fuzz.cpp index 86f8c1e0a55f81859755efaaecdd5876b78871d2..e745850bd6c3a431d20204bf39a9cc4d187a73a0 100644 --- a/libc/fuzzing/stdio/printf_parser_fuzz.cpp +++ b/libc/fuzzing/stdio/printf_parser_fuzz.cpp @@ -16,7 +16,7 @@ #include #include -using namespace __llvm_libc; +using namespace LIBC_NAMESPACE; // The design for the printf parser fuzzer is fairly simple. The parser uses a // mock arg list that will never fail, and is passed a randomized string. The diff --git a/libc/fuzzing/stdlib/atof_differential_fuzz.cpp b/libc/fuzzing/stdlib/atof_differential_fuzz.cpp index b368129960d3b590db64e25d991d6979f7d409c4..eeb96aef9abe520e56fbe879ad885e26f5387ac3 100644 --- a/libc/fuzzing/stdlib/atof_differential_fuzz.cpp +++ b/libc/fuzzing/stdlib/atof_differential_fuzz.cpp @@ -26,7 +26,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { container[i] = data[i]; container[size] = '\0'; // Add null terminator to container. - StringParserOutputDiff(&__llvm_libc::atof, &::atof, container, size); + StringParserOutputDiff(&LIBC_NAMESPACE::atof, &::atof, container, + size); delete[] container; return 0; } diff --git a/libc/fuzzing/stdlib/qsort_fuzz.cpp b/libc/fuzzing/stdlib/qsort_fuzz.cpp index dbbc8e96f924336dd7ef39c03ad3deb33d1e9d90..5d5053cff5c58cec8e39894167afb16d0df051d8 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 5ef506a08e4c6ab3b2c1e050429cda087e2bc581..f6cc8abedf4645217e33ffb9131078eb9975bfc2 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 612be4271b2384ff37d53b5678858e3583eca7d9..097e6193ee6ef0a08ae044e4eb24899ccaa6f1b7 100644 --- a/libc/fuzzing/stdlib/strtointeger_differential_fuzz.cpp +++ b/libc/fuzzing/stdlib/strtointeger_differential_fuzz.cpp @@ -61,19 +61,19 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { // random even when the input is cleaned. container[0] = data[0]; - StringParserOutputDiff(&__llvm_libc::atoi, &::atoi, container, size); - StringParserOutputDiff(&__llvm_libc::atol, &::atol, container, size); - StringParserOutputDiff(&__llvm_libc::atoll, &::atoll, container, + StringParserOutputDiff(&LIBC_NAMESPACE::atoi, &::atoi, container, size); + StringParserOutputDiff(&LIBC_NAMESPACE::atol, &::atol, container, size); + StringParserOutputDiff(&LIBC_NAMESPACE::atoll, &::atoll, container, size); - StringToNumberOutputDiff(&__llvm_libc::strtol, &::strtol, container, + StringToNumberOutputDiff(&LIBC_NAMESPACE::strtol, &::strtol, container, size); - StringToNumberOutputDiff(&__llvm_libc::strtoll, &::strtoll, + StringToNumberOutputDiff(&LIBC_NAMESPACE::strtoll, &::strtoll, container, size); - StringToNumberOutputDiff(&__llvm_libc::strtoul, &::strtoul, + StringToNumberOutputDiff(&LIBC_NAMESPACE::strtoul, &::strtoul, container, size); - StringToNumberOutputDiff(&__llvm_libc::strtoull, + StringToNumberOutputDiff(&LIBC_NAMESPACE::strtoull, &::strtoull, container, size); delete[] container; diff --git a/libc/fuzzing/stdlib/strtointeger_fuzz.cpp b/libc/fuzzing/stdlib/strtointeger_fuzz.cpp index 197bee01d3a3ae5609e9d03dc4b133a05202d933..3ffe5c261d09c0fa0c5a0ad3f068add1dc0b00d9 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 c1b497dfb2065e211a2382ef420258d0f480a541..50587bf3778b5f208afd6b135a42167f415dc0cd 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 10e0c03bb18fbb482647b6887a8b8e35027ed9bb..c15649aa07ecd8e67d3fbf53af41ffe49f5b47b9 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 5ccf85c7dc0fcd0a7823ba356db9937904cda535..34ee8914890751a543744d557536273cb3e8ac05 100644 --- a/libc/fuzzing/string/strstr_fuzz.cpp +++ b/libc/fuzzing/string/strstr_fuzz.cpp @@ -54,11 +54,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { const char *needle = reinterpret_cast(container); const char *haystack = reinterpret_cast(data + i); - const char *result = __llvm_libc::strstr(haystack, needle); + const char *result = LIBC_NAMESPACE::strstr(haystack, needle); // A null terminator may exist earlier in each, so this needs to be recorded. - const size_t haystack_size = __llvm_libc::strlen(haystack); - const size_t needle_size = __llvm_libc::strlen(needle); + const size_t haystack_size = LIBC_NAMESPACE::strlen(haystack); + const size_t needle_size = LIBC_NAMESPACE::strlen(needle); if (result) { // The needle is in the haystack. diff --git a/libc/src/__support/CPP/README.md b/libc/src/__support/CPP/README.md index 472a630110fd4e0716020a3b7225f23f3d6b5d1e..b470c3f1dc343c35c2efb710ec7fbc179434f40e 100644 --- a/libc/src/__support/CPP/README.md +++ b/libc/src/__support/CPP/README.md @@ -8,6 +8,6 @@ be followed for future changes and additions: and free standing C headers. 2. Free standing C headers are to be included as C headers and not as C++ headers. That is, use `#include ` and not `#include `. -3. The utilities should be defined in the namespace `__llvm_libc::cpp`. The +3. The utilities should be defined in the namespace `LIBC_NAMESPACE::cpp`. The higher level namespace should have a `__` prefix to avoid symbol name pollution when the utilities are used in implementation of public functions. diff --git a/libc/src/__support/CPP/algorithm.h b/libc/src/__support/CPP/algorithm.h index 6ce56a9f3565976e34eead97fba940214570f656..fef3c18dc50bc87044849c735cc1173ec339b9d7 100644 --- a/libc/src/__support/CPP/algorithm.h +++ b/libc/src/__support/CPP/algorithm.h @@ -14,7 +14,7 @@ #include "src/__support/macros/attributes.h" // LIBC_INLINE -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace cpp { template LIBC_INLINE constexpr const T &max(const T &a, const T &b) { @@ -26,6 +26,6 @@ template LIBC_INLINE constexpr const T &min(const T &a, const T &b) { } } // namespace cpp -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_CPP_ALGORITHM_H diff --git a/libc/src/__support/CPP/array.h b/libc/src/__support/CPP/array.h index 1cdc8b7d7e79ba197c9d30a8abf8141110a3a8fb..12e574899988060fec360a96d282ed10c6c23e08 100644 --- a/libc/src/__support/CPP/array.h +++ b/libc/src/__support/CPP/array.h @@ -12,11 +12,12 @@ #include "src/__support/macros/attributes.h" #include // For size_t. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace cpp { template struct array { - static_assert(N != 0, "Cannot create a __llvm_libc::cpp::array of size 0."); + static_assert(N != 0, + "Cannot create a LIBC_NAMESPACE::cpp::array of size 0."); T Data[N]; using value_type = T; @@ -50,6 +51,6 @@ template struct array { }; } // namespace cpp -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_CPP_ARRAY_H diff --git a/libc/src/__support/CPP/atomic.h b/libc/src/__support/CPP/atomic.h index 609aac31252e09fce99874ec98370e40dea10336..78dc8d2da3c191ddaac8956c48817f367218fc4c 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 4e4205db9128b30a6b82e8c289d8c959a5f55bf4..456266626ae9b2065a3e78c842224582a2c872b4 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 bae71d84314e6bd938a001692974b863e6642df4..cfac749e0d84e3a92c5b9f2e1ab869b23b22bffe 100644 --- a/libc/src/__support/CPP/bitset.h +++ b/libc/src/__support/CPP/bitset.h @@ -12,11 +12,11 @@ #include "src/__support/macros/attributes.h" #include // For size_t. -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { template struct bitset { static_assert(NumberOfBits != 0, - "Cannot create a __llvm_libc::cpp::bitset of size 0."); + "Cannot create a LIBC_NAMESPACE::cpp::bitset of size 0."); LIBC_INLINE constexpr void set(size_t Index) { Data[Index / BITS_PER_UNIT] |= mask(Index); @@ -85,6 +85,6 @@ 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 4c5c4a492ba425cf46df204947bd59f027c6e1bb..1da51fd253fb55dba4e5c9147b11a3446c7c902d 100644 --- a/libc/src/__support/CPP/cstddef.h +++ b/libc/src/__support/CPP/cstddef.h @@ -12,7 +12,7 @@ #include "src/__support/macros/attributes.h" #include "type_traits.h" // For enable_if_t, is_integral_v. -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { enum class byte : unsigned char {}; @@ -66,6 +66,6 @@ to_integer(byte b) noexcept { return static_cast(b); } -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_CSTDDEF_H diff --git a/libc/src/__support/CPP/expected.h b/libc/src/__support/CPP/expected.h index c20d100f8cf82afb8883221262bf7a12ab409bed..52174a054f8749c9a69574075afee75cf40e5640 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 6c33b55db3700c4dcef1b2784adddbaa45cb8c79..16283a264e6571c6255f44d488d0a6f23831c90f 100644 --- a/libc/src/__support/CPP/functional.h +++ b/libc/src/__support/CPP/functional.h @@ -20,7 +20,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace cpp { /// A function type adapted from LLVM's function_ref. @@ -65,6 +65,6 @@ 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 4e76337a2445e066c7163e0715147a7171a16b28..e163f00c73209115bd7cc473d822ff81d7291e0a 100644 --- a/libc/src/__support/CPP/limits.h +++ b/libc/src/__support/CPP/limits.h @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace cpp { // Some older gcc distributions don't define these for 32 bit targets. @@ -96,6 +96,6 @@ 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 14ee0ab2bbc0d13b93b65852dc959101e443a626..16353d57e3a6cb0cc1cc7735499065395bfc45c9 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 b5e2ef7c8bc2f201b8b829e91d1c158b63a64819..02e8395b871ba29a410b5eed2acaa5454ad90d90 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 ebf637c5d26679c762b4df581be293d6cbb13714..a8c1353581ba0e167efa889f742122bd905d6ffe 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 2f60720e934500850dbae0598f2ee18c9d3b9b4f..cb794e081970dd15ecd2dfa16ec80e33f15bab67 100644 --- a/libc/src/__support/CPP/string.h +++ b/libc/src/__support/CPP/string.h @@ -18,7 +18,7 @@ #include // size_t #include // malloc, free -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace cpp { // This class mimics std::string but does not intend to be a full fledged @@ -61,7 +61,7 @@ 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 d494325def3bfa75cf65fd97bed9dd759a8cb874..d23aa261ca061465d821cea885a7bc19ed255a07 100644 --- a/libc/src/__support/CPP/string_view.h +++ b/libc/src/__support/CPP/string_view.h @@ -13,7 +13,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace cpp { // This is very simple alternate of the std::string_view class. There is no @@ -197,6 +197,6 @@ 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 0a92ddae66c64a1bab1978ab207e3cf108617c2d..c8eb59cf65cbb358215646f3c0c5f74ca9fdf450 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 69d75018fcf2e9ee268e2b1ae0c02b3811d4d2de..2bca6267914d5871d67b1e80961a2a44ff016b21 100644 --- a/libc/src/__support/CPP/type_traits/add_lvalue_reference.h +++ b/libc/src/__support/CPP/type_traits/add_lvalue_reference.h @@ -10,7 +10,7 @@ #include "src/__support/CPP/type_traits/type_identity.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // add_lvalue_reference namespace detail { @@ -25,6 +25,6 @@ struct add_lvalue_reference : decltype(detail::try_add_lvalue_reference(0)) { template using add_lvalue_reference_t = typename add_lvalue_reference::type; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ADD_LVALUE_REFERENCE_H diff --git a/libc/src/__support/CPP/type_traits/add_pointer.h b/libc/src/__support/CPP/type_traits/add_pointer.h index 1ea55b7137feec4ce2d87fcaa41ce1a1315839c2..72a764bb8ba60c1de4396e058e4f7dd77251c276 100644 --- a/libc/src/__support/CPP/type_traits/add_pointer.h +++ b/libc/src/__support/CPP/type_traits/add_pointer.h @@ -12,7 +12,7 @@ #include "src/__support/CPP/type_traits/type_identity.h" #include "src/__support/macros/config.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // add_pointer namespace detail { @@ -23,6 +23,6 @@ template auto try_add_pointer(...) -> cpp::type_identity; template struct add_pointer : decltype(detail::try_add_pointer(0)) {}; template using add_pointer_t = typename add_pointer::type; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ADD_POINTER_H diff --git a/libc/src/__support/CPP/type_traits/add_rvalue_reference.h b/libc/src/__support/CPP/type_traits/add_rvalue_reference.h index e2a135b3893d8f5ab361d1f866e1f997c7363dc2..76db6712e53645d1315a8f28ff9f22452e05cdc7 100644 --- a/libc/src/__support/CPP/type_traits/add_rvalue_reference.h +++ b/libc/src/__support/CPP/type_traits/add_rvalue_reference.h @@ -10,7 +10,7 @@ #include "src/__support/CPP/type_traits/type_identity.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // add_rvalue_reference namespace detail { @@ -24,6 +24,6 @@ struct add_rvalue_reference : decltype(detail::try_add_rvalue_reference(0)) { template using add_rvalue_reference_t = typename add_rvalue_reference::type; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ADD_RVALUE_REFERENCE_H diff --git a/libc/src/__support/CPP/type_traits/always_false.h b/libc/src/__support/CPP/type_traits/always_false.h index 0a633d41598df95c3fba9939015deeb81e34b2a6..a86e926569fe673681191d72c5773234c2205cb7 100644 --- a/libc/src/__support/CPP/type_traits/always_false.h +++ b/libc/src/__support/CPP/type_traits/always_false.h @@ -11,7 +11,7 @@ #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // This is technically not part of the standard but it come often enough that // it's convenient to have around. @@ -24,6 +24,6 @@ namespace __llvm_libc::cpp { // Usage `static_assert(cpp::always_false, "error message");` template LIBC_INLINE_VAR constexpr bool always_false = false; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ALWAYS_FALSE_H diff --git a/libc/src/__support/CPP/type_traits/bool_constant.h b/libc/src/__support/CPP/type_traits/bool_constant.h index 84a5c76fcde9b57db5f9d6e32bb591338aed63e1..72eeaf29bc0940bc29775c4c103372caecc1de38 100644 --- a/libc/src/__support/CPP/type_traits/bool_constant.h +++ b/libc/src/__support/CPP/type_traits/bool_constant.h @@ -10,11 +10,11 @@ #include "src/__support/CPP/type_traits/integral_constant.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // bool_constant template using bool_constant = cpp::integral_constant; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_BOOL_CONSTANT_H diff --git a/libc/src/__support/CPP/type_traits/conditional.h b/libc/src/__support/CPP/type_traits/conditional.h index 431ccb2a483fc55ebef089f5206858d75ac80912..4fa65a08e55526414226fec12ebb82df712f54d9 100644 --- a/libc/src/__support/CPP/type_traits/conditional.h +++ b/libc/src/__support/CPP/type_traits/conditional.h @@ -10,7 +10,7 @@ #include "src/__support/CPP/type_traits/type_identity.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // conditional template @@ -20,6 +20,6 @@ struct conditional : type_identity {}; template using conditional_t = typename conditional::type; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_CONDITIONAL_H diff --git a/libc/src/__support/CPP/type_traits/decay.h b/libc/src/__support/CPP/type_traits/decay.h index 0961fd1c3689b46081d514e71b1b21be2627196a..a018286fddd8abbd05c13054a83a3aaebf575bf9 100644 --- a/libc/src/__support/CPP/type_traits/decay.h +++ b/libc/src/__support/CPP/type_traits/decay.h @@ -19,7 +19,7 @@ #include "src/__support/CPP/type_traits/remove_extent.h" #include "src/__support/CPP/type_traits/remove_reference.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // decay template class decay { @@ -33,6 +33,6 @@ public: }; template using decay_t = typename decay::type; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_DECAY_H diff --git a/libc/src/__support/CPP/type_traits/enable_if.h b/libc/src/__support/CPP/type_traits/enable_if.h index 1a83c2ca732f9ef5ebd10379c4d1b3ad77330fec..cda9189b29eca79c059de71bbb7c76b41bfc72f0 100644 --- a/libc/src/__support/CPP/type_traits/enable_if.h +++ b/libc/src/__support/CPP/type_traits/enable_if.h @@ -10,7 +10,7 @@ #include "src/__support/CPP/type_traits/type_identity.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // enable_if template struct enable_if; @@ -18,6 +18,6 @@ template struct enable_if : type_identity {}; template using enable_if_t = typename enable_if::type; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_ENABLE_IF_H diff --git a/libc/src/__support/CPP/type_traits/false_type.h b/libc/src/__support/CPP/type_traits/false_type.h index 98c6d1c8412ac7a2817340d5f178bfecd623bb68..97c041ccd1624af6dedfb3d6aa90648862386b51 100644 --- a/libc/src/__support/CPP/type_traits/false_type.h +++ b/libc/src/__support/CPP/type_traits/false_type.h @@ -10,11 +10,11 @@ #include "src/__support/CPP/type_traits/bool_constant.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // false_type using false_type = cpp::bool_constant; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_FALSE_TYPE_H diff --git a/libc/src/__support/CPP/type_traits/integral_constant.h b/libc/src/__support/CPP/type_traits/integral_constant.h index 958910ca9c5e6fd59b31f29cc178e660ff8f6b6d..7b5b6c2150c71c3f3f36d1b1d23e82f877738287 100644 --- a/libc/src/__support/CPP/type_traits/integral_constant.h +++ b/libc/src/__support/CPP/type_traits/integral_constant.h @@ -10,7 +10,7 @@ #include "src/__support/macros/attributes.h" // LIBC_INLINE_VAR -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // integral_constant template struct integral_constant { @@ -18,6 +18,6 @@ template struct integral_constant { LIBC_INLINE_VAR static constexpr T value = v; }; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_INTEGRAL_CONSTANT_H diff --git a/libc/src/__support/CPP/type_traits/invoke.h b/libc/src/__support/CPP/type_traits/invoke.h index 348abe92db4900e19b602257a7569671cdcd68f0..edf6a570c433e096cecb736641c8cd2a0197830f 100644 --- a/libc/src/__support/CPP/type_traits/invoke.h +++ b/libc/src/__support/CPP/type_traits/invoke.h @@ -17,7 +17,7 @@ #include "src/__support/CPP/type_traits/is_same.h" #include "src/__support/CPP/utility/forward.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { namespace detail { @@ -57,6 +57,6 @@ decltype(auto) invoke(Function &&fun, Args &&...args) { cpp::forward(fun), cpp::forward(args)...); } -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_INVOKE_H diff --git a/libc/src/__support/CPP/type_traits/invoke_result.h b/libc/src/__support/CPP/type_traits/invoke_result.h index edcefd28e47e25928ef87041580a125e91ed6c38..a6e522fbd1a0fb4f117a08a6459b0b3501992839 100644 --- a/libc/src/__support/CPP/type_traits/invoke_result.h +++ b/libc/src/__support/CPP/type_traits/invoke_result.h @@ -12,7 +12,7 @@ #include "src/__support/CPP/type_traits/type_identity.h" #include "src/__support/CPP/utility/declval.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { template struct invoke_result : cpp::type_identity using invoke_result_t = typename invoke_result::type; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_INVOKE_RESULT_H diff --git a/libc/src/__support/CPP/type_traits/is_arithmetic.h b/libc/src/__support/CPP/type_traits/is_arithmetic.h index 9317874b36abf06c3d601ed57e372cb1bad33269..53bb21203f593fc969e26ef8c1fd34ffee1edb5a 100644 --- a/libc/src/__support/CPP/type_traits/is_arithmetic.h +++ b/libc/src/__support/CPP/type_traits/is_arithmetic.h @@ -13,7 +13,7 @@ #include "src/__support/CPP/type_traits/is_integral.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_arithmetic template @@ -22,6 +22,6 @@ struct is_arithmetic : cpp::bool_constant<(cpp::is_integral_v || template LIBC_INLINE_VAR constexpr bool is_arithmetic_v = is_arithmetic::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_ARITHMETIC_H diff --git a/libc/src/__support/CPP/type_traits/is_array.h b/libc/src/__support/CPP/type_traits/is_array.h index 2d66ff11f707c796e229dfd66c2cf95c404e5287..14360b130b2b10745e0fe2fdb129edc7b0523941 100644 --- a/libc/src/__support/CPP/type_traits/is_array.h +++ b/libc/src/__support/CPP/type_traits/is_array.h @@ -14,7 +14,7 @@ #include // For size_t -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_array template struct is_array : false_type {}; @@ -23,6 +23,6 @@ template struct is_array : true_type {}; template LIBC_INLINE_VAR constexpr bool is_array_v = is_array::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_ARRAY_H diff --git a/libc/src/__support/CPP/type_traits/is_base_of.h b/libc/src/__support/CPP/type_traits/is_base_of.h index 46435f2c7612c065ade451f416f52d4b3065caf4..47fb56876cd7fff403d8c780ba8b35a8d6b7ff4b 100644 --- a/libc/src/__support/CPP/type_traits/is_base_of.h +++ b/libc/src/__support/CPP/type_traits/is_base_of.h @@ -15,7 +15,7 @@ #include "src/__support/CPP/type_traits/true_type.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_base_of namespace detail { @@ -39,6 +39,6 @@ struct is_base_of template LIBC_INLINE_VAR constexpr bool is_base_of_v = is_base_of::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_BASE_OF_H diff --git a/libc/src/__support/CPP/type_traits/is_class.h b/libc/src/__support/CPP/type_traits/is_class.h index bf9c5469f0420a2a27fe21d3c464bf0afd656723..83ebaea544c755b849a9cb99fcb5839a0c8ee09d 100644 --- a/libc/src/__support/CPP/type_traits/is_class.h +++ b/libc/src/__support/CPP/type_traits/is_class.h @@ -13,7 +13,7 @@ #include "src/__support/CPP/type_traits/is_union.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_class namespace detail { @@ -24,6 +24,6 @@ template struct is_class : decltype(detail::test(nullptr)) {}; template LIBC_INLINE_VAR constexpr bool is_class_v = is_class::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_CLASS_H diff --git a/libc/src/__support/CPP/type_traits/is_const.h b/libc/src/__support/CPP/type_traits/is_const.h index 83e7b83f60f3d33188ebbb8e99f35f0bba3eb264..8e56a9afd229170635f7a9c7acd6836e5fb3c3d6 100644 --- a/libc/src/__support/CPP/type_traits/is_const.h +++ b/libc/src/__support/CPP/type_traits/is_const.h @@ -12,7 +12,7 @@ #include "src/__support/CPP/type_traits/true_type.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_const template struct is_const : cpp::false_type {}; @@ -20,6 +20,6 @@ template struct is_const : cpp::true_type {}; template LIBC_INLINE_VAR constexpr bool is_const_v = is_const::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_CONST_H diff --git a/libc/src/__support/CPP/type_traits/is_convertible.h b/libc/src/__support/CPP/type_traits/is_convertible.h index cfc82ca71680284ada2106c53b1867f4b95e460f..d419443493f7d2a7bfa7ee395a618b8237d3a22f 100644 --- a/libc/src/__support/CPP/type_traits/is_convertible.h +++ b/libc/src/__support/CPP/type_traits/is_convertible.h @@ -12,7 +12,7 @@ #include "src/__support/CPP/utility/declval.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_convertible namespace detail { @@ -40,6 +40,6 @@ template LIBC_INLINE_VAR constexpr bool is_convertible_v = is_convertible::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_CONVERTIBLE_H diff --git a/libc/src/__support/CPP/type_traits/is_destructible.h b/libc/src/__support/CPP/type_traits/is_destructible.h index 2d69fa95a07da275d020f205a334a868428832c1..d47de1cc797b2912e5fcea70b20b953b06d9398b 100644 --- a/libc/src/__support/CPP/type_traits/is_destructible.h +++ b/libc/src/__support/CPP/type_traits/is_destructible.h @@ -18,7 +18,7 @@ #include "src/__support/macros/attributes.h" #include "src/__support/macros/config.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_destructible #if LIBC_HAS_BUILTIN(__is_destructible) @@ -61,6 +61,6 @@ template <> struct is_destructible : public false_type {}; template LIBC_INLINE_VAR constexpr bool is_destructible_v = is_destructible::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_DESTRUCTIBLE_H diff --git a/libc/src/__support/CPP/type_traits/is_enum.h b/libc/src/__support/CPP/type_traits/is_enum.h index 14cea71e0fe4f3f9d456854c4e29b75c6c4717ed..8d55a1ca8a9f7febefd966428d8aa1baa6d7e4ce 100644 --- a/libc/src/__support/CPP/type_traits/is_enum.h +++ b/libc/src/__support/CPP/type_traits/is_enum.h @@ -11,13 +11,13 @@ #include "src/__support/CPP/type_traits/bool_constant.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_enum template struct is_enum : bool_constant<__is_enum(T)> {}; template LIBC_INLINE_VAR constexpr bool is_enum_v = is_enum::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_ENUM_H diff --git a/libc/src/__support/CPP/type_traits/is_floating_point.h b/libc/src/__support/CPP/type_traits/is_floating_point.h index ccb004d4cf1581a3cb5040911a67f5a9940d2ddc..2df75a072c3606c7a7c8e18d8c85230dd1c6c04a 100644 --- a/libc/src/__support/CPP/type_traits/is_floating_point.h +++ b/libc/src/__support/CPP/type_traits/is_floating_point.h @@ -12,7 +12,7 @@ #include "src/__support/CPP/type_traits/remove_cv.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_floating_point template struct is_floating_point { @@ -30,6 +30,6 @@ template LIBC_INLINE_VAR constexpr bool is_floating_point_v = is_floating_point::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_FLOATING_POINT_H diff --git a/libc/src/__support/CPP/type_traits/is_function.h b/libc/src/__support/CPP/type_traits/is_function.h index d8a9166ee99c4f1440910c66aac824e0943abf5a..557b3224484bcadfa0b0f795ad349052dc5b8850 100644 --- a/libc/src/__support/CPP/type_traits/is_function.h +++ b/libc/src/__support/CPP/type_traits/is_function.h @@ -14,7 +14,7 @@ #include "src/__support/macros/attributes.h" #include "src/__support/macros/config.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_function #if LIBC_HAS_BUILTIN(__is_function) @@ -28,6 +28,6 @@ struct is_function template LIBC_INLINE_VAR constexpr bool is_function_v = is_function::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_FUNCTION_H diff --git a/libc/src/__support/CPP/type_traits/is_integral.h b/libc/src/__support/CPP/type_traits/is_integral.h index 511101c278a9440306c24f7f00f3155178d0da04..2808be594b20edd1884e5cb58e53e9e6ad1ad7aa 100644 --- a/libc/src/__support/CPP/type_traits/is_integral.h +++ b/libc/src/__support/CPP/type_traits/is_integral.h @@ -12,7 +12,7 @@ #include "src/__support/CPP/type_traits/remove_cv.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_integral template struct is_integral { @@ -34,6 +34,6 @@ public: template LIBC_INLINE_VAR constexpr bool is_integral_v = is_integral::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_INTEGRAL_H diff --git a/libc/src/__support/CPP/type_traits/is_lvalue_reference.h b/libc/src/__support/CPP/type_traits/is_lvalue_reference.h index ca3b7d9fc2dd7a6453154db354782e52add84515..f52e303afad2a5f689a17d9768d676dc47e1fff6 100644 --- a/libc/src/__support/CPP/type_traits/is_lvalue_reference.h +++ b/libc/src/__support/CPP/type_traits/is_lvalue_reference.h @@ -14,7 +14,7 @@ #include "src/__support/macros/attributes.h" #include "src/__support/macros/config.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_lvalue_reference #if LIBC_HAS_BUILTIN(__is_lvalue_reference) @@ -28,6 +28,6 @@ template LIBC_INLINE_VAR constexpr bool is_lvalue_reference_v = is_lvalue_reference::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_LVALUE_REFERENCE_H diff --git a/libc/src/__support/CPP/type_traits/is_member_pointer.h b/libc/src/__support/CPP/type_traits/is_member_pointer.h index c885e773de84e0e11c747eef473ce4116a707d84..f1f362f8dfd5446d383d8765f9b53aec21086322 100644 --- a/libc/src/__support/CPP/type_traits/is_member_pointer.h +++ b/libc/src/__support/CPP/type_traits/is_member_pointer.h @@ -13,7 +13,7 @@ #include "src/__support/CPP/type_traits/true_type.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_member_pointer template struct is_member_pointer_helper : cpp::false_type {}; @@ -25,6 +25,6 @@ template LIBC_INLINE_VAR constexpr bool is_member_pointer_v = is_member_pointer::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_MEMBER_POINTER_H diff --git a/libc/src/__support/CPP/type_traits/is_null_pointer.h b/libc/src/__support/CPP/type_traits/is_null_pointer.h index bc661e32075abfb93aa2547a76dc952cb53cf3c0..14452433862ae73470040c17adf022c3851022c4 100644 --- a/libc/src/__support/CPP/type_traits/is_null_pointer.h +++ b/libc/src/__support/CPP/type_traits/is_null_pointer.h @@ -12,7 +12,7 @@ #include "src/__support/CPP/type_traits/remove_cv.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_null_pointer using nullptr_t = decltype(nullptr); @@ -21,6 +21,6 @@ struct is_null_pointer : cpp::is_same> {}; template LIBC_INLINE_VAR constexpr bool is_null_pointer_v = is_null_pointer::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_NULL_POINTER_H diff --git a/libc/src/__support/CPP/type_traits/is_object.h b/libc/src/__support/CPP/type_traits/is_object.h index a9dafee7b49a72f7bb3dafc7f871fda5cb90a497..a23bebca572bec56d076a8d7d47bf49d4dc49c20 100644 --- a/libc/src/__support/CPP/type_traits/is_object.h +++ b/libc/src/__support/CPP/type_traits/is_object.h @@ -15,7 +15,7 @@ #include "src/__support/CPP/type_traits/is_union.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_object template @@ -25,6 +25,6 @@ struct is_object template LIBC_INLINE_VAR constexpr bool is_object_v = is_object::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_OBJECT_H diff --git a/libc/src/__support/CPP/type_traits/is_pointer.h b/libc/src/__support/CPP/type_traits/is_pointer.h index 0903c586c806de1de3fa8109add23ae39c98d5b4..177f8e5b64e7ab51b3860426a33c873f6f89bdba 100644 --- a/libc/src/__support/CPP/type_traits/is_pointer.h +++ b/libc/src/__support/CPP/type_traits/is_pointer.h @@ -12,7 +12,7 @@ #include "src/__support/CPP/type_traits/true_type.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_pointer template struct is_pointer : cpp::false_type {}; @@ -23,6 +23,6 @@ template struct is_pointer : cpp::true_type {}; template LIBC_INLINE_VAR constexpr bool is_pointer_v = is_pointer::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_POINTER_H diff --git a/libc/src/__support/CPP/type_traits/is_reference.h b/libc/src/__support/CPP/type_traits/is_reference.h index ff3b26c769aa1692804f9c447d1e202881516f75..c017028edf411f6cd947ca530cc3c3a6fce7afa8 100644 --- a/libc/src/__support/CPP/type_traits/is_reference.h +++ b/libc/src/__support/CPP/type_traits/is_reference.h @@ -14,7 +14,7 @@ #include "src/__support/macros/attributes.h" #include "src/__support/macros/config.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_reference #if LIBC_HAS_BUILTIN(__is_reference) @@ -27,6 +27,6 @@ template struct is_reference : public true_type {}; template LIBC_INLINE_VAR constexpr bool is_reference_v = is_reference::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_REFERENCE_H diff --git a/libc/src/__support/CPP/type_traits/is_rvalue_reference.h b/libc/src/__support/CPP/type_traits/is_rvalue_reference.h index eb8412a1d82ea71269d7fb9d3505e273a1aaa99e..f0487e41c998fefdcf17ae51cf40b9067476e132 100644 --- a/libc/src/__support/CPP/type_traits/is_rvalue_reference.h +++ b/libc/src/__support/CPP/type_traits/is_rvalue_reference.h @@ -14,7 +14,7 @@ #include "src/__support/macros/attributes.h" #include "src/__support/macros/config.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_rvalue_reference #if LIBC_HAS_BUILTIN(__is_rvalue_reference) @@ -28,6 +28,6 @@ template LIBC_INLINE_VAR constexpr bool is_rvalue_reference_v = is_rvalue_reference::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_RVALUE_REFERENCE_H diff --git a/libc/src/__support/CPP/type_traits/is_same.h b/libc/src/__support/CPP/type_traits/is_same.h index bd1c7362b64cd7ce9023954b4f8daa2243b364be..eb73952f9f971f109359164a4dd7e8697bf93e37 100644 --- a/libc/src/__support/CPP/type_traits/is_same.h +++ b/libc/src/__support/CPP/type_traits/is_same.h @@ -12,7 +12,7 @@ #include "src/__support/CPP/type_traits/true_type.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_same template struct is_same : cpp::false_type {}; @@ -20,6 +20,6 @@ template struct is_same : cpp::true_type {}; template LIBC_INLINE_VAR constexpr bool is_same_v = is_same::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_SAME_H diff --git a/libc/src/__support/CPP/type_traits/is_scalar.h b/libc/src/__support/CPP/type_traits/is_scalar.h index ed7e34e508d038367fbbc24e05ebc4378fdd3f82..1f71cde36ca27af08a5aee18461591f9e724c52a 100644 --- a/libc/src/__support/CPP/type_traits/is_scalar.h +++ b/libc/src/__support/CPP/type_traits/is_scalar.h @@ -16,7 +16,7 @@ #include "src/__support/CPP/type_traits/is_pointer.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_scalar template @@ -27,6 +27,6 @@ struct is_scalar template LIBC_INLINE_VAR constexpr bool is_scalar_v = is_scalar::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_SCALAR_H diff --git a/libc/src/__support/CPP/type_traits/is_signed.h b/libc/src/__support/CPP/type_traits/is_signed.h index 71151307129bf994ca8d6b971ba80e9e54446d1c..971fe692679f93afc05659c989cf6d9aa629d865 100644 --- a/libc/src/__support/CPP/type_traits/is_signed.h +++ b/libc/src/__support/CPP/type_traits/is_signed.h @@ -12,7 +12,7 @@ #include "src/__support/CPP/type_traits/is_arithmetic.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_signed template @@ -23,6 +23,6 @@ struct is_signed : bool_constant<(is_arithmetic_v && (T(-1) < T(0)))> { template LIBC_INLINE_VAR constexpr bool is_signed_v = is_signed::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_SIGNED_H diff --git a/libc/src/__support/CPP/type_traits/is_trivially_constructible.h b/libc/src/__support/CPP/type_traits/is_trivially_constructible.h index daa9c7add2c0a93dce297685f25d3186ee83e406..be97b2289cf0abcee2cdbf3410ab87a9a6e3486d 100644 --- a/libc/src/__support/CPP/type_traits/is_trivially_constructible.h +++ b/libc/src/__support/CPP/type_traits/is_trivially_constructible.h @@ -10,13 +10,13 @@ #include "src/__support/CPP/type_traits/integral_constant.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_trivially_constructible template struct is_trivially_constructible : integral_constant {}; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_TRIVIALLY_CONSTRUCTIBLE_H diff --git a/libc/src/__support/CPP/type_traits/is_trivially_copyable.h b/libc/src/__support/CPP/type_traits/is_trivially_copyable.h index 9e7d05e2ecc74f53566057be17c3ad3e438aaf59..0c3fdcc711d57f69e43d93f107d9e0db75c81c49 100644 --- a/libc/src/__support/CPP/type_traits/is_trivially_copyable.h +++ b/libc/src/__support/CPP/type_traits/is_trivially_copyable.h @@ -11,13 +11,13 @@ #include "src/__support/CPP/type_traits/integral_constant.h" #include "src/__support/macros/config.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_trivially_copyable template struct is_trivially_copyable : public integral_constant {}; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_TRIVIALLY_COPYABLE_H diff --git a/libc/src/__support/CPP/type_traits/is_trivially_destructible.h b/libc/src/__support/CPP/type_traits/is_trivially_destructible.h index ce32309b3bf7a8ac44383445ac92b4ccacb74d06..3345149433afc47e4476c29860158d89550c0e27 100644 --- a/libc/src/__support/CPP/type_traits/is_trivially_destructible.h +++ b/libc/src/__support/CPP/type_traits/is_trivially_destructible.h @@ -13,7 +13,7 @@ #include "src/__support/macros/attributes.h" #include "src/__support/macros/config.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_trivially_destructible #if LIBC_HAS_BUILTIN(__is_trivially_destructible) @@ -30,6 +30,6 @@ template LIBC_INLINE_VAR constexpr bool is_trivially_destructible_v = is_trivially_destructible::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_TRIVIALLY_DESTRUCTIBLE_H diff --git a/libc/src/__support/CPP/type_traits/is_union.h b/libc/src/__support/CPP/type_traits/is_union.h index 807d8f13c2b1c76b10c542eab69e3dbcb63a20e1..04e78a89fc0c10f81f8d160f37106306a13ef42d 100644 --- a/libc/src/__support/CPP/type_traits/is_union.h +++ b/libc/src/__support/CPP/type_traits/is_union.h @@ -11,13 +11,13 @@ #include "src/__support/CPP/type_traits/bool_constant.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_union template struct is_union : bool_constant<__is_union(T)> {}; template LIBC_INLINE_VAR constexpr bool is_union_v = is_union::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_UNION_H diff --git a/libc/src/__support/CPP/type_traits/is_unsigned.h b/libc/src/__support/CPP/type_traits/is_unsigned.h index c4dc777441e29ceb28daab70b709a9b85d65c467..f089c2b61632f1d5893f6ee467d031776ca7bc31 100644 --- a/libc/src/__support/CPP/type_traits/is_unsigned.h +++ b/libc/src/__support/CPP/type_traits/is_unsigned.h @@ -12,7 +12,7 @@ #include "src/__support/CPP/type_traits/is_arithmetic.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_unsigned template @@ -23,6 +23,6 @@ struct is_unsigned : bool_constant<(is_arithmetic_v && (T(-1) > T(0)))> { template LIBC_INLINE_VAR constexpr bool is_unsigned_v = is_unsigned::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_UNSIGNED_H diff --git a/libc/src/__support/CPP/type_traits/is_void.h b/libc/src/__support/CPP/type_traits/is_void.h index 54cda12def095cdf1014105d8b28d65853027754..040dc831fd64e16c037835d0292dc9215162e1ab 100644 --- a/libc/src/__support/CPP/type_traits/is_void.h +++ b/libc/src/__support/CPP/type_traits/is_void.h @@ -12,13 +12,13 @@ #include "src/__support/CPP/type_traits/remove_cv.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // is_void template struct is_void : is_same> {}; template LIBC_INLINE_VAR constexpr bool is_void_v = is_void::value; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_VOID_H diff --git a/libc/src/__support/CPP/type_traits/make_signed.h b/libc/src/__support/CPP/type_traits/make_signed.h index 0e8bff68ddb75d9dfa370d8ce89abf8fc08b79e8..21302850bfd4abd7390e5c888ea831c094b54562 100644 --- a/libc/src/__support/CPP/type_traits/make_signed.h +++ b/libc/src/__support/CPP/type_traits/make_signed.h @@ -10,7 +10,7 @@ #include "src/__support/CPP/type_traits/type_identity.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // make_signed template struct make_signed; @@ -32,6 +32,6 @@ template <> struct make_signed<__uint128_t> : type_identity<__int128_t> {}; #endif template using make_signed_t = typename make_signed::type; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_MAKE_SIGNED_H diff --git a/libc/src/__support/CPP/type_traits/make_unsigned.h b/libc/src/__support/CPP/type_traits/make_unsigned.h index 75fc8188b870bf36b5c0acdce761a438fdff0e6e..20948014a66574f50466be8ac42aeb077144e89d 100644 --- a/libc/src/__support/CPP/type_traits/make_unsigned.h +++ b/libc/src/__support/CPP/type_traits/make_unsigned.h @@ -10,7 +10,7 @@ #include "src/__support/CPP/type_traits/type_identity.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // make_unsigned @@ -37,6 +37,6 @@ template <> struct make_unsigned<__uint128_t> : type_identity<__uint128_t> {}; #endif template using make_unsigned_t = typename make_unsigned::type; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_MAKE_UNSIGNED_H diff --git a/libc/src/__support/CPP/type_traits/remove_all_extents.h b/libc/src/__support/CPP/type_traits/remove_all_extents.h index da66043c58c126123b79480e703101f5549efe91..bff6341d3e456010f40efd4db21ee355ecf94c5e 100644 --- a/libc/src/__support/CPP/type_traits/remove_all_extents.h +++ b/libc/src/__support/CPP/type_traits/remove_all_extents.h @@ -13,7 +13,7 @@ #include // size_t -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // remove_all_extents #if LIBC_HAS_BUILTIN(__remove_all_extents) @@ -34,6 +34,6 @@ template using remove_all_extents_t = typename remove_all_extents::type; #endif -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_ALL_EXTENTS_H diff --git a/libc/src/__support/CPP/type_traits/remove_cv.h b/libc/src/__support/CPP/type_traits/remove_cv.h index 972e0fc2fdb01a86c0917d29337767749e43b8aa..3cd7e5914119cc2240482086f6936f08ae0edc97 100644 --- a/libc/src/__support/CPP/type_traits/remove_cv.h +++ b/libc/src/__support/CPP/type_traits/remove_cv.h @@ -10,7 +10,7 @@ #include "src/__support/CPP/type_traits/type_identity.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // remove_cv template struct remove_cv : cpp::type_identity {}; @@ -20,6 +20,6 @@ template struct remove_cv : cpp::type_identity {}; template using remove_cv_t = typename remove_cv::type; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_CV_H diff --git a/libc/src/__support/CPP/type_traits/remove_cvref.h b/libc/src/__support/CPP/type_traits/remove_cvref.h index 73831486d01161a0c2ec6857d0cce1bf9e56e828..6b410bb5841bc3a69723472e8565af6a645b124c 100644 --- a/libc/src/__support/CPP/type_traits/remove_cvref.h +++ b/libc/src/__support/CPP/type_traits/remove_cvref.h @@ -11,7 +11,7 @@ #include "src/__support/CPP/type_traits/remove_cv.h" #include "src/__support/CPP/type_traits/remove_reference.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // remove_cvref template struct remove_cvref { @@ -19,6 +19,6 @@ template struct remove_cvref { }; template using remove_cvref_t = typename remove_cvref::type; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_CVREF_H diff --git a/libc/src/__support/CPP/type_traits/remove_extent.h b/libc/src/__support/CPP/type_traits/remove_extent.h index 72d8d984427fb203f9553ecaccb316d9e18c57ed..3c0759dc1a522a75153721bcfb0f19d62191a5dd 100644 --- a/libc/src/__support/CPP/type_traits/remove_extent.h +++ b/libc/src/__support/CPP/type_traits/remove_extent.h @@ -11,7 +11,7 @@ #include "src/__support/CPP/type_traits/type_identity.h" #include "stddef.h" // size_t -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // remove_extent template struct remove_extent : cpp::type_identity {}; @@ -20,6 +20,6 @@ template struct remove_extent : cpp::type_identity {}; template using remove_extent_t = typename remove_extent::type; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_EXTENT_H diff --git a/libc/src/__support/CPP/type_traits/remove_reference.h b/libc/src/__support/CPP/type_traits/remove_reference.h index 34f0ae9ff3e3ba9136ceb5adc8466534567ae662..02a0bd6373d3ab44915ac637de69569510e3eb15 100644 --- a/libc/src/__support/CPP/type_traits/remove_reference.h +++ b/libc/src/__support/CPP/type_traits/remove_reference.h @@ -10,7 +10,7 @@ #include "src/__support/CPP/type_traits/type_identity.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // remove_reference template struct remove_reference : cpp::type_identity {}; @@ -19,6 +19,6 @@ template struct remove_reference : cpp::type_identity {}; template using remove_reference_t = typename remove_reference::type; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_REMOVE_REFERENCE_H diff --git a/libc/src/__support/CPP/type_traits/true_type.h b/libc/src/__support/CPP/type_traits/true_type.h index 8551cef874f7ce362d5cd0ce24538551240830e7..60ffc8acd9dad1407539af133071baa38007e422 100644 --- a/libc/src/__support/CPP/type_traits/true_type.h +++ b/libc/src/__support/CPP/type_traits/true_type.h @@ -10,11 +10,11 @@ #include "src/__support/CPP/type_traits/bool_constant.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // true_type using true_type = cpp::bool_constant; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_TRUE_TYPE_H diff --git a/libc/src/__support/CPP/type_traits/type_identity.h b/libc/src/__support/CPP/type_traits/type_identity.h index 0804276a5424d86c93596731add1eb183c1a75be..f33a43ac7ea10b7438e00419c53261c968329888 100644 --- a/libc/src/__support/CPP/type_traits/type_identity.h +++ b/libc/src/__support/CPP/type_traits/type_identity.h @@ -8,13 +8,13 @@ #ifndef LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_TYPE_IDENTITY_H #define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_TYPE_IDENTITY_H -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // type_identity template struct type_identity { using type = T; }; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_TYPE_IDENTITY_H diff --git a/libc/src/__support/CPP/type_traits/void_t.h b/libc/src/__support/CPP/type_traits/void_t.h index 03fe6b957e712269d01b233c483f50763983cd84..babdaccfbc53703b7d745cc164555efb5b186243 100644 --- a/libc/src/__support/CPP/type_traits/void_t.h +++ b/libc/src/__support/CPP/type_traits/void_t.h @@ -10,7 +10,7 @@ #include "src/__support/CPP/type_traits/type_identity.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // void_t @@ -21,6 +21,6 @@ template struct make_void : cpp::type_identity {}; template using void_t = typename detail::make_void::type; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_VOID_T_H diff --git a/libc/src/__support/CPP/utility/declval.h b/libc/src/__support/CPP/utility/declval.h index 2522baf0e1b150473cb104800a43aeb96cb9148b..0d00aa6d38199b460b0a19de455efc8174abab1f 100644 --- a/libc/src/__support/CPP/utility/declval.h +++ b/libc/src/__support/CPP/utility/declval.h @@ -11,7 +11,7 @@ #include "src/__support/CPP/type_traits/add_rvalue_reference.h" #include "src/__support/CPP/type_traits/always_false.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // declval template cpp::add_rvalue_reference_t declval() { @@ -19,6 +19,6 @@ template cpp::add_rvalue_reference_t declval() { "declval not allowed in an evaluated context"); } -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_UTILITY_DECLVAL_H diff --git a/libc/src/__support/CPP/utility/forward.h b/libc/src/__support/CPP/utility/forward.h index 78ffb736ceb3de8cdddf57f900fac29f5c5bdf03..891097ec96d545d4b7d49a4f9cdc99f3b5338e97 100644 --- a/libc/src/__support/CPP/utility/forward.h +++ b/libc/src/__support/CPP/utility/forward.h @@ -12,7 +12,7 @@ #include "src/__support/CPP/type_traits/remove_reference.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // forward template @@ -27,6 +27,6 @@ LIBC_INLINE constexpr T &&forward(remove_reference_t &&value) { return static_cast(value); } -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_UTILITY_FORWARD_H diff --git a/libc/src/__support/CPP/utility/in_place.h b/libc/src/__support/CPP/utility/in_place.h index dfb7486c4eba0bfeee627bcdf52a8fdf71ffc5cc..f15703fad63b3ac6e42577a087ce53bf43497922 100644 --- a/libc/src/__support/CPP/utility/in_place.h +++ b/libc/src/__support/CPP/utility/in_place.h @@ -12,7 +12,7 @@ #include // size_t -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // in_place struct in_place_t { @@ -31,6 +31,6 @@ template struct in_place_index_t { template LIBC_INLINE_VAR constexpr in_place_index_t in_place_index{}; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_UTILITY_IN_PLACE_H diff --git a/libc/src/__support/CPP/utility/integer_sequence.h b/libc/src/__support/CPP/utility/integer_sequence.h index 3d2e001e87799b7e1ab964c13369aa07a4e8289b..2ed26df3d238eee8b2c5f6b540bdf35598af2ff2 100644 --- a/libc/src/__support/CPP/utility/integer_sequence.h +++ b/libc/src/__support/CPP/utility/integer_sequence.h @@ -10,7 +10,7 @@ #include "src/__support/CPP/type_traits/is_integral.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // integer_sequence template struct integer_sequence { @@ -32,6 +32,6 @@ template using make_integer_sequence = typename detail::make_integer_sequence::type; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_UTILITY_INTEGER_SEQUENCE_H diff --git a/libc/src/__support/CPP/utility/move.h b/libc/src/__support/CPP/utility/move.h index bc0b63e3687c80d7da74d40490277811498ff735..2b4cdf0c4a160b19c3d10b4155e28744ec4dd609 100644 --- a/libc/src/__support/CPP/utility/move.h +++ b/libc/src/__support/CPP/utility/move.h @@ -10,13 +10,13 @@ #include "src/__support/CPP/type_traits/remove_reference.h" -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { // move template constexpr cpp::remove_reference_t &&move(T &&t) { return static_cast &&>(t); } -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_CPP_UTILITY_MOVE_H diff --git a/libc/src/__support/FPUtil/BasicOperations.h b/libc/src/__support/FPUtil/BasicOperations.h index 67b8e666479f2d96ae0f4971b3c37d50e4a05ea2..2ec61517b0b8086cd8070212cde64f43df615bc4 100644 --- a/libc/src/__support/FPUtil/BasicOperations.h +++ b/libc/src/__support/FPUtil/BasicOperations.h @@ -14,7 +14,7 @@ #include "src/__support/CPP/type_traits.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template , int> = 0> @@ -76,6 +76,6 @@ LIBC_INLINE T fdim(T x, T y) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_BASICOPERATIONS_H diff --git a/libc/src/__support/FPUtil/DivisionAndRemainderOperations.h b/libc/src/__support/FPUtil/DivisionAndRemainderOperations.h index f0b5ba98e43ab763829144108af970d9aedbb2a8..60252fe9cb877ab4f14d238ae3227992d822a793 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 29ae4a37f8823f5ebdd4efb24b3c368ca3f2d5d5..8801760d887fc2eda2faf2c3ea49e923d8d03ad1 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 eb95bf0f2ee108f0783d1db18c4cf3892c7c4b88..32e562ab1d5e48d74ca39562aa805e3ee6612178 100644 --- a/libc/src/__support/FPUtil/FMA.h +++ b/libc/src/__support/FPUtil/FMA.h @@ -29,7 +29,7 @@ #include "generic/FMA.h" #include "src/__support/CPP/type_traits.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template LIBC_INLINE T fma(T x, T y, T z) { @@ -37,7 +37,7 @@ template LIBC_INLINE T fma(T x, T y, T z) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif diff --git a/libc/src/__support/FPUtil/FPBits.h b/libc/src/__support/FPUtil/FPBits.h index d7ab076130840f5b2e2e8f540fa583f6c59fa12c..226dd9b85515d61255620e1c9fbcd2e7bbf10a35 100644 --- a/libc/src/__support/FPUtil/FPBits.h +++ b/libc/src/__support/FPUtil/FPBits.h @@ -19,7 +19,7 @@ #include "FloatProperties.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template struct MantissaWidth { @@ -233,7 +233,7 @@ template struct FPBits { }; } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #ifdef SPECIAL_X86_LONG_DOUBLE #include "x86_64/LongDoubleBits.h" diff --git a/libc/src/__support/FPUtil/FloatProperties.h b/libc/src/__support/FPUtil/FloatProperties.h index 3df961a9380e5e54d6527bd60d647bd222f51201..c1d58a87101afc144acd25a01db70064fe9721a2 100644 --- a/libc/src/__support/FPUtil/FloatProperties.h +++ b/libc/src/__support/FPUtil/FloatProperties.h @@ -15,7 +15,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template struct FloatProperties {}; @@ -194,6 +194,6 @@ template using FloatTypeT = typename FloatType::Type; } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_FLOATPROPERTIES_H diff --git a/libc/src/__support/FPUtil/Hypot.h b/libc/src/__support/FPUtil/Hypot.h index 5bf6db72bdc130e3596d04f54bd68cc5c67afc61..357d9a6e99c7457c603c2f85a5263649d47044fd 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 676dafa27c963120e8a18696abbf66166e5dd5e0..6d62a2d0fcdf2bebdc8530ee1e9c951aeed30e37 100644 --- a/libc/src/__support/FPUtil/ManipulationFunctions.h +++ b/libc/src/__support/FPUtil/ManipulationFunctions.h @@ -22,7 +22,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template , int> = 0> @@ -174,7 +174,7 @@ LIBC_INLINE T nextafter(T from, T to) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #ifdef SPECIAL_X86_LONG_DOUBLE #include "x86_64/NextAfterLongDouble.h" diff --git a/libc/src/__support/FPUtil/NearestIntegerOperations.h b/libc/src/__support/FPUtil/NearestIntegerOperations.h index 9f151f24f3b8a9ba1496e05d982931fa08d24888..8c4b24803bec1d31d61dc5229adb70adf0250008 100644 --- a/libc/src/__support/FPUtil/NearestIntegerOperations.h +++ b/libc/src/__support/FPUtil/NearestIntegerOperations.h @@ -18,7 +18,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template , int> = 0> @@ -286,6 +286,6 @@ LIBC_INLINE I round_to_signed_integer_using_current_rounding_mode(F x) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_NEARESTINTEGEROPERATIONS_H diff --git a/libc/src/__support/FPUtil/NormalFloat.h b/libc/src/__support/FPUtil/NormalFloat.h index 0b2eb628ee1960b99658338486d82db439a7f980..afbf97cc2b6386db8d726c2ddd61b8ba71c131c1 100644 --- a/libc/src/__support/FPUtil/NormalFloat.h +++ b/libc/src/__support/FPUtil/NormalFloat.h @@ -16,7 +16,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { // A class which stores the normalized form of a floating point value. @@ -262,6 +262,6 @@ template <> LIBC_INLINE NormalFloat::operator long double() const { #endif // SPECIAL_X86_LONG_DOUBLE } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_NORMALFLOAT_H diff --git a/libc/src/__support/FPUtil/PolyEval.h b/libc/src/__support/FPUtil/PolyEval.h index 12027289bde9e3f2bf2364be39cc39bf4981f501..7a6384541a74744594b7cbbd906953ae19a9cd9f 100644 --- a/libc/src/__support/FPUtil/PolyEval.h +++ b/libc/src/__support/FPUtil/PolyEval.h @@ -20,7 +20,7 @@ // Example: to evaluate x^3 + 2*x^2 + 3*x + 4, call // polyeval( x, 4.0, 3.0, 2.0, 1.0 ) -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template @@ -48,6 +48,6 @@ polyeval(T x, T a0, Ts... a) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_POLYEVAL_H diff --git a/libc/src/__support/FPUtil/XFloat.h b/libc/src/__support/FPUtil/XFloat.h index b3f8f44badd3325f900e82170bacc7b53269fe2f..fe334f8a33011d32b15ff16b6a1027bd690fe259 100644 --- a/libc/src/__support/FPUtil/XFloat.h +++ b/libc/src/__support/FPUtil/XFloat.h @@ -12,7 +12,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { // Store and manipulate positive double precision numbers at |Precision| bits. @@ -177,4 +177,4 @@ 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 4cc4920bb39c16d856f3d7f3c870a2879f1ae5e8..47c65af452809b568d265d00de1c1edfb8bd3837 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 eaa3b2c11bb2a47a1b24b86854991916f9a25911..6254a0673ff4277155b74ce9413e8dcb2316f5fc 100644 --- a/libc/src/__support/FPUtil/aarch64/FMA.h +++ b/libc/src/__support/FPUtil/aarch64/FMA.h @@ -23,7 +23,7 @@ #include "src/__support/CPP/type_traits.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template @@ -45,6 +45,6 @@ LIBC_INLINE cpp::enable_if_t, T> fma(T x, T y, T z) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_AARCH64_FMA_H diff --git a/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h b/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h index 9243df1e3603563cc8ae92a9f97c784254c270c5..6a0ac5fef0cac53ee2e49337e7946e6bff3d0545 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 2ee4e3363a11bf53edf424d0babfdb03a0cae85b..ca0763078ff0d40102be5adf98731d8a321e3c95 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 6edf2a489064f4f60d8622ebcefc0f3bae8bb2ac..bad7e316bf370c1b7b6b308be6c2ae24af8338dd 100644 --- a/libc/src/__support/FPUtil/aarch64/sqrt.h +++ b/libc/src/__support/FPUtil/aarch64/sqrt.h @@ -18,7 +18,7 @@ #include "src/__support/FPUtil/generic/sqrt.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template <> LIBC_INLINE float sqrt(float x) { @@ -34,6 +34,6 @@ template <> LIBC_INLINE double sqrt(double x) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_AARCH64_SQRT_H diff --git a/libc/src/__support/FPUtil/arm/FEnvImpl.h b/libc/src/__support/FPUtil/arm/FEnvImpl.h index 5e856075b1d76f871a48510dbaf583ae35332060..e2669d13bc2a7c21e28226bb3ed0add16e36128d 100644 --- a/libc/src/__support/FPUtil/arm/FEnvImpl.h +++ b/libc/src/__support/FPUtil/arm/FEnvImpl.h @@ -15,7 +15,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { struct FEnv { @@ -260,6 +260,6 @@ LIBC_INLINE int set_env(const fenv_t *envp) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_ARM_FENVIMPL_H diff --git a/libc/src/__support/FPUtil/double_double.h b/libc/src/__support/FPUtil/double_double.h index fd44d5e95268f6076fcd0453f20ba1a414874c9e..b9490b52f6b41e0c8a83b39593b040cf503734c0 100644 --- a/libc/src/__support/FPUtil/double_double.h +++ b/libc/src/__support/FPUtil/double_double.h @@ -14,9 +14,9 @@ #include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA #include "src/__support/number_pair.h" -namespace __llvm_libc::fputil { +namespace LIBC_NAMESPACE::fputil { -using DoubleDouble = __llvm_libc::NumberPair; +using DoubleDouble = LIBC_NAMESPACE::NumberPair; // The output of Dekker's FastTwoSum algorithm is correct, i.e.: // r.hi + r.lo = a + b exactly @@ -99,6 +99,6 @@ LIBC_INLINE DoubleDouble multiply_add(const DoubleDouble &a, return add(c, quick_mult(a, b)); } -} // namespace __llvm_libc::fputil +} // namespace LIBC_NAMESPACE::fputil #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_DOUBLE_DOUBLE_H diff --git a/libc/src/__support/FPUtil/dyadic_float.h b/libc/src/__support/FPUtil/dyadic_float.h index ec000d592b9fecc47e4f48922de1ae06f9f4de52..2ee97b4ac7f7836968609543509e0ed50f4e94d3 100644 --- a/libc/src/__support/FPUtil/dyadic_float.h +++ b/libc/src/__support/FPUtil/dyadic_float.h @@ -18,7 +18,7 @@ #include -namespace __llvm_libc::fputil { +namespace LIBC_NAMESPACE::fputil { // A generic class to perform comuptations of high precision floating points. // We store the value in dyadic format, including 3 fields: @@ -32,7 +32,7 @@ namespace __llvm_libc::fputil { // To simplify and improve the efficiency, many functions will assume that the // inputs are normal. template struct DyadicFloat { - using MantissaType = __llvm_libc::cpp::UInt; + using MantissaType = LIBC_NAMESPACE::cpp::UInt; bool sign = false; int exponent = 0; @@ -306,6 +306,6 @@ constexpr DyadicFloat mul_pow_2(DyadicFloat a, int32_t pow_2) { return result; } -} // namespace __llvm_libc::fputil +} // namespace LIBC_NAMESPACE::fputil #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_DYADIC_FLOAT_H diff --git a/libc/src/__support/FPUtil/except_value_utils.h b/libc/src/__support/FPUtil/except_value_utils.h index 0229c961f05364f3234f9aba6f3dec0fe00f2d6b..b51025096e36f623dee16896d97f2d88bf1a344d 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 46cd102d83f6409e024bcb6223c0bd62ae0a26d0..4dec85ac2cc8624784de2c74661762992df29002 100644 --- a/libc/src/__support/FPUtil/fpbits_str.h +++ b/libc/src/__support/FPUtil/fpbits_str.h @@ -16,7 +16,7 @@ #include "src/__support/integer_to_string.h" #include "src/__support/macros/attributes.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace details { @@ -70,6 +70,6 @@ template LIBC_INLINE cpp::string str(fputil::FPBits x) { return s; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_FP_BITS_STR_H diff --git a/libc/src/__support/FPUtil/generic/FMA.h b/libc/src/__support/FPUtil/generic/FMA.h index ee6659346de4e929fe11bb64f8adf1a8272e05c8..b90b134926bb6497a5239f884e1f8a49149fe36c 100644 --- a/libc/src/__support/FPUtil/generic/FMA.h +++ b/libc/src/__support/FPUtil/generic/FMA.h @@ -19,7 +19,7 @@ #include "src/__support/macros/attributes.h" // LIBC_INLINE #include "src/__support/macros/optimization.h" // LIBC_UNLIKELY -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { namespace generic { @@ -290,6 +290,6 @@ template <> LIBC_INLINE double fma(double x, double y, double z) { } // namespace generic } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_GENERIC_FMA_H diff --git a/libc/src/__support/FPUtil/generic/FMod.h b/libc/src/__support/FPUtil/generic/FMod.h index 10998443d854b964ea4229cbd6dc32f758ac24cd..48906e545a89ba3537b9e47fb62490740f99864c 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 9b29e8480e80f28ce1b7cde54c29cd74b1a46d73..61278aca949cd6102bd9ccc282e304c20c8f4b42 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 35ace1365c442c6718e5bdcbf0be93e9e9126886..7d446d3a5ffb13530cdead130d35593a796d2799 100644 --- a/libc/src/__support/FPUtil/generic/sqrt.h +++ b/libc/src/__support/FPUtil/generic/sqrt.h @@ -20,7 +20,7 @@ #include "src/__support/builtin_wrappers.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { namespace internal { @@ -169,6 +169,6 @@ LIBC_INLINE cpp::enable_if_t, T> sqrt(T x) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_GENERIC_SQRT_H diff --git a/libc/src/__support/FPUtil/generic/sqrt_80_bit_long_double.h b/libc/src/__support/FPUtil/generic/sqrt_80_bit_long_double.h index 2b03273f29c4080eaa7a27f48255355e543290d2..685a90dba7c704b33e65f0afbf96d02aef788bb2 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 7990ec01c7e8a319fc2b6e0342f5e5f14809d82e..86bc86031496112362231b78a549ed9853573b71 100644 --- a/libc/src/__support/FPUtil/gpu/FMA.h +++ b/libc/src/__support/FPUtil/gpu/FMA.h @@ -17,7 +17,7 @@ static_assert(LIBC_HAS_BUILTIN(__builtin_fma), "FMA builtins must be defined"); static_assert(LIBC_HAS_BUILTIN(__builtin_fmaf), "FMA builtins must be defined"); -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template @@ -31,6 +31,6 @@ LIBC_INLINE cpp::enable_if_t, T> fma(T x, T y, T z) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_GPU_FMA_H diff --git a/libc/src/__support/FPUtil/multiply_add.h b/libc/src/__support/FPUtil/multiply_add.h index 6670a15eb3357a2cf31157a24a03b880161dfb71..82932da5417c8d9f5e01d7d898c9b472d3b7abdc 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 9ccaf55f25312fa5b4878149e3731a554fcc2945..bc98667c8a3b3a56978287e88f74e0f0d91f19ce 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 05b62dd9580c726f0bd4847adeb6077e32923ad2..4b2d0ea9e6990cd323de2c55f9aa5ea6b72f6bef 100644 --- a/libc/src/__support/FPUtil/riscv32/FEnvImpl.h +++ b/libc/src/__support/FPUtil/riscv32/FEnvImpl.h @@ -16,7 +16,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { struct FEnv { @@ -175,6 +175,6 @@ LIBC_INLINE int set_env(const fenv_t *envp) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_RISCV32_FENVIMPL_H diff --git a/libc/src/__support/FPUtil/riscv64/FEnvImpl.h b/libc/src/__support/FPUtil/riscv64/FEnvImpl.h index 2e3c3c76a8d9cf903e1bb39230b4798bd3443d80..db244fc0906c52d27cad6ea12d330de0a3d7731f 100644 --- a/libc/src/__support/FPUtil/riscv64/FEnvImpl.h +++ b/libc/src/__support/FPUtil/riscv64/FEnvImpl.h @@ -16,7 +16,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { struct FEnv { @@ -175,6 +175,6 @@ LIBC_INLINE int set_env(const fenv_t *envp) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_RISCV64_FENVIMPL_H diff --git a/libc/src/__support/FPUtil/riscv64/FMA.h b/libc/src/__support/FPUtil/riscv64/FMA.h index 88623a6e86019854dba1e5626e5b4ec38ceb40e7..770a2342c441e7dcd7a3dd5d6832482ed4d51c8a 100644 --- a/libc/src/__support/FPUtil/riscv64/FMA.h +++ b/libc/src/__support/FPUtil/riscv64/FMA.h @@ -23,7 +23,7 @@ #include "src/__support/CPP/type_traits.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template @@ -45,6 +45,6 @@ LIBC_INLINE cpp::enable_if_t, T> fma(T x, T y, T z) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_RISCV64_FMA_H diff --git a/libc/src/__support/FPUtil/riscv64/sqrt.h b/libc/src/__support/FPUtil/riscv64/sqrt.h index 12c9acdc1669c4bce566692ec80cdf2608817368..b34a099486bfc29a1b10a105ca439755ebeedd22 100644 --- a/libc/src/__support/FPUtil/riscv64/sqrt.h +++ b/libc/src/__support/FPUtil/riscv64/sqrt.h @@ -18,7 +18,7 @@ #include "src/__support/FPUtil/generic/sqrt.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template <> LIBC_INLINE float sqrt(float x) { @@ -34,6 +34,6 @@ template <> LIBC_INLINE double sqrt(double x) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_RISCV64_SQRT_H diff --git a/libc/src/__support/FPUtil/rounding_mode.h b/libc/src/__support/FPUtil/rounding_mode.h index a11b6b427506009357cfa7918cedb2c4ea888f6e..91a5b9c50e7c2bc778ca3a307294a3fdaf49d7b7 100644 --- a/libc/src/__support/FPUtil/rounding_mode.h +++ b/libc/src/__support/FPUtil/rounding_mode.h @@ -13,7 +13,7 @@ #include -namespace __llvm_libc::fputil { +namespace LIBC_NAMESPACE::fputil { // Quick free-standing test whether fegetround() == FE_UPWARD. // Using the following observation: @@ -74,6 +74,6 @@ LIBC_INLINE int quick_get_round() { return (2.0f + y == 2.0f) ? FE_TONEAREST : FE_UPWARD; } -} // namespace __llvm_libc::fputil +} // namespace LIBC_NAMESPACE::fputil #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_ROUNDING_MODE_H diff --git a/libc/src/__support/FPUtil/triple_double.h b/libc/src/__support/FPUtil/triple_double.h index 1f85382cc928d8c0aaec1be8984fad95cb5be1f6..eafa777878651801f4a4bf0958df21001db50fef 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 4380efab778c4da795ad557fb94791ba136d1397..b73b70e907790fff599ec3a337f56f5da438963f 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 b54613a67f4389da4c23a6389168ddcdf4677f2c..91ef7f96ff4d3e2fc589ce6357faaafdb1413510 100644 --- a/libc/src/__support/FPUtil/x86_64/FMA.h +++ b/libc/src/__support/FPUtil/x86_64/FMA.h @@ -24,7 +24,7 @@ #include "src/__support/CPP/type_traits.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template @@ -50,6 +50,6 @@ LIBC_INLINE cpp::enable_if_t, T> fma(T x, T y, T z) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_X86_64_FMA_H diff --git a/libc/src/__support/FPUtil/x86_64/LongDoubleBits.h b/libc/src/__support/FPUtil/x86_64/LongDoubleBits.h index 43273ee8864aa0200a0f0dd150279a49ce493115..085c19638122b555067c5776de6854098001ebc4 100644 --- a/libc/src/__support/FPUtil/x86_64/LongDoubleBits.h +++ b/libc/src/__support/FPUtil/x86_64/LongDoubleBits.h @@ -22,7 +22,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template struct Padding; @@ -233,6 +233,6 @@ static_assert( "Internal long double representation does not match the machine format."); } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_X86_64_LONGDOUBLEBITS_H diff --git a/libc/src/__support/FPUtil/x86_64/NextAfterLongDouble.h b/libc/src/__support/FPUtil/x86_64/NextAfterLongDouble.h index 98e90e044509d3acf7ea6b799a736302e3d6edd2..52ef2568c1dce06331ee7d6fb941cf6b942107f6 100644 --- a/libc/src/__support/FPUtil/x86_64/NextAfterLongDouble.h +++ b/libc/src/__support/FPUtil/x86_64/NextAfterLongDouble.h @@ -20,7 +20,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { LIBC_INLINE long double nextafter(long double from, long double to) { @@ -117,6 +117,6 @@ LIBC_INLINE long double nextafter(long double from, long double to) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_X86_64_NEXTAFTERLONGDOUBLE_H diff --git a/libc/src/__support/FPUtil/x86_64/PolyEval.h b/libc/src/__support/FPUtil/x86_64/PolyEval.h index 81cf965feedf66eeb555955219f7fdf218665614..69fd776320799c7f9ad96b7ee5a22c5d7eaa2325 100644 --- a/libc/src/__support/FPUtil/x86_64/PolyEval.h +++ b/libc/src/__support/FPUtil/x86_64/PolyEval.h @@ -18,7 +18,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { // Cubic polynomials: @@ -80,6 +80,6 @@ LIBC_INLINE double polyeval(double x, double a0, double a1, double a2, } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_X86_64_POLYEVAL_H diff --git a/libc/src/__support/FPUtil/x86_64/nearest_integer.h b/libc/src/__support/FPUtil/x86_64/nearest_integer.h index a62035433362900d86a35b45edc61330df828287..ee31aeefd8489a5f1fb1a7d177a4a178563ed1b5 100644 --- a/libc/src/__support/FPUtil/x86_64/nearest_integer.h +++ b/libc/src/__support/FPUtil/x86_64/nearest_integer.h @@ -22,7 +22,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { LIBC_INLINE float nearest_integer(float x) { @@ -40,6 +40,6 @@ LIBC_INLINE double nearest_integer(double x) { } } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_X86_64_NEAREST_INTEGER_H diff --git a/libc/src/__support/FPUtil/x86_64/sqrt.h b/libc/src/__support/FPUtil/x86_64/sqrt.h index 324f5907f9aca974f9709633ee23a3a6ccbb25a2..7edba5528d6a91eccaeee7a3d4858dcf0a1448c0 100644 --- a/libc/src/__support/FPUtil/x86_64/sqrt.h +++ b/libc/src/__support/FPUtil/x86_64/sqrt.h @@ -18,7 +18,7 @@ #include "src/__support/FPUtil/generic/sqrt.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { template <> LIBC_INLINE float sqrt(float x) { @@ -47,6 +47,6 @@ template <> LIBC_INLINE long double sqrt(long double x) { #endif } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_X86_64_SQRT_H diff --git a/libc/src/__support/File/dir.cpp b/libc/src/__support/File/dir.cpp index 93b609dc7b755f036c45fc688312105ec064b70b..9ff639a777e2347dea6a16d6a66aa7829f7e33b6 100644 --- a/libc/src/__support/File/dir.cpp +++ b/libc/src/__support/File/dir.cpp @@ -12,17 +12,17 @@ #include "src/__support/error_or.h" #include "src/errno/libc_errno.h" // For error macros -namespace __llvm_libc { +namespace LIBC_NAMESPACE { ErrorOr Dir::open(const char *path) { auto fd = platform_opendir(path); if (!fd) - return __llvm_libc::Error(fd.error()); + return LIBC_NAMESPACE::Error(fd.error()); - __llvm_libc::AllocChecker ac; + LIBC_NAMESPACE::AllocChecker ac; Dir *dir = new (ac) Dir(fd.value()); if (!ac) - return __llvm_libc::Error(ENOMEM); + return LIBC_NAMESPACE::Error(ENOMEM); return dir; } @@ -31,7 +31,7 @@ ErrorOr Dir::read() { if (readptr >= fillsize) { auto readsize = platform_fetch_dirents(fd, buffer); if (!readsize) - return __llvm_libc::Error(readsize.error()); + return LIBC_NAMESPACE::Error(readsize.error()); fillsize = readsize.value(); readptr = 0; } @@ -60,4 +60,4 @@ int Dir::close() { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/__support/File/dir.h b/libc/src/__support/File/dir.h index baf57cb52c68c5c7ead8dbc6bb795aeefb9dee75..a2f50f88e0e8befa0bf1ad0c585c6a0147b3d4f9 100644 --- a/libc/src/__support/File/dir.h +++ b/libc/src/__support/File/dir.h @@ -16,7 +16,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Platform specific function which will open the directory |name| // and return its file descriptor. Upon failure, the error value is returned. @@ -72,6 +72,6 @@ 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 f106d51f897ac40dfa49943a393bec6267850cc2..58097d017a23f3b049a2f786ffbb2c4bcbaa0b29 100644 --- a/libc/src/__support/File/file.cpp +++ b/libc/src/__support/File/file.cpp @@ -15,7 +15,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { FileIOResult File::write_unlocked(const void *data, size_t len) { if (!write_allowed()) { @@ -433,4 +433,4 @@ File::ModeFlags File::mode_flags(const char *mode) { return flags; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/__support/File/file.h b/libc/src/__support/File/file.h index 9e65e2a8ecf630967c7226246a24dba1e0fb189a..2ea3843749ffe431e619122ec88eaeea69de089c 100644 --- a/libc/src/__support/File/file.h +++ b/libc/src/__support/File/file.h @@ -17,7 +17,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { struct FileIOResult { size_t value; @@ -311,6 +311,6 @@ extern File *stdin; extern File *stdout; extern File *stderr; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FILE_FILE_H diff --git a/libc/src/__support/File/linux/dir.cpp b/libc/src/__support/File/linux/dir.cpp index b4871031c4d21b3849ccdd5a33c633af0fce0f30..cae545a9fb8e93ed88337040527b54f64fe2e0b2 100644 --- a/libc/src/__support/File/linux/dir.cpp +++ b/libc/src/__support/File/linux/dir.cpp @@ -14,46 +14,46 @@ #include // For open flags #include // For syscall numbers -namespace __llvm_libc { +namespace LIBC_NAMESPACE { ErrorOr platform_opendir(const char *name) { int open_flags = O_RDONLY | O_DIRECTORY | O_CLOEXEC; #ifdef SYS_open - int fd = __llvm_libc::syscall_impl(SYS_open, name, open_flags); + int fd = LIBC_NAMESPACE::syscall_impl(SYS_open, name, open_flags); #elif defined(SYS_openat) int fd = - __llvm_libc::syscall_impl(SYS_openat, AT_FDCWD, name, open_flags); + LIBC_NAMESPACE::syscall_impl(SYS_openat, AT_FDCWD, name, open_flags); #else #error \ "SYS_open and SYS_openat syscalls not available to perform an open operation." #endif if (fd < 0) { - return __llvm_libc::Error(-fd); + return LIBC_NAMESPACE::Error(-fd); } return fd; } ErrorOr platform_fetch_dirents(int fd, cpp::span buffer) { #ifdef SYS_getdents64 - long size = __llvm_libc::syscall_impl(SYS_getdents64, fd, buffer.data(), - buffer.size()); + long size = LIBC_NAMESPACE::syscall_impl(SYS_getdents64, fd, + buffer.data(), buffer.size()); #else #error "getdents64 syscalls not available to perform a fetch dirents operation." #endif if (size < 0) { - return __llvm_libc::Error(static_cast(-size)); + return LIBC_NAMESPACE::Error(static_cast(-size)); } return size; } int platform_closedir(int fd) { - int ret = __llvm_libc::syscall_impl(SYS_close, fd); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_close, fd); if (ret < 0) { return static_cast(-ret); } return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/__support/File/linux/file.cpp b/libc/src/__support/File/linux/file.cpp index 2d4481bc4b56370c1cb4406828e824108fe31efe..2d4cea5b53c5815c8ff9a3f5a1387a27c8b17c2a 100644 --- a/libc/src/__support/File/linux/file.cpp +++ b/libc/src/__support/File/linux/file.cpp @@ -19,11 +19,12 @@ #include #include // For syscall numbers -namespace __llvm_libc { +namespace LIBC_NAMESPACE { FileIOResult linux_file_write(File *f, const void *data, size_t size) { auto *lf = reinterpret_cast(f); - int ret = __llvm_libc::syscall_impl(SYS_write, lf->get_fd(), data, size); + int ret = + LIBC_NAMESPACE::syscall_impl(SYS_write, lf->get_fd(), data, size); if (ret < 0) { return {0, -ret}; } @@ -32,7 +33,8 @@ FileIOResult linux_file_write(File *f, const void *data, size_t size) { FileIOResult linux_file_read(File *f, void *buf, size_t size) { auto *lf = reinterpret_cast(f); - int ret = __llvm_libc::syscall_impl(SYS_read, lf->get_fd(), buf, size); + int ret = + LIBC_NAMESPACE::syscall_impl(SYS_read, lf->get_fd(), buf, size); if (ret < 0) { return {0, -ret}; } @@ -49,7 +51,7 @@ ErrorOr linux_file_seek(File *f, long offset, int whence) { int linux_file_close(File *f) { auto *lf = reinterpret_cast(f); - int ret = __llvm_libc::syscall_impl(SYS_close, lf->get_fd()); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_close, lf->get_fd()); if (ret < 0) { return -ret; } @@ -90,10 +92,10 @@ ErrorOr openfile(const char *path, const char *mode) { #ifdef SYS_open int fd = - __llvm_libc::syscall_impl(SYS_open, path, open_flags, OPEN_MODE); + LIBC_NAMESPACE::syscall_impl(SYS_open, path, open_flags, OPEN_MODE); #elif defined(SYS_openat) - int fd = __llvm_libc::syscall_impl(SYS_openat, AT_FDCWD, path, - open_flags, OPEN_MODE); + int fd = LIBC_NAMESPACE::syscall_impl(SYS_openat, AT_FDCWD, path, + open_flags, OPEN_MODE); #else #error "open and openat syscalls not available." #endif @@ -121,4 +123,4 @@ int get_fileno(File *f) { return lf->get_fd(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/__support/File/linux/file.h b/libc/src/__support/File/linux/file.h index 85a941b5d71e2637fcad90b301358204b1056270..24e71b133c4813068f5eec93d413523f84910b2f 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 859faf479e4865ab74a58e245686ebd7b507b274..d1632b703d3bc30e757483ce1f60b3115fa21c52 100644 --- a/libc/src/__support/File/linux/lseekImpl.h +++ b/libc/src/__support/File/linux/lseekImpl.h @@ -18,13 +18,13 @@ #include // For syscall numbers. #include // For off_t. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { LIBC_INLINE ErrorOr lseekimpl(int fd, off_t offset, int whence) { off_t result; #ifdef SYS_lseek - int ret = __llvm_libc::syscall_impl(SYS_lseek, fd, offset, whence); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_lseek, fd, offset, whence); result = ret; #elif defined(SYS_llseek) || defined(SYS__llseek) static_assert(sizeof(size_t) == 4, "size_t must be 32 bits."); @@ -34,7 +34,7 @@ LIBC_INLINE ErrorOr lseekimpl(int fd, off_t offset, int whence) { constexpr long LLSEEK_SYSCALL_NO = SYS__llseek; #endif off_t offset_64 = offset; - int ret = __llvm_libc::syscall_impl( + int ret = LIBC_NAMESPACE::syscall_impl( LLSEEK_SYSCALL_NO, fd, offset_64 >> 32, offset_64, &result, whence); #else #error "lseek, llseek and _llseek syscalls not available." @@ -45,6 +45,6 @@ LIBC_INLINE ErrorOr lseekimpl(int fd, off_t offset, int whence) { } } // namespace internal -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FILE_LINUX_LSEEKIMPL_H diff --git a/libc/src/__support/File/linux/stderr.cpp b/libc/src/__support/File/linux/stderr.cpp index a2ab37a51bd29279efba414da264ab6f7b4e5bbe..65d7865720ffe1669ce1f0d053ca6a18064e9ac4 100644 --- a/libc/src/__support/File/linux/stderr.cpp +++ b/libc/src/__support/File/linux/stderr.cpp @@ -9,15 +9,15 @@ #include "file.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { constexpr size_t STDERR_BUFFER_SIZE = 0; static LinuxFile StdErr(2, nullptr, STDERR_BUFFER_SIZE, _IONBF, false, File::ModeFlags(File::OpenMode::APPEND)); File *stderr = &StdErr; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE extern "C" { -FILE *stderr = reinterpret_cast(&__llvm_libc::StdErr); +FILE *stderr = reinterpret_cast(&LIBC_NAMESPACE::StdErr); } diff --git a/libc/src/__support/File/linux/stdin.cpp b/libc/src/__support/File/linux/stdin.cpp index e40081cd2a1ed55dca1387f85360b677915e408c..c9a363bb7c65ae48aa5341d14fca5c7f123875a5 100644 --- a/libc/src/__support/File/linux/stdin.cpp +++ b/libc/src/__support/File/linux/stdin.cpp @@ -9,7 +9,7 @@ #include "file.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { constexpr size_t STDIN_BUFFER_SIZE = 512; uint8_t stdin_buffer[STDIN_BUFFER_SIZE]; @@ -17,8 +17,8 @@ static LinuxFile StdIn(0, stdin_buffer, STDIN_BUFFER_SIZE, _IOFBF, false, File::ModeFlags(File::OpenMode::READ)); File *stdin = &StdIn; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE extern "C" { -FILE *stdin = reinterpret_cast(&__llvm_libc::StdIn); +FILE *stdin = reinterpret_cast(&LIBC_NAMESPACE::StdIn); } // extern "C" diff --git a/libc/src/__support/File/linux/stdout.cpp b/libc/src/__support/File/linux/stdout.cpp index cfb6aa4105baafa223cb37b7977193d95af9a827..314692ecbfe1e4cb4be972dd014011b315ea14b8 100644 --- a/libc/src/__support/File/linux/stdout.cpp +++ b/libc/src/__support/File/linux/stdout.cpp @@ -9,7 +9,7 @@ #include "file.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { constexpr size_t STDOUT_BUFFER_SIZE = 1024; uint8_t stdout_buffer[STDOUT_BUFFER_SIZE]; @@ -17,8 +17,8 @@ static LinuxFile StdOut(1, stdout_buffer, STDOUT_BUFFER_SIZE, _IOLBF, false, File::ModeFlags(File::OpenMode::APPEND)); File *stdout = &StdOut; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE extern "C" { -FILE *stdout = reinterpret_cast(&__llvm_libc::StdOut); +FILE *stdout = reinterpret_cast(&LIBC_NAMESPACE::StdOut); } // extern "C" diff --git a/libc/src/__support/GPU/amdgpu/utils.h b/libc/src/__support/GPU/amdgpu/utils.h index f64ed796dc1779618516370ad048e78fbc84df0b..9f0ff0c717a6c9befbbc975f827114f5f7e25bbc 100644 --- a/libc/src/__support/GPU/amdgpu/utils.h +++ b/libc/src/__support/GPU/amdgpu/utils.h @@ -14,7 +14,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace gpu { /// The number of threads that execute in lock-step in a lane. @@ -180,6 +180,6 @@ LIBC_INLINE uint64_t fixed_frequency_clock() { [[noreturn]] LIBC_INLINE void end_program() { __builtin_amdgcn_endpgm(); } } // namespace gpu -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif diff --git a/libc/src/__support/GPU/generic/utils.h b/libc/src/__support/GPU/generic/utils.h index af347580cca99f69d89957a6601ddf3eac5ab483..b701db482bbe98d3e2d0bb3b634d6983baada504 100644 --- a/libc/src/__support/GPU/generic/utils.h +++ b/libc/src/__support/GPU/generic/utils.h @@ -13,7 +13,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace gpu { constexpr const uint64_t LANE_SIZE = 1; @@ -76,6 +76,6 @@ LIBC_INLINE uint64_t fixed_frequency_clock() { return 0; } [[noreturn]] LIBC_INLINE void end_program() { __builtin_unreachable(); } } // namespace gpu -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif diff --git a/libc/src/__support/GPU/nvptx/utils.h b/libc/src/__support/GPU/nvptx/utils.h index 375af6ef10acc9f1ac3b82961fea36c0126a5ddf..1519f36850a63c574e54de88cd5f11e544a3c30f 100644 --- a/libc/src/__support/GPU/nvptx/utils.h +++ b/libc/src/__support/GPU/nvptx/utils.h @@ -13,7 +13,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace gpu { /// The number of threads that execute in lock-step in a warp. @@ -160,6 +160,6 @@ LIBC_INLINE uint64_t fixed_frequency_clock() { } } // namespace gpu -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif diff --git a/libc/src/__support/GPU/utils.h b/libc/src/__support/GPU/utils.h index d598996e0aa25124aef07ce4d7214ce84f21c978..6505b18dbd331e378506024fff20ce0f9c654c05 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 807ede0e6f98256cd7473676e131842d61ff1429..ce10c2a7a3079376b7f2a562e3f60c75f643697e 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 d29c539048a40e6d0b910982bb4328e06c6c375f..9bbc8e1ded0000282f106b4974885812104f6094 100644 --- a/libc/src/__support/OSUtil/darwin/io.h +++ b/libc/src/__support/OSUtil/darwin/io.h @@ -12,13 +12,13 @@ #include "src/__support/CPP/string_view.h" #include "syscall.h" // For internal syscall function. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE void write_to_stderr(cpp::string_view msg) { - __llvm_libc::syscall_impl(4 /*SYS_write*/, 2 /* stderr */, - reinterpret_cast(msg.data()), msg.size()); + LIBC_NAMESPACE::syscall_impl(4 /*SYS_write*/, 2 /* stderr */, + reinterpret_cast(msg.data()), msg.size()); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_DARWIN_IO_H diff --git a/libc/src/__support/OSUtil/darwin/quick_exit.h b/libc/src/__support/OSUtil/darwin/quick_exit.h index 51b82d945372c71757560f2dafdafcf0cd1e38c2..71647f50def5e2988a2fbd42af4257bfb7956202 100644 --- a/libc/src/__support/OSUtil/darwin/quick_exit.h +++ b/libc/src/__support/OSUtil/darwin/quick_exit.h @@ -13,14 +13,14 @@ #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE void quick_exit(int status) { for (;;) { - __llvm_libc::syscall_impl(1 /* SYS_exit */, status); + LIBC_NAMESPACE::syscall_impl(1 /* SYS_exit */, status); } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_DARWIN_QUICK_EXIT_H diff --git a/libc/src/__support/OSUtil/darwin/syscall.h b/libc/src/__support/OSUtil/darwin/syscall.h index b051745a1e3719b18eb0f0c1f322a17a22c3cbfe..93b492e14ddfce3f8aaa04d3d2f87302eed5cdeb 100644 --- a/libc/src/__support/OSUtil/darwin/syscall.h +++ b/libc/src/__support/OSUtil/darwin/syscall.h @@ -19,7 +19,7 @@ #error "Unsupported architecture" #endif -namespace __llvm_libc { +namespace LIBC_NAMESPACE { template LIBC_INLINE R syscall_impl(long __number, Ts... ts) { @@ -27,6 +27,6 @@ LIBC_INLINE R syscall_impl(long __number, Ts... ts) { return cpp::bit_or_static_cast(syscall_impl(__number, (long)ts...)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_DARWIN_SYSCALL_H diff --git a/libc/src/__support/OSUtil/fuchsia/io.h b/libc/src/__support/OSUtil/fuchsia/io.h index fc794b8593162965c5557975220dada66f644f1f..9a5e00beaa316cab8f5a88e57379c8790dd6e9ec 100644 --- a/libc/src/__support/OSUtil/fuchsia/io.h +++ b/libc/src/__support/OSUtil/fuchsia/io.h @@ -17,12 +17,12 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE void write_to_stderr(cpp::string_view msg) { __sanitizer_log_write(msg.data(), msg.size()); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_FUCHSIA_IO_H diff --git a/libc/src/__support/OSUtil/gpu/io.cpp b/libc/src/__support/OSUtil/gpu/io.cpp index 09b54526ab95dfe9fbb447bbb304e7344ddb0b2a..fec4d9f7b35d27ed5ff348267ff8399bddcaabf4 100644 --- a/libc/src/__support/OSUtil/gpu/io.cpp +++ b/libc/src/__support/OSUtil/gpu/io.cpp @@ -11,7 +11,7 @@ #include "src/__support/CPP/string_view.h" #include "src/__support/RPC/rpc_client.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void write_to_stderr(cpp::string_view msg) { rpc::Client::Port port = rpc::client.open(); @@ -20,4 +20,4 @@ void write_to_stderr(cpp::string_view msg) { port.close(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/__support/OSUtil/gpu/io.h b/libc/src/__support/OSUtil/gpu/io.h index be5daaec55c6bb128516030bae2b79966778f7af..d6c89cf45e3a55fcad52d9309704bc7fca112f9a 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 a316e2731a01f0c1afd68633df2029e2f40b3651..1a03be0ace6728e06388423ad06540f6300eb920 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 c4d67e56f32bb2b544877f704e70247bc0b10b58..b51385defbc0dee2631f2df15828c50bc65b6f12 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 1d0ed9acedea02fa965fee314a6bbb0a8d7b7655..f6c9a741de3ac1285db094330cb6b94e4dc9c71b 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 351a1c05aae1901f7107cb0ee906517a547dc820..af100747832750c6ea7f9f8160b1eea7ba13a0ce 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 b20be45113786740c63246ee96efd53786bc2f4d..fd5d2e1b898b249897527a183f55717e0067c4dd 100644 --- a/libc/src/__support/OSUtil/linux/io.h +++ b/libc/src/__support/OSUtil/linux/io.h @@ -14,13 +14,13 @@ #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE void write_to_stderr(cpp::string_view msg) { - __llvm_libc::syscall_impl(SYS_write, 2 /* stderr */, msg.data(), - msg.size()); + LIBC_NAMESPACE::syscall_impl(SYS_write, 2 /* stderr */, msg.data(), + msg.size()); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_IO_H diff --git a/libc/src/__support/OSUtil/linux/quick_exit.h b/libc/src/__support/OSUtil/linux/quick_exit.h index 2e2d86d634d064d37cab6d9c5567236d027723c3..c461d5f8b8fcb6c912dad3b8d8d9331bf5582aa5 100644 --- a/libc/src/__support/OSUtil/linux/quick_exit.h +++ b/libc/src/__support/OSUtil/linux/quick_exit.h @@ -15,15 +15,15 @@ #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE void quick_exit(int status) { for (;;) { - __llvm_libc::syscall_impl(SYS_exit_group, status); - __llvm_libc::syscall_impl(SYS_exit, status); + LIBC_NAMESPACE::syscall_impl(SYS_exit_group, status); + LIBC_NAMESPACE::syscall_impl(SYS_exit, status); } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_QUICK_EXIT_H diff --git a/libc/src/__support/OSUtil/linux/riscv64/syscall.h b/libc/src/__support/OSUtil/linux/riscv64/syscall.h index e307bcb8f1dbd64d57cc56fd14d4dd06706d3952..53ee21d5cbdf103b793ccf3b10189bdf26ccf6fd 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 8a1fbb34189b8f7cb62785f14b200ea98fa6855e..6c9559bb12ee4ea53229c3e687a575d09d08791b 100644 --- a/libc/src/__support/OSUtil/linux/syscall.h +++ b/libc/src/__support/OSUtil/linux/syscall.h @@ -23,7 +23,7 @@ #include "riscv64/syscall.h" #endif -namespace __llvm_libc { +namespace LIBC_NAMESPACE { template LIBC_INLINE R syscall_impl(long __number, Ts... ts) { @@ -31,6 +31,6 @@ LIBC_INLINE R syscall_impl(long __number, Ts... ts) { return cpp::bit_or_static_cast(syscall_impl(__number, (long)ts...)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_SYSCALL_H diff --git a/libc/src/__support/OSUtil/linux/x86_64/syscall.h b/libc/src/__support/OSUtil/linux/x86_64/syscall.h index bf2d2cd7351dd0b89c70f82059cbb94a9de3dacf..986db9372ad394c67a5bc4a9aa140288ff8bc056 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 6ebc0c3951c55199cc614060376296e272be818a..189da8671461c81fe076064f26805bba42771e20 100644 --- a/libc/src/__support/RPC/rpc.h +++ b/libc/src/__support/RPC/rpc.h @@ -28,7 +28,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace rpc { /// A fixed size channel used to communicate between the RPC client and server. @@ -586,6 +586,6 @@ LIBC_INLINE typename Server::Port Server::open() { } } // namespace rpc -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif diff --git a/libc/src/__support/RPC/rpc_client.cpp b/libc/src/__support/RPC/rpc_client.cpp index b25ff56410d7f5b6fa633f8c735c8d573c477cd5..e223caf2a16a8e4bd1272eb375227a132863d8bc 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 3b36c4fffc9e84990a29356fd5cde78f0a7e2328..571d7cce2a803985f339ac6c398331c074a8886c 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 999fd902adf622e527f826eefc20d7a762a22a8d..46ca841c49199bca1fbe2170dd71e06652c5a79c 100644 --- a/libc/src/__support/RPC/rpc_util.h +++ b/libc/src/__support/RPC/rpc_util.h @@ -14,7 +14,7 @@ #include "src/__support/macros/attributes.h" // LIBC_INLINE #include "src/__support/macros/properties/architectures.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace rpc { /// Suspend the thread briefly to assist the thread scheduler during busy loops. @@ -65,6 +65,6 @@ template LIBC_INLINE T *advance(T *ptr, U bytes) { } } // namespace rpc -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif diff --git a/libc/src/__support/StringUtil/error_to_string.cpp b/libc/src/__support/StringUtil/error_to_string.cpp index 692f8845558270959262ec5fec12c96ce05d31fc..3ea60a6740b30a63ecd2ba35440e362433b44b0b 100644 --- a/libc/src/__support/StringUtil/error_to_string.cpp +++ b/libc/src/__support/StringUtil/error_to_string.cpp @@ -18,7 +18,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { constexpr size_t max_buff_size() { @@ -74,4 +74,4 @@ cpp::string_view get_error_string(int err_num, cpp::span buffer) { return internal::build_error_string(err_num, buffer); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/__support/StringUtil/error_to_string.h b/libc/src/__support/StringUtil/error_to_string.h index 7981aa9b9a96ec414ed5927aa67bae1fabbf4cf2..43cf785c30b036f600c2ea911b03af37382679a2 100644 --- a/libc/src/__support/StringUtil/error_to_string.h +++ b/libc/src/__support/StringUtil/error_to_string.h @@ -12,12 +12,12 @@ #include "src/__support/CPP/span.h" #include "src/__support/CPP/string_view.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { cpp::string_view get_error_string(int err_num); cpp::string_view get_error_string(int err_num, cpp::span buffer); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_STRINGUTIL_ERROR_TO_STRING_H diff --git a/libc/src/__support/StringUtil/message_mapper.h b/libc/src/__support/StringUtil/message_mapper.h index a190037462f1190f53063813d8c122d7bcabdf63..c93a57c6256784d294cee575a3767b2214e63dcb 100644 --- a/libc/src/__support/StringUtil/message_mapper.h +++ b/libc/src/__support/StringUtil/message_mapper.h @@ -14,7 +14,7 @@ #include "src/__support/CPP/string_view.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { struct MsgMapping { int num; @@ -98,6 +98,6 @@ constexpr MsgTable operator+(const MsgTable &t1, return res; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_STRING_UTIL_MESSAGE_MAPPER_H diff --git a/libc/src/__support/StringUtil/signal_to_string.cpp b/libc/src/__support/StringUtil/signal_to_string.cpp index 78b4d4dd853682d8e0a6480a71056fa0d956e996..1fea53a32aa21882d97c7dfdadbace8a2a3f93f9 100644 --- a/libc/src/__support/StringUtil/signal_to_string.cpp +++ b/libc/src/__support/StringUtil/signal_to_string.cpp @@ -19,7 +19,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { constexpr size_t max_buff_size() { @@ -77,4 +77,4 @@ cpp::string_view get_signal_string(int sig_num, cpp::span buffer) { return internal::build_signal_string(sig_num, buffer); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/__support/StringUtil/signal_to_string.h b/libc/src/__support/StringUtil/signal_to_string.h index 11ec33a0a07c642f11a4b23a8135293bb3b69133..e27324e970c06671eee545d9c0ca4ff1b9841537 100644 --- a/libc/src/__support/StringUtil/signal_to_string.h +++ b/libc/src/__support/StringUtil/signal_to_string.h @@ -13,12 +13,12 @@ #include "src/__support/CPP/span.h" #include "src/__support/CPP/string_view.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { cpp::string_view get_signal_string(int err_num); cpp::string_view get_signal_string(int err_num, cpp::span buffer); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_STRINGUTIL_SIGNAL_TO_STRING_H diff --git a/libc/src/__support/StringUtil/tables/linux_extension_errors.h b/libc/src/__support/StringUtil/tables/linux_extension_errors.h index 5440c8e37154014136cd212aa2e0c3030f2554ba..4964fa47efd531e86d2022a97ad2f41c69c5610e 100644 --- a/libc/src/__support/StringUtil/tables/linux_extension_errors.h +++ b/libc/src/__support/StringUtil/tables/linux_extension_errors.h @@ -13,7 +13,7 @@ #include // For error macros -namespace __llvm_libc { +namespace LIBC_NAMESPACE { constexpr MsgTable<52> LINUX_ERRORS = { MsgMapping(ENOTBLK, "Block device required"), @@ -70,6 +70,6 @@ constexpr MsgTable<52> LINUX_ERRORS = { MsgMapping(EHWPOISON, "Memory page has hardware error"), }; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_STRING_UTIL_TABLES_LINUX_EXTENSION_ERRORS_H diff --git a/libc/src/__support/StringUtil/tables/linux_extension_signals.h b/libc/src/__support/StringUtil/tables/linux_extension_signals.h index fd17881d4f780c9357bce500d43d20b30ccf5f0a..633d0e2ed53827e85c472391ca6fe2d310c90b02 100644 --- a/libc/src/__support/StringUtil/tables/linux_extension_signals.h +++ b/libc/src/__support/StringUtil/tables/linux_extension_signals.h @@ -13,7 +13,7 @@ #include // For signal numbers -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // The array being larger than necessary isn't a problem. The MsgMappings will // be set to their default state which maps 0 to an empty string. This will get @@ -28,6 +28,6 @@ LIBC_INLINE_VAR constexpr const MsgTable<3> LINUX_SIGNALS = { #endif }; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_STRING_UTIL_TABLES_LINUX_EXTENSION_SIGNALS_H diff --git a/libc/src/__support/StringUtil/tables/linux_platform_errors.h b/libc/src/__support/StringUtil/tables/linux_platform_errors.h index 3139a1f1c5b38aea7026e8eb10e6d82154d3f120..a9ae2e8100a1b3803894bed8d561fcad74589fb4 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 b08517426445ad9eed59dd71da6809d48c1ee962..1daaa9cc62852e7c9f1ecd8ea43981ed560989b3 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 fa164db91ceed066ae8ad4da9d98c76c28a075e2..1cfd9e2e944d46773061ba1989c43f741bb38f43 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 a6d59e5de45f1d608f3fd260b2e36f6efb2114ca..7fcf91bfee852573dbd61826b3d4abf8f1c89b57 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 59ed279c47810a25d474d96dc017e6d35dd56d01..3ade7aaab4f0def7750f9bfb2d4f54711a5339cf 100644 --- a/libc/src/__support/StringUtil/tables/posix_errors.h +++ b/libc/src/__support/StringUtil/tables/posix_errors.h @@ -13,7 +13,7 @@ #include // For error macros -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE_VAR constexpr MsgTable<76> POSIX_ERRORS = { MsgMapping(EPERM, "Operation not permitted"), @@ -94,6 +94,6 @@ LIBC_INLINE_VAR constexpr MsgTable<76> POSIX_ERRORS = { MsgMapping(ENOTRECOVERABLE, "State not recoverable"), }; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_STRING_UTIL_TABLES_POSIX_ERRORS_H diff --git a/libc/src/__support/StringUtil/tables/posix_signals.h b/libc/src/__support/StringUtil/tables/posix_signals.h index beaa18bff87f36841bba971b5d168eca7cf90efd..2fba2d963f4b9b474270c04790781f66000f3a93 100644 --- a/libc/src/__support/StringUtil/tables/posix_signals.h +++ b/libc/src/__support/StringUtil/tables/posix_signals.h @@ -14,7 +14,7 @@ #include // For signal numbers -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE_VAR constexpr MsgTable<22> POSIX_SIGNALS = { MsgMapping(SIGHUP, "Hangup"), @@ -41,6 +41,6 @@ LIBC_INLINE_VAR constexpr MsgTable<22> POSIX_SIGNALS = { MsgMapping(SIGSYS, "Bad system call"), }; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_STRING_UTIL_TABLES_POSIX_SIGNALS_H diff --git a/libc/src/__support/StringUtil/tables/signal_table.h b/libc/src/__support/StringUtil/tables/signal_table.h index 87b5abf5e097731040bcee1f61d83f23c70f3958..5035c54770c5c79f1fa0f0efcce51ef2a21f4adb 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 054c4ffdc7addea3dbac2bd3c38dee59f88677a7..f0fc78710b18a6b4bd310c4c1563b0192d7b3b07 100644 --- a/libc/src/__support/StringUtil/tables/stdc_errors.h +++ b/libc/src/__support/StringUtil/tables/stdc_errors.h @@ -13,7 +13,7 @@ #include // For error macros -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE_VAR constexpr const MsgTable<4> STDC_ERRORS = { MsgMapping(0, "Success"), @@ -22,6 +22,6 @@ LIBC_INLINE_VAR constexpr const MsgTable<4> STDC_ERRORS = { MsgMapping(EILSEQ, "Invalid or incomplete multibyte or wide character"), }; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_STRING_UTIL_TABLES_LINUX_ERRORS_H diff --git a/libc/src/__support/StringUtil/tables/stdc_signals.h b/libc/src/__support/StringUtil/tables/stdc_signals.h index 0bc288db3c449a7ca6180f01f2d18797abfb190e..773f182140ef9336a6c3631fcbe587080d859b2d 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 6310c8925c40d099db92882a62664193ebbb85c4..9aeb239b8328bea1f433f870a3c69723847a6fcc 100644 --- a/libc/src/__support/UInt.h +++ b/libc/src/__support/UInt.h @@ -21,7 +21,7 @@ #include // For size_t #include -namespace __llvm_libc::cpp { +namespace LIBC_NAMESPACE::cpp { template struct BigInt { @@ -927,6 +927,6 @@ struct make_signed> : type_identity> { "Number of bits in Int should be a multiple of 64."); }; -} // namespace __llvm_libc::cpp +} // namespace LIBC_NAMESPACE::cpp #endif // LLVM_LIBC_SRC___SUPPORT_UINT_H diff --git a/libc/src/__support/UInt128.h b/libc/src/__support/UInt128.h index 2df4e5263bc16370d9bb37b35710981f7fda31ea..2f688f1f31cb56fccb59266bd29a374dbb5abed1 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 e4154154924166e78f5c3265c43acc3c9359b3e4..9de17651142f4925be729a94459b85748ccf99b3 100644 --- a/libc/src/__support/arg_list.h +++ b/libc/src/__support/arg_list.h @@ -14,7 +14,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { class ArgList { @@ -61,6 +61,6 @@ 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 cdef80b1675b86e71911797fc21121d86a1c2477..d78e4be5fa9ca42f02bfcb661e0cf38d896ebd8b 100644 --- a/libc/src/__support/blockstore.h +++ b/libc/src/__support/blockstore.h @@ -15,7 +15,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace cpp { // The difference between BlockStore a traditional vector types is that, @@ -204,6 +204,6 @@ template using ReverseOrderBlockStore = BlockStore; } // namespace cpp -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_BLOCKSTORE_H diff --git a/libc/src/__support/builtin_wrappers.h b/libc/src/__support/builtin_wrappers.h index 1da9cee4ad9f19c6735ef215ffb94bdca5512f96..bd307a3544cd930271096a1a2b71c596c8d08433 100644 --- a/libc/src/__support/builtin_wrappers.h +++ b/libc/src/__support/builtin_wrappers.h @@ -15,7 +15,7 @@ #include "src/__support/macros/attributes.h" // LIBC_INLINE #include "src/__support/macros/config.h" // LIBC_HAS_BUILTIN -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // The following overloads are matched based on what is accepted by // __builtin_clz/ctz* rather than using the exactly-sized aliases from stdint.h. @@ -221,6 +221,6 @@ sub_with_borrow(unsigned long long a, unsigned long long b, #endif // LIBC_HAS_BUILTIN(__builtin_subc) -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_BUILTIN_WRAPPERS_H diff --git a/libc/src/__support/c_string.h b/libc/src/__support/c_string.h index 580a685849a6dc60e4202d1365e10ec75381cb3e..9049311a5778930b1d3102c656d6342cae1ad5fd 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 49609fd6a2b4a0f833ee2d7ba89f4865b5e7f67d..ed55c48cc94cc9bbc551c97f464c3e658f7e036f 100644 --- a/libc/src/__support/char_vector.h +++ b/libc/src/__support/char_vector.h @@ -14,7 +14,7 @@ #include #include // For allocation. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // This is very simple alternate of the std::string class. There is no // bounds check performed in any of the methods. The callers are expected to @@ -73,6 +73,6 @@ 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 2b253fd567c19dd2116bb1ef0f6ef6b21cf132f3..fe7b7c8b7624c906d1078a087c52516b9044bf57 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 61a5fe654319445bd1b6c820c33edbba016ee48e..5fa4777ffd65fc844d0e1a93513b7bbf7d0424a1 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 5335f0dba416437d7e748904fe262eb5d6815c81..f9628484bbe6095a4ec6b5ab9dbc52d30e75e808 100644 --- a/libc/src/__support/detailed_powers_of_ten.h +++ b/libc/src/__support/detailed_powers_of_ten.h @@ -13,7 +13,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { // TODO(michaelrj): write a script that will generate this table. @@ -733,6 +733,6 @@ static constexpr uint64_t DETAILED_POWERS_OF_TEN[696][2] = { }; } // namespace internal -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_DETAILED_POWERS_OF_TEN_H diff --git a/libc/src/__support/endian.h b/libc/src/__support/endian.h index 43ddbb6850666667e0d801a7201ac099a053d77a..cd083aad09c3ca96a4f55538c508b4b5d8c4ee87 100644 --- a/libc/src/__support/endian.h +++ b/libc/src/__support/endian.h @@ -13,7 +13,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // We rely on compiler preprocessor defines to allow for cross compilation. #if !defined(__BYTE_ORDER__) || !defined(__ORDER_LITTLE_ENDIAN__) || \ @@ -140,6 +140,6 @@ Endian<__ORDER_BIG_ENDIAN__>::to_little_endian(uint64_t v) { using Endian = internal::Endian<__BYTE_ORDER__>; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_ENDIAN_H diff --git a/libc/src/__support/error_or.h b/libc/src/__support/error_or.h index 33bb942d9d0d0f87d34cf8b0163e3cd083eb7dbe..34c652dd878c2874bf21c7a6f1bcd959beea1bbc 100644 --- a/libc/src/__support/error_or.h +++ b/libc/src/__support/error_or.h @@ -11,7 +11,7 @@ #include "src/__support/CPP/expected.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { template using ErrorOr = cpp::expected; @@ -34,6 +34,6 @@ using Error = cpp::unexpected; // constexpr operator T() { return value; } // }; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_ERROR_OR_H diff --git a/libc/src/__support/fixedvector.h b/libc/src/__support/fixedvector.h index 5dfda1e629623ec690d13be4a587a3e9dbf2b5a0..fff905d8c6c4181919c55d3ee563f111bbf220c3 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 *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 d430594060424bda4564b5fef398c43277ea0ad6..05189e993babbc921cd04bc1d9baf396fa6ab872 100644 --- a/libc/src/__support/float_to_string.h +++ b/libc/src/__support/float_to_string.h @@ -100,7 +100,7 @@ constexpr size_t MID_INT_SIZE = 192; // Any block that is all 9s adds one to the max block counter and doesn't clear // the buffer because they can cause the block above them to be rounded up. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { using BlockInt = uint32_t; constexpr size_t BLOCK_SIZE = 9; @@ -756,6 +756,6 @@ FloatToString::get_negative_block(int block_index) { #endif // LONG_DOUBLE_IS_DOUBLE -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_FLOAT_TO_STRING_H diff --git a/libc/src/__support/high_precision_decimal.h b/libc/src/__support/high_precision_decimal.h index 9ee7c1fb8653fbf4e1436e4d98fb7483b28063f6..bf33658982c362c58af7584a3c06158d5331b19b 100644 --- a/libc/src/__support/high_precision_decimal.h +++ b/libc/src/__support/high_precision_decimal.h @@ -13,7 +13,7 @@ #include "src/__support/str_to_integer.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { struct LShiftTableEntry { @@ -411,6 +411,6 @@ 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 396ebc7cbb9db13676eef8be558fff5c82ad344d..6253afed06b757aaddfaac1a461421b94718ad69 100644 --- a/libc/src/__support/integer_operations.h +++ b/libc/src/__support/integer_operations.h @@ -11,7 +11,7 @@ #include "src/__support/CPP/type_traits.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { template static constexpr cpp::enable_if_t, T> integer_abs(T n) { @@ -25,6 +25,6 @@ integer_rem_quo(T x, T y, T ", T &rem) { rem = x % y; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_INTEGER_OPERATIONS_H diff --git a/libc/src/__support/integer_to_string.h b/libc/src/__support/integer_to_string.h index 2c11d834a8f34e39bcc30c5dd14715a2bf845d5f..29f71246125944494bc44b02fb5d29688e5357ec 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 9a734da3e117b3dab386ecf8e058bbbf9529014e..7b62cb0d9f50593b47e5dde63aa2d3ec1f535841 100644 --- a/libc/src/__support/integer_utils.h +++ b/libc/src/__support/integer_utils.h @@ -17,7 +17,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { template NumberPair full_mul(T a, T b); @@ -60,6 +60,6 @@ LIBC_INLINE NumberPair full_mul(uint64_t a, uint64_t b) { #endif // __SIZEOF_INT128__ } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_INTEGER_UTILS_H diff --git a/libc/src/__support/libc_assert.h b/libc/src/__support/libc_assert.h index 4190cfe04a759e73fcd9618b16a9aad8f0943303..61f075435b552d1d3054ff49bb104588a07bb5ca 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 1d221ff6aff45a6bfa33c3d0687cac4b727608dd..ae97efcaa41706df69e23f1be2246ec91f140904 100644 --- a/libc/src/__support/macros/optimization.h +++ b/libc/src/__support/macros/optimization.h @@ -16,14 +16,15 @@ // We use a template to implement likely/unlikely to make sure that we don't // accidentally pass an integer. -namespace __llvm_libc::details { +namespace LIBC_NAMESPACE::details { template LIBC_INLINE constexpr bool expects_bool_condition(T value, T expected) { return __builtin_expect(value, expected); } -} // namespace __llvm_libc::details -#define LIBC_LIKELY(x) __llvm_libc::details::expects_bool_condition(x, true) -#define LIBC_UNLIKELY(x) __llvm_libc::details::expects_bool_condition(x, false) +} // namespace LIBC_NAMESPACE::details +#define LIBC_LIKELY(x) LIBC_NAMESPACE::details::expects_bool_condition(x, true) +#define LIBC_UNLIKELY(x) \ + LIBC_NAMESPACE::details::expects_bool_condition(x, false) #if defined(LIBC_COMPILER_IS_CLANG) #define LIBC_LOOP_NOUNROLL _Pragma("nounroll") diff --git a/libc/src/__support/number_pair.h b/libc/src/__support/number_pair.h index 3f23394ee4cc206075e3ae48a826ae6c660cffe3..5e553d817994b4b0b33d029f3db83810de03cd74 100644 --- a/libc/src/__support/number_pair.h +++ b/libc/src/__support/number_pair.h @@ -14,7 +14,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { DEFINE_NAMED_PAIR_TEMPLATE(NumberPair, lo, hi); @@ -29,6 +29,6 @@ split(T a) { return result; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_NUMBER_PAIR_H diff --git a/libc/src/__support/str_to_float.h b/libc/src/__support/str_to_float.h index 58bdee2c573b507ef9d721a7ec1dd7500bb04940..db50090ec4e129643f1f01c12d9c952506f6491a 100644 --- a/libc/src/__support/str_to_float.h +++ b/libc/src/__support/str_to_float.h @@ -25,7 +25,7 @@ #include "src/__support/str_to_num_result.h" #include "src/errno/libc_errno.h" // For ERANGE -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { template struct ExpandedFloat { @@ -1247,6 +1247,6 @@ LIBC_INLINE StrToNumResult strtofloatingpoint(const char *__restrict src) { } } // namespace internal -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_STR_TO_FLOAT_H diff --git a/libc/src/__support/str_to_integer.h b/libc/src/__support/str_to_integer.h index f9608928430a8c205d7f5f2d62cb6c2f9e271a4e..4ee336ec9e2bbd82a45ca8b1fa057cd99f6a9a99 100644 --- a/libc/src/__support/str_to_integer.h +++ b/libc/src/__support/str_to_integer.h @@ -17,7 +17,7 @@ #include "src/errno/libc_errno.h" // For ERANGE #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { // Returns a pointer to the first character in src that is not a whitespace @@ -150,6 +150,6 @@ LIBC_INLINE StrToNumResult strtointeger(const char *__restrict src, } } // namespace internal -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_STR_TO_INTEGER_H diff --git a/libc/src/__support/str_to_num_result.h b/libc/src/__support/str_to_num_result.h index ea96f950cfb99af72cb48060950c0f73b495e860..9ba704c690655ee62d85a8f462b14809187ec0a2 100644 --- a/libc/src/__support/str_to_num_result.h +++ b/libc/src/__support/str_to_num_result.h @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { template struct StrToNumResult { T value; @@ -28,6 +28,6 @@ template struct StrToNumResult { constexpr operator T() { return value; } }; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_STR_TO_NUM_RESULT_H diff --git a/libc/src/__support/threads/callonce.h b/libc/src/__support/threads/callonce.h index 12e5c82a89d4855759e976ef74481fe5ac2098b0..b3d6813f7dda9e3c997f1a61e5b537c961ffd342 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 7ac4c485b1f07a799b785087cac5fb33eb74244d..54fda676f281ed91a5ee282b73e0a06ae4e9cb86 100644 --- a/libc/src/__support/threads/fork_callbacks.cpp +++ b/libc/src/__support/threads/fork_callbacks.cpp @@ -12,7 +12,7 @@ #include // For size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace { @@ -87,4 +87,4 @@ void invoke_prepare_callbacks() { cb_manager.invoke_prepare(); } void invoke_parent_callbacks() { cb_manager.invoke_parent(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/__support/threads/fork_callbacks.h b/libc/src/__support/threads/fork_callbacks.h index 5e77c35f6b5a84025dfd91a76e399995c27ed1a0..57a4f8228c5fbd81263f56e5ecb8d307c812713c 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 5a5dc73e2515aa8fd86cb9b626c42e46c06be76f..7a23604b5b986a0e75c8aa1098f15c657d1983d0 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 1e43037d3fe2f36f84ba58c3e69c461da3827a47..de1e1008784f6046386536d50831c5ee38bf6bdc 100644 --- a/libc/src/__support/threads/linux/callonce.cpp +++ b/libc/src/__support/threads/linux/callonce.cpp @@ -16,7 +16,7 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { static constexpr FutexWordType NOT_CALLED = 0x0; static constexpr FutexWordType START = 0x11; @@ -34,10 +34,10 @@ int callonce(CallOnceFlag *flag, CallOnceCallback *func) { func(); auto status = futex_word->exchange(FINISH); if (status == WAITING) { - __llvm_libc::syscall_impl(FUTEX_SYSCALL_ID, &futex_word->val, - FUTEX_WAKE_PRIVATE, - INT_MAX, // Wake all waiters. - 0, 0, 0); + LIBC_NAMESPACE::syscall_impl(FUTEX_SYSCALL_ID, &futex_word->val, + FUTEX_WAKE_PRIVATE, + INT_MAX, // Wake all waiters. + 0, 0, 0); } return 0; } @@ -45,7 +45,7 @@ int callonce(CallOnceFlag *flag, CallOnceCallback *func) { FutexWordType status = START; if (futex_word->compare_exchange_strong(status, WAITING) || status == WAITING) { - __llvm_libc::syscall_impl( + LIBC_NAMESPACE::syscall_impl( FUTEX_SYSCALL_ID, &futex_word->val, FUTEX_WAIT_PRIVATE, WAITING, // Block only if status is still |WAITING|. 0, 0, 0); @@ -54,4 +54,4 @@ int callonce(CallOnceFlag *flag, CallOnceCallback *func) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/__support/threads/linux/futex_word.h b/libc/src/__support/threads/linux/futex_word.h index 4585aacf4623a5a7a5f849833875046b9a98e64a..67159b81b561323175321fa4d360adde9362941e 100644 --- a/libc/src/__support/threads/linux/futex_word.h +++ b/libc/src/__support/threads/linux/futex_word.h @@ -12,7 +12,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Futexes are 32 bits in size on all platforms, including 64-bit platforms. using FutexWordType = uint32_t; @@ -25,6 +25,6 @@ constexpr auto FUTEX_SYSCALL_ID = SYS_futex_time64; #error "futex and futex_time64 syscalls not available." #endif -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_THREADS_LINUX_FUTEX_WORD_H diff --git a/libc/src/__support/threads/linux/mutex.h b/libc/src/__support/threads/linux/mutex.h index 9b22fbab7c4c3c6da0691c506dc0fa5a3d1567aa..618698db0d25b3de4369d572dd0a06d1b95efba4 100644 --- a/libc/src/__support/threads/linux/mutex.h +++ b/libc/src/__support/threads/linux/mutex.h @@ -18,7 +18,7 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { struct Mutex { unsigned char timed; @@ -76,7 +76,7 @@ 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( + LIBC_NAMESPACE::syscall_impl( FUTEX_SYSCALL_ID, &futex_word.val, FUTEX_WAIT_PRIVATE, FutexWordType(LockState::Waiting), 0, 0, 0); was_waiting = true; @@ -91,7 +91,7 @@ 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( + LIBC_NAMESPACE::syscall_impl( FUTEX_SYSCALL_ID, &futex_word, FUTEX_WAIT_PRIVATE, FutexWordType(LockState::Waiting), 0, 0, 0); was_waiting = true; @@ -110,8 +110,8 @@ 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(FUTEX_SYSCALL_ID, &futex_word, - FUTEX_WAKE_PRIVATE, 1, 0, 0, 0); + LIBC_NAMESPACE::syscall_impl(FUTEX_SYSCALL_ID, &futex_word, + FUTEX_WAKE_PRIVATE, 1, 0, 0, 0); return MutexError::NONE; } @@ -131,6 +131,6 @@ 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 88efaece182a37966420c3322569bfe4b2892156..05fa0433ed864636568cf2be1fc70e8ec234dad5 100644 --- a/libc/src/__support/threads/linux/thread.cpp +++ b/libc/src/__support/threads/linux/thread.cpp @@ -30,7 +30,7 @@ #include // For PROT_* and MAP_* definitions. #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { #ifdef SYS_mmap2 static constexpr long MMAP_SYSCALL_NUMBER = SYS_mmap2; @@ -92,7 +92,7 @@ LIBC_INLINE ErrorOr alloc_stack(size_t stacksize, size_t guardsize) { // TODO: Maybe add MAP_STACK? Currently unimplemented on linux but helps // future-proof. - long mmap_result = __llvm_libc::syscall_impl( + long mmap_result = LIBC_NAMESPACE::syscall_impl( MMAP_SYSCALL_NUMBER, 0, // No special address size, prot, @@ -106,9 +106,9 @@ LIBC_INLINE ErrorOr alloc_stack(size_t stacksize, size_t guardsize) { if (guardsize) { // Give read/write permissions to actual stack. // TODO: We are assuming stack growsdown here. - long result = - __llvm_libc::syscall_impl(SYS_mprotect, mmap_result + guardsize, - stacksize, PROT_READ | PROT_WRITE); + long result = LIBC_NAMESPACE::syscall_impl( + SYS_mprotect, mmap_result + guardsize, stacksize, + PROT_READ | PROT_WRITE); if (result != 0) return Error{int(-result)}; @@ -125,7 +125,7 @@ free_stack(void *stack, size_t stacksize, size_t guardsize) { uintptr_t stackaddr = reinterpret_cast(stack); stackaddr -= guardsize; stack = reinterpret_cast(stackaddr); - __llvm_libc::syscall_impl(SYS_munmap, stack, stacksize + guardsize); + LIBC_NAMESPACE::syscall_impl(SYS_munmap, stack, stacksize + guardsize); } struct Thread; @@ -299,7 +299,7 @@ int Thread::run(ThreadStyle style, ThreadRunner runner, void *arg, void *stack, // variables from this function will not be availalbe to the child thread. #if defined(LIBC_TARGET_ARCH_IS_X86_64) long register clone_result asm(CLONE_RESULT_REGISTER); - clone_result = __llvm_libc::syscall_impl( + clone_result = LIBC_NAMESPACE::syscall_impl( SYS_clone, CLONE_SYSCALL_FLAGS, adjusted_stack, &attrib->tid, // The address where the child tid is written &clear_tid->val, // The futex where the child thread status is signalled @@ -308,7 +308,7 @@ int Thread::run(ThreadStyle style, ThreadRunner runner, void *arg, void *stack, #elif defined(LIBC_TARGET_ARCH_IS_AARCH64) || \ defined(LIBC_TARGET_ARCH_IS_RISCV64) long register clone_result asm(CLONE_RESULT_REGISTER); - clone_result = __llvm_libc::syscall_impl( + clone_result = LIBC_NAMESPACE::syscall_impl( SYS_clone, CLONE_SYSCALL_FLAGS, adjusted_stack, &attrib->tid, // The address where the child tid is written tls.tp, // The thread pointer value for the new thread. @@ -379,8 +379,8 @@ void Thread::wait() { while (clear_tid->load() != 0) { // We cannot do a FUTEX_WAIT_PRIVATE here as the kernel does a // FUTEX_WAKE and not a FUTEX_WAKE_PRIVATE. - __llvm_libc::syscall_impl(FUTEX_SYSCALL_ID, &clear_tid->val, - FUTEX_WAIT, CLEAR_TID_VALUE, nullptr); + LIBC_NAMESPACE::syscall_impl(FUTEX_SYSCALL_ID, &clear_tid->val, + FUTEX_WAIT, CLEAR_TID_VALUE, nullptr); } } @@ -409,7 +409,7 @@ int Thread::set_name(const cpp::string_view &name) { // If we are setting the name of the current thread, then we can // use the syscall to set the name. int retval = - __llvm_libc::syscall_impl(SYS_prctl, PR_SET_NAME, name.data()); + LIBC_NAMESPACE::syscall_impl(SYS_prctl, PR_SET_NAME, name.data()); if (retval < 0) return -retval; else @@ -420,17 +420,18 @@ int Thread::set_name(const cpp::string_view &name) { cpp::StringStream path_stream(path_name_buffer); construct_thread_name_file_path(path_stream, attrib->tid); #ifdef SYS_open - int fd = __llvm_libc::syscall_impl(SYS_open, path_name_buffer, O_RDWR); + int fd = + LIBC_NAMESPACE::syscall_impl(SYS_open, path_name_buffer, O_RDWR); #else - int fd = __llvm_libc::syscall_impl(SYS_openat, AT_FDCWD, - path_name_buffer, O_RDWR); + int fd = LIBC_NAMESPACE::syscall_impl(SYS_openat, AT_FDCWD, + path_name_buffer, O_RDWR); #endif if (fd < 0) return -fd; - int retval = - __llvm_libc::syscall_impl(SYS_write, fd, name.data(), name.size()); - __llvm_libc::syscall_impl(SYS_close, fd); + int retval = LIBC_NAMESPACE::syscall_impl(SYS_write, fd, name.data(), + name.size()); + LIBC_NAMESPACE::syscall_impl(SYS_close, fd); if (retval < 0) return -retval; @@ -450,7 +451,7 @@ int Thread::get_name(cpp::StringStream &name) const { // If we are getting the name of the current thread, then we can // use the syscall to get the name. int retval = - __llvm_libc::syscall_impl(SYS_prctl, PR_GET_NAME, name_buffer); + LIBC_NAMESPACE::syscall_impl(SYS_prctl, PR_GET_NAME, name_buffer); if (retval < 0) return -retval; name << name_buffer << cpp::StringStream::ENDS; @@ -461,17 +462,18 @@ int Thread::get_name(cpp::StringStream &name) const { cpp::StringStream path_stream(path_name_buffer); construct_thread_name_file_path(path_stream, attrib->tid); #ifdef SYS_open - int fd = __llvm_libc::syscall_impl(SYS_open, path_name_buffer, O_RDONLY); + int fd = + LIBC_NAMESPACE::syscall_impl(SYS_open, path_name_buffer, O_RDONLY); #else - int fd = __llvm_libc::syscall_impl(SYS_openat, AT_FDCWD, - path_name_buffer, O_RDONLY); + int fd = LIBC_NAMESPACE::syscall_impl(SYS_openat, AT_FDCWD, + path_name_buffer, O_RDONLY); #endif if (fd < 0) return -fd; - int retval = - __llvm_libc::syscall_impl(SYS_read, fd, name_buffer, NAME_SIZE_MAX); - __llvm_libc::syscall_impl(SYS_close, fd); + int retval = LIBC_NAMESPACE::syscall_impl(SYS_read, fd, name_buffer, + NAME_SIZE_MAX); + LIBC_NAMESPACE::syscall_impl(SYS_close, fd); if (retval < 0) return -retval; if (retval == NAME_SIZE_MAX) @@ -505,19 +507,19 @@ void thread_exit(ThreadReturnValue retval, ThreadStyle style) { // Set the CLEAR_TID address to nullptr to prevent the kernel // from signalling at a non-existent futex location. - __llvm_libc::syscall_impl(SYS_set_tid_address, 0); + LIBC_NAMESPACE::syscall_impl(SYS_set_tid_address, 0); // Return value for detached thread should be unused. We need to avoid // referencing `style` or `retval.*` because they may be stored on the stack // and we have deallocated our stack! - __llvm_libc::syscall_impl(SYS_exit, 0); + LIBC_NAMESPACE::syscall_impl(SYS_exit, 0); __builtin_unreachable(); } if (style == ThreadStyle::POSIX) - __llvm_libc::syscall_impl(SYS_exit, retval.posix_retval); + LIBC_NAMESPACE::syscall_impl(SYS_exit, retval.posix_retval); else - __llvm_libc::syscall_impl(SYS_exit, retval.stdc_retval); + LIBC_NAMESPACE::syscall_impl(SYS_exit, retval.stdc_retval); __builtin_unreachable(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/__support/threads/mutex.h b/libc/src/__support/threads/mutex.h index 7b27514c748b94b772bdabe75aded756e492cd96..fa2bd64b6b51cf4d3b2426740d0520765b142c94 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 ec275eb2b1c4e6dcdf5d299ae05158210924a7ae..ad8d0025eba698107347668a072a1a06daffa43d 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 bedaa7c6efaf1764f475b53baef69bbfc12e7840..62aa86b7aef7084418f972e8cf91a92dc69aafb2 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 6fbacef483d35d0bb35034000b08cd27a8ab6050..3fc3aef462a5b6fb50a873133b37772f2ce7c6c9 100644 --- a/libc/src/__support/threads/thread.h +++ b/libc/src/__support/threads/thread.h @@ -21,7 +21,7 @@ #include // For size_t #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { using ThreadRunnerPosix = void *(void *); using ThreadRunnerStdc = int(void *); @@ -247,6 +247,6 @@ void call_atexit_callbacks(ThreadAttributes *attrib); } // namespace internal -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_THREADS_THREAD_H diff --git a/libc/src/__support/wctype_utils.h b/libc/src/__support/wctype_utils.h index d8de9fd806087b2b60468b9cdded1c67875041c1..2c8eef8a5c0b70ce12f035c66bcc2fd36896a52a 100644 --- a/libc/src/__support/wctype_utils.h +++ b/libc/src/__support/wctype_utils.h @@ -16,7 +16,7 @@ #define __need_wchar_t #include // needed for wint_t and wchar_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { // ------------------------------------------------------ @@ -40,6 +40,6 @@ LIBC_INLINE cpp::optional btowc(int c) { } } // namespace internal -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC___SUPPORT_WCTYPE_UTILS_H diff --git a/libc/src/assert/__assert_fail.h b/libc/src/assert/__assert_fail.h index ba8db9d47ba350346ddc66764442b9cc8c28bbc9..6b9dee2a4bf66d4f12572192e18075a47b0180d1 100644 --- a/libc/src/assert/__assert_fail.h +++ b/libc/src/assert/__assert_fail.h @@ -11,11 +11,11 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { [[noreturn]] void __assert_fail(const char *assertion, const char *file, unsigned line, const char *function); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_ASSERT___ASSERT_FAIL_H diff --git a/libc/src/assert/assert.h b/libc/src/assert/assert.h index c1f325d8593bce6514bc9444a997e2147f9b1a81..0318a934acca490af0cbe67c21e0c25bfd6c6c1b 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 10de66fed53fbc7124d75ffce3ab99f0d629d555..4cf914bbe257f570c1b17e165a8be51579dda204 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 30c5f7fff602c1b27748d5964b79c933725b059f..b239088df69b01f16805763d386a329f108ed5b8 100644 --- a/libc/src/assert/gpu/__assert_fail.cpp +++ b/libc/src/assert/gpu/__assert_fail.cpp @@ -13,7 +13,7 @@ #include "src/__support/libc_assert.h" #include "src/stdlib/abort.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // A single-use lock to allow only a single thread to print the assertion. static cpp::Atomic lock = 0; @@ -32,8 +32,8 @@ LLVM_LIBC_FUNCTION(void, __assert_fail, // Only a single line should be printed if an assertion is hit. if (gpu::is_first_lane(mask)) - __llvm_libc::report_assertion_failure(assertion, file, line, function); - __llvm_libc::abort(); + LIBC_NAMESPACE::report_assertion_failure(assertion, file, line, function); + LIBC_NAMESPACE::abort(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isalnum.cpp b/libc/src/ctype/isalnum.cpp index ce3608fceae363434b8a70f5928b587fa01aa6be..42ed8ea475f109ff6b75fcead6c00f1b57b144a7 100644 --- a/libc/src/ctype/isalnum.cpp +++ b/libc/src/ctype/isalnum.cpp @@ -11,7 +11,7 @@ #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO: Currently restricted to default locale. // These should be extended using locale information. @@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(int, isalnum, (int c)) { return static_cast(internal::isalnum(static_cast(c))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isalnum.h b/libc/src/ctype/isalnum.h index beb202a7529dafeb3e5e1ee703f4beb654c2f656..71830c95cb2fffce911b2daa7b3d4cdd83849bd5 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 37f80f90cd2c841a6cb51662cad79b05cd566330..2b1bd0efc3b3abfcb61b4e2b7354e8e540ba28c3 100644 --- a/libc/src/ctype/isalpha.cpp +++ b/libc/src/ctype/isalpha.cpp @@ -11,7 +11,7 @@ #include "src/__support/common.h" #include "src/__support/ctype_utils.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO: Currently restricted to default locale. // These should be extended using locale information. @@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(int, isalpha, (int c)) { return static_cast(internal::isalpha(static_cast(c))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isalpha.h b/libc/src/ctype/isalpha.h index d5697a39e9aa561a75e8aca7f609103f16a141c9..b5b07eecd6798ec85022c5a71682ff68c7942dec 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 8357563c7f3cc688f29cc8fa24133e79fedbcc37..8be3d7e205afe31966cc67ba1ff26a3f62b24925 100644 --- a/libc/src/ctype/isascii.cpp +++ b/libc/src/ctype/isascii.cpp @@ -10,10 +10,10 @@ #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, isascii, (int c)) { return static_cast((c & (~0x7f)) == 0); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isascii.h b/libc/src/ctype/isascii.h index 7e31b3c6ca4dd150c744839242547d5aa6fb1f97..5a734a21bd1e5ff6979dbddb1da6a1bac57db6ac 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 438eff7f0a62d60a8167e71f852aad1638849b5f..9ac9d36580c7b20b70a95eb630408cac6248b2c1 100644 --- a/libc/src/ctype/isblank.cpp +++ b/libc/src/ctype/isblank.cpp @@ -10,7 +10,7 @@ #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO: Currently restricted to default locale. // These should be extended using locale information. @@ -18,4 +18,4 @@ LLVM_LIBC_FUNCTION(int, isblank, (int c)) { return static_cast(c == ' ' || c == '\t'); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isblank.h b/libc/src/ctype/isblank.h index 0554322d0825153602563bf483832b420e2439ef..4cacdb3d2a8d726cd7e0fef2aaf2a3b84ed192da 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 b203e4e35f4e23abd0e6aaa094d9ff03ad579c94..b52b86f1df2910aac43dd258a6459d3c7d89acad 100644 --- a/libc/src/ctype/iscntrl.cpp +++ b/libc/src/ctype/iscntrl.cpp @@ -10,7 +10,7 @@ #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO: Currently restricted to default locale. // These should be extended using locale information. @@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(int, iscntrl, (int c)) { return static_cast(ch < 0x20 || ch == 0x7f); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/iscntrl.h b/libc/src/ctype/iscntrl.h index 26f094053a28a0495433e85d07805adeda96fbf1..e0cae0caa6b8d5b9f08234faeb9cb44432c6d675 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 b478384916d1b5233b1e1d1861a4abbe419ba42a..d4d5d1f20f3fbd6159dff3ea31fe0a0fa161e904 100644 --- a/libc/src/ctype/isdigit.cpp +++ b/libc/src/ctype/isdigit.cpp @@ -10,7 +10,7 @@ #include "src/__support/common.h" #include "src/__support/ctype_utils.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO: Currently restricted to default locale. // These should be extended using locale information. @@ -18,4 +18,4 @@ LLVM_LIBC_FUNCTION(int, isdigit, (int c)) { return static_cast(internal::isdigit(static_cast(c))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isdigit.h b/libc/src/ctype/isdigit.h index 32a76235e0592ba0b54ae6cb0351700907e17a36..a024cf464b52ade3c5ce65287bce275f6bdbf185 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 6a1f55e85eea9c4abe13d92b8c9af56196e524df..e195f9fcbf48cf52f8ff1c020777ed95c208e5e1 100644 --- a/libc/src/ctype/isgraph.cpp +++ b/libc/src/ctype/isgraph.cpp @@ -11,7 +11,7 @@ #include "src/__support/common.h" #include "src/__support/ctype_utils.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO: Currently restricted to default locale. // These should be extended using locale information. @@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(int, isgraph, (int c)) { return static_cast(internal::isgraph(static_cast(c))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isgraph.h b/libc/src/ctype/isgraph.h index 421d0ffc4488b6ecb8c7da3fb770291edf00935c..486c32d10a11a319eb76fcb3522200c5dafcb7fe 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 b21ccd491ebcf9b4bcbd48a49ea7e3d8cdb5c92b..bd252e5e6efd17a0aa9e7779fdc6e7b58eeeabda 100644 --- a/libc/src/ctype/islower.cpp +++ b/libc/src/ctype/islower.cpp @@ -11,7 +11,7 @@ #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO: Currently restricted to default locale. // These should be extended using locale information. @@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(int, islower, (int c)) { return static_cast(internal::islower(static_cast(c))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/islower.h b/libc/src/ctype/islower.h index 7643542fb7a990c77212314359b0072754cbd53d..dc59ce9cea4380545b42b0bdebfe39c8c17ac7c7 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 dd9a085e17cbce4be32202d1d7437e1364663008..bdf9d083b621b4dca35eaedd3b11a703cbae6f3f 100644 --- a/libc/src/ctype/isprint.cpp +++ b/libc/src/ctype/isprint.cpp @@ -10,7 +10,7 @@ #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO: Currently restricted to default locale. // These should be extended using locale information. @@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(int, isprint, (int c)) { return static_cast((ch - ' ') < 95); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isprint.h b/libc/src/ctype/isprint.h index 17ed56ef253400ca43016a43cee1cf378e0a6ff5..22c835b7987c0e0e9ee0fde576c4d6b0e51d67bf 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 7ccad4b0ecdc0d311d7bdc4a146a87f579c5d48d..d355c19c426c69a2e7ec3fdf10e2a798e81024fa 100644 --- a/libc/src/ctype/ispunct.cpp +++ b/libc/src/ctype/ispunct.cpp @@ -11,7 +11,7 @@ #include "src/__support/common.h" #include "src/__support/ctype_utils.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO: Currently restricted to default locale. // These should be extended using locale information. @@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(int, ispunct, (int c)) { return static_cast(!internal::isalnum(ch) && internal::isgraph(ch)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/ispunct.h b/libc/src/ctype/ispunct.h index 23cc08a0bac9c898cfaaa5c163678f93ddc73ee2..7eaa83ac8ae5e91adb771db42ed6ed872f281750 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 8cd76c4ea6d2abd19fc4ffbe9b8e988b9eb62d5c..8c09eda00bc4333870b5e297db42416b393a1907 100644 --- a/libc/src/ctype/isspace.cpp +++ b/libc/src/ctype/isspace.cpp @@ -11,7 +11,7 @@ #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO: Currently restricted to default locale. // These should be extended using locale information. @@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(int, isspace, (int c)) { return static_cast(internal::isspace(static_cast(c))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isspace.h b/libc/src/ctype/isspace.h index d919e9e7d972bd1a8790896d9d0a36eb7f1fa18f..56b70579fad9430ef37b616a6a6d41f95febfab9 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 dcb4cf1b4db535def54efeadb3ed4511810981a6..b527e3ee53279bbe6830dabd61495411ed84781b 100644 --- a/libc/src/ctype/isupper.cpp +++ b/libc/src/ctype/isupper.cpp @@ -11,7 +11,7 @@ #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO: Currently restricted to default locale. // These should be extended using locale information. @@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(int, isupper, (int c)) { return static_cast(internal::isupper(static_cast(c))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isupper.h b/libc/src/ctype/isupper.h index 7a1f2270943a9416f87bfc6ba61f5d3151e3b669..8f5ce849f7961bd966a6bd0c09a67625fd1103bd 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 96efc8f1d9300781c08693b63aafdba3f5726975..79152c95986c3df5d7cc618356ea31fa3d6eac2a 100644 --- a/libc/src/ctype/isxdigit.cpp +++ b/libc/src/ctype/isxdigit.cpp @@ -11,7 +11,7 @@ #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO: Currently restricted to default locale. // These should be extended using locale information. @@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(int, isxdigit, (int c)) { return static_cast(internal::isdigit(ch) || (ch | 32) - 'a' < 6); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/ctype/isxdigit.h b/libc/src/ctype/isxdigit.h index a332ecc1018ff7033ee00a4192a76e757556c4fa..4966c320341e03ea31ee6c1b8037d70be9e0b32f 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 19a97ae91791f059fae3696b33fb1996c0d531f6..06bf91b1719068c6c0cce7ba2f04e1af0e3a492c 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 c3f48a38d84c91457f7cc75ef04127b5589113ca..246580e23d5f642e123501273298d0889a675eec 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 2c4b851a615e0f65661c563101625c3cd02af698..4e8b96dca078f084ed190c26eea66d4ab096fc85 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 97e675c5582520f70957ad85e53da6c777bc11b1..8213da9319af18474b0ac5f22136bb3ab5cc8766 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 b216cc277b8c2124a90851fe9518db9be8e6a833..7b0db35441035921ffe57a38b0ca7496cfd26d98 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 a21b0cf79d9557c8c0995a4ce4dc015a6582d070..b5d8890b2090dad53068f26a61242cbfcb6ddecd 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 2863106b4ce89eb4eb02be1395edfcd5d7988fb6..22c27c4c0f061159ba35e682a7e01ab56aff4aa1 100644 --- a/libc/src/dirent/closedir.cpp +++ b/libc/src/dirent/closedir.cpp @@ -14,10 +14,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, closedir, (::DIR * dir)) { - auto *d = reinterpret_cast<__llvm_libc::Dir *>(dir); + auto *d = reinterpret_cast(dir); int retval = d->close(); if (retval != 0) { libc_errno = retval; @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, closedir, (::DIR * dir)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/dirent/closedir.h b/libc/src/dirent/closedir.h index c5ee7ae59f1edd67249ae95ecc170bb17174a0cb..6d6b898cfe1a9889a8c6d9c7b2cb2cec39a1f9a4 100644 --- a/libc/src/dirent/closedir.h +++ b/libc/src/dirent/closedir.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int closedir(::DIR *dir); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_DIRENT_CLOSEDIR_H diff --git a/libc/src/dirent/dirfd.cpp b/libc/src/dirent/dirfd.cpp index 214c5c5852033da48ab1cac8f26e48cec874ca10..27995f6ef3c64d5e9ed4b176723006dafec10fec 100644 --- a/libc/src/dirent/dirfd.cpp +++ b/libc/src/dirent/dirfd.cpp @@ -13,11 +13,11 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, dirfd, (::DIR * dir)) { - auto *d = reinterpret_cast<__llvm_libc::Dir *>(dir); + auto *d = reinterpret_cast(dir); return d->getfd(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/dirent/dirfd.h b/libc/src/dirent/dirfd.h index 8590e3e159d364aac7945ac9a246e970de704036..34acb01dd61181b43afa210d359f348d34edc3bc 100644 --- a/libc/src/dirent/dirfd.h +++ b/libc/src/dirent/dirfd.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int dirfd(::DIR *dir); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_DIRENT_DIRFD_H diff --git a/libc/src/dirent/opendir.cpp b/libc/src/dirent/opendir.cpp index 06749e82c75f101a35c3878521a2c26730037020..56f7bc8b574f0f30a7333c81d342e9c88ef2af42 100644 --- a/libc/src/dirent/opendir.cpp +++ b/libc/src/dirent/opendir.cpp @@ -14,7 +14,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(::DIR *, opendir, (const char *name)) { auto dir = Dir::open(name); @@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(::DIR *, opendir, (const char *name)) { return reinterpret_cast(dir.value()); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/dirent/opendir.h b/libc/src/dirent/opendir.h index e183587999a9cf01a5eb396f80b5e503edbb81a6..635cb9083d068bdee3e2ffdf02df30b791bd474e 100644 --- a/libc/src/dirent/opendir.h +++ b/libc/src/dirent/opendir.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { ::DIR *opendir(const char *name); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_DIRENT_OPENDIR_H diff --git a/libc/src/dirent/readdir.cpp b/libc/src/dirent/readdir.cpp index a9f9491d47e5948bfa6f52ab079047bf61e6c32f..448935e3a4ab21655b8e45b53055a3e14c16ab74 100644 --- a/libc/src/dirent/readdir.cpp +++ b/libc/src/dirent/readdir.cpp @@ -14,10 +14,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(struct ::dirent *, readdir, (::DIR * dir)) { - auto *d = reinterpret_cast<__llvm_libc::Dir *>(dir); + auto *d = reinterpret_cast(dir); auto dirent_val = d->read(); if (!dirent_val) { libc_errno = dirent_val.error(); @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(struct ::dirent *, readdir, (::DIR * dir)) { return dirent_val.value(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/dirent/readdir.h b/libc/src/dirent/readdir.h index b78150bf64890455564565ba545eb865bdebba72..83c8c56e3f53b0696d06ccdfc6bab3beed6de7fc 100644 --- a/libc/src/dirent/readdir.h +++ b/libc/src/dirent/readdir.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { struct ::dirent *readdir(DIR *dir); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_DIRENT_READDIR_H diff --git a/libc/src/errno/libc_errno.cpp b/libc/src/errno/libc_errno.cpp index 0489e11a1e8947f215412000a95eda41d73d70bc..c8f0bffd0962e9b4ec7449b956ba09b0a82a26ed 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 c81ea3129333ac3a16df62ba962fee5ddb85a3a1..fbcd1c3395cd1fdc43327d84c4c5a0415d0fd19b 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 0c1abda2870c79d8fea2285a6ac8705836db0687..fc91a3cc8f677a718305c46b0e447dc624263ac1 100644 --- a/libc/src/fcntl/creat.h +++ b/libc/src/fcntl/creat.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int creat(const char *path, int mode); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_FCNTL_CREAT_H diff --git a/libc/src/fcntl/linux/creat.cpp b/libc/src/fcntl/linux/creat.cpp index 0b449bb8e0616c072c6f4b181218a9cdb0f0436d..0710fab23fe1b8a46a191d684db9e039d671f78c 100644 --- a/libc/src/fcntl/linux/creat.cpp +++ b/libc/src/fcntl/linux/creat.cpp @@ -15,14 +15,14 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, creat, (const char *path, int mode_flags)) { #ifdef SYS_open - int fd = __llvm_libc::syscall_impl( + int fd = LIBC_NAMESPACE::syscall_impl( SYS_open, path, O_CREAT | O_WRONLY | O_TRUNC, mode_flags); #else - int fd = __llvm_libc::syscall_impl( + int fd = LIBC_NAMESPACE::syscall_impl( SYS_openat, AT_FDCWD, path, O_CREAT | O_WRONLY | O_TRUNC, mode_flags); #endif @@ -33,4 +33,4 @@ LLVM_LIBC_FUNCTION(int, creat, (const char *path, int mode_flags)) { return -1; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/fcntl/linux/open.cpp b/libc/src/fcntl/linux/open.cpp index 9558a2b030b9e58a7c4966fd50a995beaa40875a..7394069a7e73697e43e5e316ede1e5da8c7ed745 100644 --- a/libc/src/fcntl/linux/open.cpp +++ b/libc/src/fcntl/linux/open.cpp @@ -16,7 +16,7 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, open, (const char *path, int flags, ...)) { mode_t mode_flags = 0; @@ -30,10 +30,10 @@ LLVM_LIBC_FUNCTION(int, open, (const char *path, int flags, ...)) { } #ifdef SYS_open - int fd = __llvm_libc::syscall_impl(SYS_open, path, flags, mode_flags); + int fd = LIBC_NAMESPACE::syscall_impl(SYS_open, path, flags, mode_flags); #else - int fd = __llvm_libc::syscall_impl(SYS_openat, AT_FDCWD, path, flags, - mode_flags); + int fd = LIBC_NAMESPACE::syscall_impl(SYS_openat, AT_FDCWD, path, flags, + mode_flags); #endif if (fd > 0) return fd; @@ -42,4 +42,4 @@ LLVM_LIBC_FUNCTION(int, open, (const char *path, int flags, ...)) { return -1; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/fcntl/linux/openat.cpp b/libc/src/fcntl/linux/openat.cpp index c6a47bfa2b47563d7d9041b5386c5e48f4b1305c..a2f7413ff87bf82fb15b344102d68d8bc02a7a1e 100644 --- a/libc/src/fcntl/linux/openat.cpp +++ b/libc/src/fcntl/linux/openat.cpp @@ -16,7 +16,7 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, openat, (int dfd, const char *path, int flags, ...)) { mode_t mode_flags = 0; @@ -29,8 +29,8 @@ LLVM_LIBC_FUNCTION(int, openat, (int dfd, const char *path, int flags, ...)) { va_end(varargs); } - int fd = - __llvm_libc::syscall_impl(SYS_openat, dfd, path, flags, mode_flags); + int fd = LIBC_NAMESPACE::syscall_impl(SYS_openat, dfd, path, flags, + mode_flags); if (fd > 0) return fd; @@ -38,4 +38,4 @@ LLVM_LIBC_FUNCTION(int, openat, (int dfd, const char *path, int flags, ...)) { return -1; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/fcntl/open.h b/libc/src/fcntl/open.h index 49cfb50126594bdf6ea2372f4353f73fdb54b6d2..30950dd828ae3e6c955645bb3bb3659bd890e376 100644 --- a/libc/src/fcntl/open.h +++ b/libc/src/fcntl/open.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int open(const char *path, int flags, ...); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_FCNTL_OPEN_H diff --git a/libc/src/fcntl/openat.h b/libc/src/fcntl/openat.h index 96a96de140496310a04c0fefb434a8f8757e18c7..5ea5d7f0b65ac3035725c8ea16a758e91d9b09c6 100644 --- a/libc/src/fcntl/openat.h +++ b/libc/src/fcntl/openat.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int openat(int dfd, const char *path, int flags, ...); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_FCNTL_OPENAT_H diff --git a/libc/src/fenv/feclearexcept.cpp b/libc/src/fenv/feclearexcept.cpp index 2bdea887e1df62c94b15821b0336ff88226cc7ec..5eb1b0438b9af10f8bf529ff447ee97ffe9553b7 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 fa771cee32a1804730b6abc4eedf203a9f3030df..e7df86d0e20d819af2f0a5340833d1f3c2f0fe5a 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 855d7077f7d99fadacf77396d092e26b76532abf..c715627c395b90fccc5ed26bf103bdc8e75e8a07 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 44a545edb7a9225a822e62535a0813d9ff10c544..977fd83262c1e51a63a8f02c832c88d2c31299ae 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 0b63a7fc5d123d05762587b59ec275be0c05a188..cf45b7f1b5f73504d43b82e753e2f4cab3eb4d9c 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 58c1e0a9a4a461024ca372e8a3dee094e2667204..a07716247995220000fc792134baa57ee06ac5d8 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 cc98031b1252e5baf5c10690ce970dd405e3e301..fbdb7d577b5a5e05ba1fc2c9669527586caa21d9 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 e1001682a42bba66a267133b1347afaf5627b21f..658316482984e14f8e3aabcc13628a280d0cb7c7 100644 --- a/libc/src/fenv/fegetenv.h +++ b/libc/src/fenv/fegetenv.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fegetenv(fenv_t *); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_FENV_FEGETENV_H diff --git a/libc/src/fenv/fegetexcept.cpp b/libc/src/fenv/fegetexcept.cpp index 7cf1294fc6dfe7473bd54e7856d4fa36135f11df..edc4faff052827cb151dcee5b885d1540b68ca63 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 ed6579f8f4671f553ee4d248ed38c65100d44c5f..53ce64872eaf0ad53ee7ae25532e26dd5213a41a 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 15c2468a1eb26bb7e72157b539f461f7cf5bb157..71b87ce7315d1a3004eba41edb09b5284011e5e9 100644 --- a/libc/src/fenv/fegetexceptflag.cpp +++ b/libc/src/fenv/fegetexceptflag.cpp @@ -12,7 +12,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fegetexceptflag, (fexcept_t * flagp, int excepts)) { // TODO: Add a compile time check to see if the excepts actually fit in flagp. @@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(int, fegetexceptflag, (fexcept_t * flagp, int excepts)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/fenv/fegetexceptflag.h b/libc/src/fenv/fegetexceptflag.h index 20913cb7a22f84b0e21ba9a65c04e1e8a08c22a0..ad72161e536f8391f78093dfd4ac84556cbfca81 100644 --- a/libc/src/fenv/fegetexceptflag.h +++ b/libc/src/fenv/fegetexceptflag.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fegetexceptflag(fexcept_t *, int excepts); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_FENV_FEGETEXCEPTFLAG_H diff --git a/libc/src/fenv/fegetround.cpp b/libc/src/fenv/fegetround.cpp index c01ea2c0ec417a18f215a73f213618f8e3b25740..edf6eac0a5b03a1b5ebf5945a12df3283988cc49 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 1bc79cbf5a6c40c22100757d86e6fccf93d40f3e..40be879a66d05d63c5a4b0a1812f8fd07a043e4d 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 fe0f10245b8754b596b7a58daed99c7694a1143d..3c73b1f42177986293e8aa3002ddd31da48b5a75 100644 --- a/libc/src/fenv/feholdexcept.cpp +++ b/libc/src/fenv/feholdexcept.cpp @@ -12,7 +12,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, feholdexcept, (fenv_t * envp)) { if (fputil::get_env(envp) != 0) @@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(int, feholdexcept, (fenv_t * envp)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/fenv/feholdexcept.h b/libc/src/fenv/feholdexcept.h index cfb86b54ff49e981ea1330f337b156db602cd2db..bbefc4ecbd41b21b58ca02fe97f662e016ced9a1 100644 --- a/libc/src/fenv/feholdexcept.h +++ b/libc/src/fenv/feholdexcept.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int feholdexcept(fenv_t *); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_FENV_FEHOLDEXCEPT_H diff --git a/libc/src/fenv/feraiseexcept.cpp b/libc/src/fenv/feraiseexcept.cpp index 4c2a467ccf653b10f47f69ec11c01ddf88bacca1..0bee7f5f5b9232de8d5a46b683c46f02e4690b37 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 5c9eacf462d49fdcabd2ca492d8e3ca55d077080..a5ab3b93720ef48cd044bdee5650a8b0675edd31 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 628da315feda345496d31ceaf787e4dc2a6e258a..25ac78958cf9306bea6b99b9c0c60f1071d4c118 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 316ecee41996e18d9c19c47becc4f6671ad1aca5..8b56bebc2e36d4b7da0d05340e7f85589bbf96c9 100644 --- a/libc/src/fenv/fesetenv.h +++ b/libc/src/fenv/fesetenv.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fesetenv(const fenv_t *); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_FENV_FESETENV_H diff --git a/libc/src/fenv/fesetexceptflag.cpp b/libc/src/fenv/fesetexceptflag.cpp index 3e134aba7fcf744d57095d6d9a6abcb750915081..2fe7cb571a8ddd26f4dd3b6e7876c1c8967ea712 100644 --- a/libc/src/fenv/fesetexceptflag.cpp +++ b/libc/src/fenv/fesetexceptflag.cpp @@ -12,7 +12,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fesetexceptflag, (const fexcept_t *flagp, int excepts)) { @@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, fesetexceptflag, return fputil::set_except(excepts_to_set); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/fenv/fesetexceptflag.h b/libc/src/fenv/fesetexceptflag.h index 0e6497abafaed4f56f352424357e28c0117675ad..15e62eda1b840cd3f127b4f3d552d69003abd5ab 100644 --- a/libc/src/fenv/fesetexceptflag.h +++ b/libc/src/fenv/fesetexceptflag.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fesetexceptflag(const fexcept_t *, int excepts); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_FENV_FESETEXCEPTFLAG_H diff --git a/libc/src/fenv/fesetround.cpp b/libc/src/fenv/fesetround.cpp index 4af8a77e6e9e4340092622945473f20dcb60732b..22f2b9d1e087ef36a738ace3ecfe231b864f04eb 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 148a5eabcf3d5871eeca4440215d0926f1af46f1..75023bdb691c4735365845dff38bd39c4430dfbe 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 c70301fd248e2e442aefdd2b9b989327d6752211..c284a2c2a9528a9b3c4325b98c69dd785ffaf7f9 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 fb3e4045dd6b0aeba531e68dd88b1c2b5b920a58..dec1ac20cc08bf8c4f6ac10fea1928e332c06d7b 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 5cecf0fae19e89bb9091ffc48e136aba417aa6e5..7e81b9476da91b281cde208806fb3baa409b54e8 100644 --- a/libc/src/fenv/feupdateenv.cpp +++ b/libc/src/fenv/feupdateenv.cpp @@ -12,7 +12,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, feupdateenv, (const fenv_t *envp)) { int current_excepts = fputil::test_except(FE_ALL_EXCEPT); @@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(int, feupdateenv, (const fenv_t *envp)) { return fputil::raise_except(current_excepts); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/fenv/feupdateenv.h b/libc/src/fenv/feupdateenv.h index 1599c01ebddffa2901b8cc6f6feac2487795d815..294c041ddeae790a5d6a04bfffa10c01459580b1 100644 --- a/libc/src/fenv/feupdateenv.h +++ b/libc/src/fenv/feupdateenv.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int feupdateenv(const fenv_t *); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_FENV_FEUPDATEENV_H diff --git a/libc/src/gpu/rpc_host_call.cpp b/libc/src/gpu/rpc_host_call.cpp index b39bef65fc1a22ad573e30a5ae2f4e1107361bd5..7b9b9f2adfd536aa5fc51cb1d7ce00e54cceba28 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 f8e2cdd31902a2f7f937ff5c0dd25f6a1cb5e2a4..14393ab95dc13a4c3e0aaf6343e5577c7ae2eed4 100644 --- a/libc/src/gpu/rpc_host_call.h +++ b/libc/src/gpu/rpc_host_call.h @@ -11,10 +11,10 @@ #include // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void rpc_host_call(void *fn, void *buffer, size_t size); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_GPU_RPC_H_HOST_CALL diff --git a/libc/src/inttypes/imaxabs.cpp b/libc/src/inttypes/imaxabs.cpp index 6c29ea2354e46b544ac00a5f78cb04b2744163b8..b390676f9dde287afea6a53d11cd148a5cbc0bf1 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 0add10d38071cb939fea2a0edffd1681f0d779ca..cd30011b9e57a7e4e176721affcf8e43d2adde83 100644 --- a/libc/src/inttypes/imaxabs.h +++ b/libc/src/inttypes/imaxabs.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { intmax_t imaxabs(intmax_t j); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_INTTYPES_IMAXABS_H diff --git a/libc/src/inttypes/imaxdiv.cpp b/libc/src/inttypes/imaxdiv.cpp index 9ed6a1b46e5add46b98156483456ddfde2764558..77f0cc58a897cb49a59a1f9a4de0efecfb52757c 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 c8af35272fcc23a06c6061312319c23acc9e88c2..749122782347c391d19f3728c1a7c127b1cdf968 100644 --- a/libc/src/inttypes/imaxdiv.h +++ b/libc/src/inttypes/imaxdiv.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { imaxdiv_t imaxdiv(intmax_t x, intmax_t y); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_INTTYPES_IMAXDIV_H diff --git a/libc/src/inttypes/strtoimax.cpp b/libc/src/inttypes/strtoimax.cpp index 5a2562380aa6a4c144a62d9bf6e6b3d79bb75f68..459877eeff472dcd3d20358aaee8bbc5ff37b876 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 c2097e33616b43428f889b30c2b8c28cdfb197d2..b72547f3d22f6228b0c7fc6b55ad21ae331419cc 100644 --- a/libc/src/inttypes/strtoimax.h +++ b/libc/src/inttypes/strtoimax.h @@ -11,11 +11,11 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { intmax_t strtoimax(const char *__restrict str, char **__restrict str_end, int base); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_INTTYPES_STRTOIMAX_H diff --git a/libc/src/inttypes/strtoumax.cpp b/libc/src/inttypes/strtoumax.cpp index 0e33c55ec3e2d81b4a0ebe4bc3393e3bf66eec60..4011a177b81fe1d9b249ab8cfabadefa5cfdda27 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 e3ec13a53b89ccdb40b3d3baea7651e4152c92c0..d59e9932da519e82ddbeacd595073d3171c422b2 100644 --- a/libc/src/inttypes/strtoumax.h +++ b/libc/src/inttypes/strtoumax.h @@ -11,11 +11,11 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { uintmax_t strtoumax(const char *__restrict str, char **__restrict str_end, int base); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_INTTYPES_STRTOUMAX_H diff --git a/libc/src/math/aarch64/ceil.cpp b/libc/src/math/aarch64/ceil.cpp index 73c3cc02839d0d46371255e1339e2570416da1d4..81cd95078efee4e56603f0c59a54c52b5ff4da51 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 2268989d131aa94948b8f6a8175c23833abc5e54..3cbcc1f0e90d812e61d8919a5569a102ebcd5bd8 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 8de1f67bd93c8654c11e4aa621249ee780fb70aa..0e3d13a13a95c7c4488c25a81975de7010fe4648 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 6bb99ebeff28b0b2643c638645c84c7613196f21..8942a9e7c576edd130d5982c860da2b7c3fca095 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 6659060fbd700a9105eeebfe38a8228e22476be3..8972c16c571677c2f1d07d5b0e93a2c893508d52 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 6044c8b75136b8740d92640bf6bad24491db8433..8b3a9cf50e601f15df975bc7e41ab0ec863367fd 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 280d919bda9fb48d7e7206a78ddbe6a222b3ee01..34ffd1702f5a63922fa4888853c3c76b2a081271 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 a325ce3687f4af89734894a8b2531437fa6fbbe6..fc2426f26df242111e17147d8526dcf34c1799e3 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 9604fbfa51aeb9cd930ead8832099642522c08a1..3221efa340a9dcb93311913ebe52525e0234887d 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 66df87874a05da821e386bdad99146ff8d014dd3..aac43b4ccca8dde3e60997320ccadf9b677fd919 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 71821277ef7611783f9eb1b39676f5366de841cc..227f10b0a5072918caeb5c094325e222076ca124 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 ff4b32552c1e26903c7ed4bf42a4ca678a0fc186..32a697cbfad097dbba6311f194de8840d0c1bb54 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 9b264e84a3a2f9730eb07701d11a9a0adff47d2b..bb4c5a8bd963ce4c073630cb39cb2f9cdc692dbd 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 8e8b4ebf0bfdbd9b0d5833dbe842920f630182d5..589ffd022366ac4a97e446e5d682c016ef4e309f 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 98188de20e405497d207e614348abf20b468884f..c424deec34ca80219682e888b224ef9aec037af0 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 e8e64565052a6316d53d93f939954aba3c2eae94..0fa3aa8bc048e6c67ee41d0625a214ec46e1358f 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 8bf4c565c7d3b1351d9ab18595530b3ba0dd0931..fbe6563d219232f6642eee695afdcc08041512a9 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 edffe1b082fe0470c36f9ca1ce54f81ca9f4e428..004240f412bf16e0290b3778bf4046afa86694b7 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 5b7f1132252d679b0c08b1e08c08f89076358183..503e7cbfeda6ed1b87280ee55600082b1fafb073 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 4f48323c701417ceb283aa03836c07bc4775afe4..8b8b37bd85d95b7b099862e6c3b0bbcdf246a769 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 aca1d6d1e2281e9dc8b433f836dffa1be698a44b..aa97ccf66e6c77d9ae8f09a08dc92d6ce826a471 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 1aaabe900ba884fdeff9dace0999d698c9f6e462..158f3119108123861c99a5edff198a30f22191e8 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 c7a911b79ac2dc5ee6b7bc019cc36e0a25e3280e..f0c8b6bced454622919d5f3df2dd55fc02c7dbc5 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 558dc220a0380ecd6896b8dd772bbf7bd8e619bf..c470a8c943b5050a5398b9d619c545bd01a0eb64 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 9efe0620f5d7d9402ef2d51d85bd6fa480aa26d8..6f08bf037c578e224c7dd4f481034b48ed5cb63e 100644 --- a/libc/src/math/docs/add_math_function.md +++ b/libc/src/math/docs/add_math_function.md @@ -30,7 +30,7 @@ added to the following locations: ``` libc/src/math/CMakeLists.txt ``` -- Add function declaration (under `__llvm_libc` namespace) to: +- Add function declaration (under `LIBC_NAMESPACE` namespace) to: ``` libc/src/math/.h ``` @@ -56,7 +56,7 @@ located at: ``` - These are preferred to be included as header-only. - To manipulate bits of floating point numbers, use the template class -`__llvm_libc::fputil::FPBits<>` in the header file: +`LIBC_NAMESPACE::fputil::FPBits<>` in the header file: ``` libc/src/__support/FPUtils/FPBits.h ``` @@ -71,7 +71,7 @@ compare your outputs with the corresponding MPFR function. In order for your new function to be supported by these two macros, the following files will need to be updated: -- Add the function enum to `__llvm_libc::testing::mpfr::Operation` in the +- Add the function enum to `LIBC_NAMESPACE::testing::mpfr::Operation` in the header file: ``` libc/utils/MPFRWrapper/MPFRUtils.h diff --git a/libc/src/math/erff.h b/libc/src/math/erff.h index 1f7dcb5352f74e37c32b1c0b8fd75600984687d8..f6c56c7dddab614433257ebfc29ec66715f38189 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 6fed17185ccc213797f6c1e762708986bc811ea4..6d60a3bc4802f4a851d823ee2813582df316640b 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 5afc95db2ce9c37a5703e4453e211e6f82fc7e1f..081b419275a33c05cae3e8b77c4dea94c31d95ac 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 7f0ef25efa48f58ba939ef6fbe4d90a2f283a210..4df5c461c1f56b609348f68fc983ca6c0674a6ec 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 ee70722ca3858c7ff966687ea018213d01805407..2feccf6128e76d2b25a0a876473cfd7f31024312 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 c1f72b1b80fa8dd8573451e6f6a7657d1f6cf94d..13af54c02468f56cb0f942b41348e6a3b4e5bf2a 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 c61ce98e9ddcf55e96d3f2aefed6a586d4e1a49f..38837cba41d53519f1cf5198d476d115a7bc2c7b 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 2577e4a4929809214fa67052efc672a8251098a0..359cbeec72f6c30ca599a7e4560afa53fea5a68e 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 424d2e01646b003533acdb512fdff7f5c4ed204c..0aad5ea1f69f987eb0a94dfedd092e2486d372d1 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 0ad97a027c6c8787f29c5a8255150fa839850ebb..ca2cc106a08b2c7787f21fc83ece6488970a1944 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 fa25b1ab564d7d0ed823adece10b306730fc03e0..b3df8bffed105edeb8fb307e980bc5ed3e0c04ee 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 f838c121e291cd1b53cc40582d905066016a4fe3..457cb470a4e2b03c01e367aedb66a6f592044ac5 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 50c586c49cc39c82c2d0116d09a0f54ff7582a53..01d5a530b8cca8df463b03b153df58e7b6501fde 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 6de261fe861a0ac466ce265d057f907e356cd0c0..4b18d9a2590a4b21a8ae9dbe94271176357d2286 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 88a76ebf7d8058fdcc8090c6b73ea17a4709ebd9..2920c7a7ee45d67d2d6ad1a856844f75b5cdc3af 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 029df3ac5c9fe5704b2d87d931b1a8a82da252e6..52d6dd701fa9b9368f1d1c6b873332ff53db7e83 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 224cc13ec6fa66a42908c6ad75b1ef442a32b31f..ef53b29e735882bbb1e51beb6d51aa8f1966f768 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 fbc7f09ee2c74670e9a2decc0115215e96aa7810..7f0608ea4aaa69d6be722fa1a1faca85d4aa72ac 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 48fbb65d66506f5d7230e23638e9c00b493b8f7f..29e5bdc3e233595e88f915d9f8de3b29ab4562a7 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 9f057983d28bb7f76bf7bb1fe8fda0fd64ad3a6b..64baa4d261dba578a163db075654d03cef10bc75 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 e37df5cf9565d4a1de6dcb5ed804e9605a442afb..1126323e2a4b24d79cca3231fced4b462f8281d6 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 41d80ba4aa52ca5d41fe3c4190fb1e6e7bdf71ed..a0673001fe0e6ac2c20727cf06eda9b6fda28207 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 52334ee8e456054d29b21edcbc8133514756f6b0..bf011bb7c313cce5ffec8cfd21c06864d2f70fcf 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 62dad57d852aad008869d5523a02a78bbcf4531c..b9c159a68b88e259079465dafe0e1e54d0fd701d 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 c19505c018283e4fa0ec647a0b08ef1ae9c8007c..e111e26fc3f077f6efeaeb2c99fe9245bc3509ee 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 a79ff018ec641c2834ab6b5b797d2a38f14ca5c4..01b9aa7d2441e1a71f3fe1080fb1c08c9598cbf1 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 ab9c4aee611782b1ef3c2f700eceb154bd170f29..90d97e6cf1e052e06fc5ca3169d145dd961036d8 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 9258243188360b23c00fe34e38c2fd79b2cdff45..963ea7ba5fd072fdc4a42ec1c171e9ca608cc6c2 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 ed303d2c76dd5498d4b71c621925ed46d5acfae2..74eeac24bef8e53bba7062e00409b28148aebbde 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 9f75c82b9034adea7d19e01b0b70c77b6aebba84..818266ed9f5fa5433652d364a54c03e3a2ed50dd 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 ab13467b4a0a5f57dbb75d16e7008eb440e842cf..2a9b2a6852fe9e91e8851dd3828f739a28c35c05 100644 --- a/libc/src/math/generic/acosf.cpp +++ b/libc/src/math/generic/acosf.cpp @@ -19,7 +19,7 @@ #include "inv_trigf_utils.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { static constexpr size_t N_EXCEPTS = 4; @@ -119,4 +119,4 @@ LLVM_LIBC_FUNCTION(float, acosf, (float x)) { return static_cast(x_sign ? M_MATH_PI - r : r); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/acoshf.cpp b/libc/src/math/generic/acoshf.cpp index ce352764fbbc192dcc2ace5e073f3bb92a00bf67..9438be1bee74eb4614739319a35f200b17c5f568 100644 --- a/libc/src/math/generic/acoshf.cpp +++ b/libc/src/math/generic/acoshf.cpp @@ -16,7 +16,7 @@ #include "src/math/generic/common_constants.h" #include "src/math/generic/explogxf.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(float, acoshf, (float x)) { using FPBits_t = typename fputil::FPBits; @@ -74,4 +74,4 @@ LLVM_LIBC_FUNCTION(float, acoshf, (float x)) { log_eval(x_d + fputil::sqrt(fputil::multiply_add(x_d, x_d, -1.0)))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/asinf.cpp b/libc/src/math/generic/asinf.cpp index 9b724d3296c84e93884fa9675cbefb2fddd8c4fa..f40a08e752ed3989247f3462cc77f79f90591e55 100644 --- a/libc/src/math/generic/asinf.cpp +++ b/libc/src/math/generic/asinf.cpp @@ -20,7 +20,7 @@ #include "inv_trigf_utils.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { static constexpr size_t N_EXCEPTS = 2; @@ -152,4 +152,4 @@ LLVM_LIBC_FUNCTION(float, asinf, (float x)) { return static_cast(fputil::multiply_add(c3, r, c2)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/asinhf.cpp b/libc/src/math/generic/asinhf.cpp index 91ecf45667bfc7b69aedfc1501a75471a4539f26..6bde08d42a429cdd3533b0ea389399c8c95709d9 100644 --- a/libc/src/math/generic/asinhf.cpp +++ b/libc/src/math/generic/asinhf.cpp @@ -15,7 +15,7 @@ #include "src/math/generic/common_constants.h" #include "src/math/generic/explogxf.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(float, asinhf, (float x)) { using FPBits_t = typename fputil::FPBits; @@ -104,4 +104,4 @@ LLVM_LIBC_FUNCTION(float, asinhf, (float x)) { x_d, x_sign, fputil::sqrt(fputil::multiply_add(x_d, x_d, 1.0))))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/atanf.cpp b/libc/src/math/generic/atanf.cpp index 5037806d37a1b1a934047bf2aa469e404aca8943..f2e4f8bb93b6f9eade089472813dd2afd1f84247 100644 --- a/libc/src/math/generic/atanf.cpp +++ b/libc/src/math/generic/atanf.cpp @@ -13,7 +13,7 @@ #include "src/__support/macros/optimization.h" // LIBC_UNLIKELY #include "src/math/generic/inv_trigf_utils.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(float, atanf, (float x)) { using FPBits = typename fputil::FPBits; @@ -61,4 +61,4 @@ LLVM_LIBC_FUNCTION(float, atanf, (float x)) { return static_cast(atan_eval(x)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/atanhf.cpp b/libc/src/math/generic/atanhf.cpp index 0a4512f7622da62143de7a2be6da4fa41fcfbb0b..58e7f234b2c55b79709da830dbb0b9fd4867f47a 100644 --- a/libc/src/math/generic/atanhf.cpp +++ b/libc/src/math/generic/atanhf.cpp @@ -11,7 +11,7 @@ #include "src/__support/macros/optimization.h" // LIBC_UNLIKELY #include "src/math/generic/explogxf.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(float, atanhf, (float x)) { using FPBits = typename fputil::FPBits; @@ -57,4 +57,4 @@ LLVM_LIBC_FUNCTION(float, atanhf, (float x)) { return static_cast(0.5 * log_eval((xdbl + 1.0) / (xdbl - 1.0))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/ceil.cpp b/libc/src/math/generic/ceil.cpp index 372a0356e6a2a27c3d2ba3ae8f210260c36ee5ac..efd0f246a9b9003f9bddf82995807f7f96975389 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 9a510483f7a4aa0ee9b7e7e26322c42b9738e0d3..d49b34242da4f8a0f7772a094b80bc726cc5eadf 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 b055d90761b2ff9682936ed59aca5dcd79b23c7f..7c3b680ce6442892c4de7ee00015703b90c3518a 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 78f9df9547ab4452eaedad7601e539dc7e4874c3..737d2ab77121adb8b25231e7b819c7efeea13100 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 8cb86b615e35a8a5c1d3b296b6f07f6905565c84..df9d7828bf1609dee4c7a59d858d643e06c02434 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 51e63f1019b82c0f339723b9aea976dca71c38b5..c5ad414bd6482606ef3a02a10e5e2b3d6e5a3cf5 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 4773a25d12b4f9bca4f2d2fd00a8509ddcf46f7e..077e1ce60ec18f1ae6e79916b3e85369175cda81 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 5622378755d7e405d0e1a4e85661c0931ed4f5eb..b74393cee5d6a6563bd9955cbb304dddb5dcb351 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 2e4ca3c4133ff38c2880dc46c1e57eff1a00fcc5..67b60de03024fb0ca26f0dfa48899df518a7f3c2 100644 --- a/libc/src/math/generic/cosf.cpp +++ b/libc/src/math/generic/cosf.cpp @@ -19,7 +19,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Exceptional cases for cosf. static constexpr size_t N_EXCEPTS = 6; @@ -133,4 +133,4 @@ LLVM_LIBC_FUNCTION(float, cosf, (float x)) { sin_y, -sin_k, fputil::multiply_add(cosm1_y, cos_k, cos_k))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/coshf.cpp b/libc/src/math/generic/coshf.cpp index 67d2667711de94a3475436c022ef333f0c0a1b25..62d77867f26f19c142c9742cf9cd8472108b0641 100644 --- a/libc/src/math/generic/coshf.cpp +++ b/libc/src/math/generic/coshf.cpp @@ -13,7 +13,7 @@ #include "src/__support/macros/optimization.h" // LIBC_UNLIKELY #include "src/math/generic/explogxf.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(float, coshf, (float x)) { using FPBits = typename fputil::FPBits; @@ -51,4 +51,4 @@ LLVM_LIBC_FUNCTION(float, coshf, (float x)) { return static_cast(exp_pm_eval(x)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/erff.cpp b/libc/src/math/generic/erff.cpp index a2cc8bf860fc95735ed23d0a3a0845d5e6d2ed69..a7b0897c3b58cb76a900c1b5429fac53e145ad49 100644 --- a/libc/src/math/generic/erff.cpp +++ b/libc/src/math/generic/erff.cpp @@ -14,7 +14,7 @@ #include "src/__support/common.h" #include "src/__support/macros/optimization.h" // LIBC_UNLIKELY -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Polynomials approximating erf(x)/x on ( k/8, (k + 1)/8 ) generated by Sollya // with: @@ -170,4 +170,4 @@ LLVM_LIBC_FUNCTION(float, erff, (float x)) { return static_cast(xd * fputil::multiply_add(x8, p1, p0)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/exp.cpp b/libc/src/math/generic/exp.cpp index c16b461c14ed870b292c6b6e4158fceb195b081d..110ab9666e52aeeb6d1d802bb32d3592b4a74886 100644 --- a/libc/src/math/generic/exp.cpp +++ b/libc/src/math/generic/exp.cpp @@ -25,7 +25,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { using fputil::DoubleDouble; using fputil::TripleDouble; @@ -413,4 +413,4 @@ LLVM_LIBC_FUNCTION(double, exp, (double x)) { return static_cast(r_f128); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/exp10.cpp b/libc/src/math/generic/exp10.cpp index 4a43259b3307d31828286cf04393477779174fd2..b152425b14b597b900a7d97d3833c5452b055c71 100644 --- a/libc/src/math/generic/exp10.cpp +++ b/libc/src/math/generic/exp10.cpp @@ -25,7 +25,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { using fputil::DoubleDouble; using fputil::TripleDouble; @@ -473,4 +473,4 @@ LLVM_LIBC_FUNCTION(double, exp10, (double x)) { return static_cast(r_f128); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/exp10f.cpp b/libc/src/math/generic/exp10f.cpp index b0e93dd6fbca4d49d203e1987a8f1dcf459ee0ed..52190fb92405e7b1639e02301a96990331bae860 100644 --- a/libc/src/math/generic/exp10f.cpp +++ b/libc/src/math/generic/exp10f.cpp @@ -20,7 +20,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(float, exp10f, (float x)) { using FPBits = typename fputil::FPBits; @@ -133,4 +133,4 @@ LLVM_LIBC_FUNCTION(float, exp10f, (float x)) { return static_cast(multiply_add(p, lo2 * rr.mh, c0 * rr.mh)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/exp2.cpp b/libc/src/math/generic/exp2.cpp index 96710c7d53706977bdbe3f4134377e84a75cc862..b4b9960ccb2fb65dd8c7002a2077d611e576418e 100644 --- a/libc/src/math/generic/exp2.cpp +++ b/libc/src/math/generic/exp2.cpp @@ -25,7 +25,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { using fputil::DoubleDouble; using fputil::TripleDouble; @@ -387,4 +387,4 @@ LLVM_LIBC_FUNCTION(double, exp2, (double x)) { return static_cast(r_f128); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/exp2f.cpp b/libc/src/math/generic/exp2f.cpp index 2a5776ad6ca712e0fb0452684c5e7124649b431d..fc91dfdfe95afa0ef261d6a2f39c29025950f66d 100644 --- a/libc/src/math/generic/exp2f.cpp +++ b/libc/src/math/generic/exp2f.cpp @@ -22,7 +22,7 @@ #include "explogxf.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { constexpr uint32_t EXVAL1 = 0x3b42'9d37U; constexpr uint32_t EXVAL2 = 0xbcf3'a937U; @@ -158,4 +158,4 @@ LLVM_LIBC_FUNCTION(float, exp2f, (float x)) { return static_cast(fputil::multiply_add(p, dx_sq * mh, c1 * mh)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/exp_utils.cpp b/libc/src/math/generic/exp_utils.cpp index 9555dd61fb4388d43a414ea797808cecdd302565..afdaea347478d4dbf5f4b15e69383f301597f271 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 edbd60a2d568196a79668fbb16ab2e3833d8a4e4..49d9a8192d344acd145c826ea4605b941a70fd1a 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 2cc8406c095aefb5d1c92779b9f29d79936ddc70..5a938a7a1c22e5e031b2c91e0a1c276db3c85cbc 100644 --- a/libc/src/math/generic/expf.cpp +++ b/libc/src/math/generic/expf.cpp @@ -20,7 +20,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(float, expf, (float x)) { using FPBits = typename fputil::FPBits; @@ -105,4 +105,4 @@ LLVM_LIBC_FUNCTION(float, expf, (float x)) { return static_cast(exp_hi * exp_mid * exp_lo); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/explogxf.cpp b/libc/src/math/generic/explogxf.cpp index 3e12e8a0ce4bb5bf442de0f5841380541bf275ce..87ee57850c4734c049c919340508c6179691d3e3 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 97b5854c581b2b6dbc4b09f1546043ab9fef9a08..512785be2cb858b735661e69a2ac76c32fdd20dd 100644 --- a/libc/src/math/generic/explogxf.h +++ b/libc/src/math/generic/explogxf.h @@ -22,7 +22,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { struct ExpBase { // Base = e @@ -296,7 +296,7 @@ LIBC_INLINE static double log2_eval(double x) { // c0 = dx * (1.0 / ln(2)) + LOG_P1_LOG2[p1] double c0 = fputil::multiply_add(dx, 0x1.71547652b82fep+0, LOG_P1_LOG2[p1]); - result += __llvm_libc::fputil::polyeval(dx * dx, c0, c1, c2, c3, c4); + result += LIBC_NAMESPACE::fputil::polyeval(dx * dx, c0, c1, c2, c3, c4); return result; } @@ -381,6 +381,6 @@ LIBC_INLINE cpp::optional ziv_test_denorm(int hi, double mid, double lo, return cpp::nullopt; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_MATH_GENERIC_EXPLOGXF_H diff --git a/libc/src/math/generic/expm1f.cpp b/libc/src/math/generic/expm1f.cpp index 811baec0e91038f963012280c18cd285d24f24fa..edd0183c935e445bd987536e3f0a0a19de79dd4e 100644 --- a/libc/src/math/generic/expm1f.cpp +++ b/libc/src/math/generic/expm1f.cpp @@ -22,7 +22,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(float, expm1f, (float x)) { using FPBits = typename fputil::FPBits; @@ -160,4 +160,4 @@ LLVM_LIBC_FUNCTION(float, expm1f, (float x)) { return static_cast(fputil::multiply_add(exp_hi_mid, exp_lo, -1.0)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/fabs.cpp b/libc/src/math/generic/fabs.cpp index 13872ac6e3ae2ffcd4d9e67605f5f72ceab7f493..0c0b7748b1f35ff8f38445c300c086b0076e99ac 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 da4c67e588890d7ef2537ca0a2ede52048d8ea3c..a57f6bf914eb2626560996aa1b263c03a45c33c5 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 9dd3665b5f5be5cb901ff73195960a3227ecf43e..6b912c92eca867ed2dad18db673b04bcb5e3e282 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 1fcd09be52e4db4a1eb8f290cd255e182a8bf14b..22d99867b423dcea61d7da568913cb1f5429175d 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 db36f50a8dfb5e2cdc3fd5b3cebd64353f52470a..789a0c57eb1eeed1770483d8a9e608ebc52cca0d 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 97c46e542b05aca9cb1ba2adc301e2c34aa7e92a..c1091cc66b7a87796672f399cca49af7a9705b15 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 982464c4f88f3d7c164edcecadf51a90db6c776a..60386f0c9cf812c8caa83c90756765a4f4e87cfd 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 af66be776aff94eabc0ea33a084591d603e9cb3a..85666688685dc04ccc64effd6cc2f3efd94109ab 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 a56bc054e794091f37c1ab7842f9dc7b5c7d8231..280312797fe0ad4026790dfb6f5846083558b6c9 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 22aa20e78396e9b834a5bc0a410654ccbdd513ce..e27e5baeddf588347cbccc931bfee78134c70e72 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 30074b8ca4a0bf519c2cac09025bf047222f26e5..7512b82005d0f56837c741dba4429a0258b0fd81 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 e96794ba17a957841cb2413f5c7cfd35e3527fd2..7feeee9dcd94618efc22032bae90b504f73b73ff 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 6ad319f5cb5b9f98d477b4617b7cea4d924041ef..32410926c89a015b2cc07e2b5bdd8c3f77f14025 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 2a95c983de9393a253b532b9dec03fdb0d412f12..6c6250736f4f1858ccbcc26616ff10c1980c3766 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 d06c8a649516e61ddf4d5b8833dfd3844c3d4382..b9f313d5716358b9cc30e3544a70f3077b46ed02 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 658f1474919aa7a794f0a874397daca57933adb5..539fedbdd2fa2551951fea59197fe1dd46d042e6 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 2f10c8472d6af9638e994cea3bb72ba058fc19a9..147f6c562c52c712e6a654972d2806984ca4971a 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 563a1644aa75d0751f34fb3d6d1cb246cd66057f..69e0c8dd99169c4335d6f91f9e89d6ea8dbffec2 100644 --- a/libc/src/math/generic/fmod.cpp +++ b/libc/src/math/generic/fmod.cpp @@ -10,10 +10,10 @@ #include "src/__support/FPUtil/generic/FMod.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(double, fmod, (double x, double y)) { return fputil::generic::FMod::eval(x, y); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/fmodf.cpp b/libc/src/math/generic/fmodf.cpp index dca476c183b0c4e116f4f8d44a9706c44b4a238b..7a29ff1f18d319d12a191e391376bc3da242d46e 100644 --- a/libc/src/math/generic/fmodf.cpp +++ b/libc/src/math/generic/fmodf.cpp @@ -10,10 +10,10 @@ #include "src/__support/FPUtil/generic/FMod.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(float, fmodf, (float x, float y)) { return fputil::generic::FMod::eval(x, y); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/frexp.cpp b/libc/src/math/generic/frexp.cpp index c31526b78d45f31ee28cbb11e6a3b4f91a5af6f8..a183ba70cfc3e71f88dc1fdd328061a1c166ec07 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 2185e479fd656e36bc5380889d2374feb6f1d71d..4fdc869907ca0988355f68e2b40a60d4df8d548a 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 4573065ad5b1efe9fc90c5d680270fd97e00e2be..0be4e744b2d34b43944bf670151e6b2095e098b2 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 9bd27559320c3f4b97ef306674779230a31f1545..a1914d0e823c838338d86ccff3081c0cb8855215 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 ffc892ee566f4ec99c386a2033bd7ddd1c76ddf6..3fedeed4ed26b4e7a938ad908cc00d9b51236868 100644 --- a/libc/src/math/generic/hypotf.cpp +++ b/libc/src/math/generic/hypotf.cpp @@ -11,7 +11,7 @@ #include "src/__support/FPUtil/sqrt.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(float, hypotf, (float x, float y)) { using DoubleBits = fputil::FPBits; @@ -70,4 +70,4 @@ LLVM_LIBC_FUNCTION(float, hypotf, (float x, float y)) { return static_cast(static_cast(result)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/ilogb.cpp b/libc/src/math/generic/ilogb.cpp index 296e3027992b4d542fb0163e3005cdebf2011451..4e5f7d9642b4aa455a696e273a8985a76d2cf1e9 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 476fc3e4883c5955ef2814f1874cd9fcb96fc14e..ca15879bc25fe55a3c3b553966856d352b3d572a 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 b08ee91eeb3b97371a15f8d52a36cb93c3fa450f..4c18daab1a535835ee9fa0ec51c424bc80e55411 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 d88fe6097a6f57cd44748ff8443479c369b83c82..8013c0470affb16dfbcc844602265e30de46b17b 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 53763d484b8537f5bec321a6f35a5022e5298530..c88ded20b5bf24f4da93451cd1cad2d22604ba62 100644 --- a/libc/src/math/generic/inv_trigf_utils.h +++ b/libc/src/math/generic/inv_trigf_utils.h @@ -18,7 +18,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // PI and PI / 2 constexpr double M_MATH_PI = 0x1.921fb54442d18p+1; @@ -54,16 +54,16 @@ LIBC_INLINE double atan_eval(double x) { auto x_abs = bs.uintval() & FPB::FloatProp::EXP_MANT_MASK; if (x_abs <= umin) { - double pe = __llvm_libc::fputil::polyeval(x * x, 0.0, ATAN_K[1], ATAN_K[2], - ATAN_K[3], ATAN_K[4]); + double pe = LIBC_NAMESPACE::fputil::polyeval( + x * x, 0.0, ATAN_K[1], ATAN_K[2], ATAN_K[3], ATAN_K[4]); return fputil::multiply_add(pe, x, x); } if (x_abs >= umax) { double one_over_x_m = -1.0 / x; double one_over_x2 = one_over_x_m * one_over_x_m; - double pe = __llvm_libc::fputil::polyeval(one_over_x2, ATAN_K[0], ATAN_K[1], - ATAN_K[2], ATAN_K[3]); + double pe = LIBC_NAMESPACE::fputil::polyeval( + one_over_x2, ATAN_K[0], ATAN_K[1], ATAN_K[2], ATAN_K[3]); return fputil::multiply_add(pe, one_over_x_m, sign ? (-M_MATH_PI_2) : (M_MATH_PI_2)); } @@ -79,8 +79,8 @@ LIBC_INLINE double atan_eval(double x) { double v = (pos_x - near_x) / fputil::multiply_add(near_x, pos_x, 1.0); double v2 = v * v; - double pe = __llvm_libc::fputil::polyeval(v2, ATAN_K[0], ATAN_K[1], ATAN_K[2], - ATAN_K[3], ATAN_K[4]); + double pe = LIBC_NAMESPACE::fputil::polyeval(v2, ATAN_K[0], ATAN_K[1], + ATAN_K[2], ATAN_K[3], ATAN_K[4]); double result; if (one_over_x) result = M_MATH_PI_2 - fputil::multiply_add(pe, v, ATAN_T[val - 1]); @@ -107,6 +107,6 @@ LIBC_INLINE double asin_eval(double xsq) { return fputil::multiply_add(xsq, r2, r1); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_MATH_GENERIC_INV_TRIGF_UTILS_H diff --git a/libc/src/math/generic/ldexp.cpp b/libc/src/math/generic/ldexp.cpp index 775aa7be9404ea573b6a8c8eee27f7dfdd4fec8e..18aae09036409f04a30117a46f99bec44eef66b1 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 24450cc0ce51a254642a850393380810a382a288..37f88ab2da00c38d76bfd00d3783646ec6b70d96 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 df146cb51a23ccbb579d522a5781263283056263..8b29009fa1aa499224cad3432dbf6c9b68885a3c 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 66097f88e5abc83b39a56698d7511140a1d7c142..87755e83fececd4adee026e815fcabc869f871e0 100644 --- a/libc/src/math/generic/llrint.cpp +++ b/libc/src/math/generic/llrint.cpp @@ -10,7 +10,7 @@ #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(long long, llrint, (double x)) { return fputil::round_to_signed_integer_using_current_rounding_mode(x); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/llround.cpp b/libc/src/math/generic/llround.cpp index b3dfd2f8783e07a91f4d20785d2429a1e4ab386c..41bee8520ac2e1b4683226baee736c98d97a4f98 100644 --- a/libc/src/math/generic/llround.cpp +++ b/libc/src/math/generic/llround.cpp @@ -10,10 +10,10 @@ #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(long long, llround, (double x)) { return fputil::round_to_signed_integer(x); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/llroundf.cpp b/libc/src/math/generic/llroundf.cpp index 8784b0c0d69327f183d8f9a549aeb0f40f4b23fd..67105e8d1f6bc27a1d2af09557001fbc6f626a1d 100644 --- a/libc/src/math/generic/llroundf.cpp +++ b/libc/src/math/generic/llroundf.cpp @@ -10,10 +10,10 @@ #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(long long, llroundf, (float x)) { return fputil::round_to_signed_integer(x); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/llroundl.cpp b/libc/src/math/generic/llroundl.cpp index 30dec140e15598c2bac1ff732e86d2ffd4237371..98cfb3690659c839213979529ed20896904a519f 100644 --- a/libc/src/math/generic/llroundl.cpp +++ b/libc/src/math/generic/llroundl.cpp @@ -10,10 +10,10 @@ #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(long long, llroundl, (long double x)) { return fputil::round_to_signed_integer(x); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/log.cpp b/libc/src/math/generic/log.cpp index 54fe9704f1cf125b1dbecb2cc910855b8398c51e..46b64df689086d5423487ec27598b6b2ad64ff1c 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 b68ed5c6bc32eb059b8d6fa0ceba8ccc7364dc5d..38789acc441e5b56e9e9e150b846af9a65f3265e 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 812850aff1235fa4123c9e1461c531de12503d71..bc9af75169b14b4ece9d0d6fac0ba355685a8067 100644 --- a/libc/src/math/generic/log10f.cpp +++ b/libc/src/math/generic/log10f.cpp @@ -54,7 +54,7 @@ // Dept. of Comp. Sci., Rutgets U., Technical Report DCS-TR-758, Nov. 2021. // https://arxiv.org/pdf/2111.12852.pdf. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Lookup table for -log10(r) where r is defined in common_constants.cpp. static constexpr double LOG10_R[128] = { @@ -213,4 +213,4 @@ LLVM_LIBC_FUNCTION(float, log10f, (float x)) { return static_cast(r); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/log1p.cpp b/libc/src/math/generic/log1p.cpp index 26e314c0a98f04dcb3e6a512b89cb53d8a8d26ef..c6ee8d8f9bbfbb8ef5557c8f8a030d5d7ca0a28b 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 a7ca54887d59af6d0f24e50d9484844b0a705c40..d479130c5681aad38f25e305d18eca8c81777197 100644 --- a/libc/src/math/generic/log1pf.cpp +++ b/libc/src/math/generic/log1pf.cpp @@ -30,7 +30,7 @@ // generated with Sollya using the following command: // fpminimax(log(1 + x)/x, 7, [|D...|], [-2^-6; 2^-6]); -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { @@ -153,4 +153,4 @@ LLVM_LIBC_FUNCTION(float, log1pf, (float x)) { return static_cast(r); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/log2.cpp b/libc/src/math/generic/log2.cpp index 7ba239b00e3f83910e7fa73915cca5f9974b6649..d72b0931c14b81b678184c0a4e9fcb7e83712b49 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 c48b8c99bc70be149b2a226e5f0693c41b033908..cbb71fb91b1070558bdae5b39521a4ed4c8fb9c8 100644 --- a/libc/src/math/generic/log2f.cpp +++ b/libc/src/math/generic/log2f.cpp @@ -51,7 +51,7 @@ // Dept. of Comp. Sci., Rutgets U., Technical Report DCS-TR-758, Nov. 2021. // https://arxiv.org/pdf/2111.12852.pdf. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Lookup table for log2(f) = log2(1 + n*2^(-7)) where n = 0..127. static constexpr double LOG2_R[128] = { @@ -164,4 +164,4 @@ LLVM_LIBC_FUNCTION(float, log2f, (float x)) { return static_cast(r); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/log_range_reduction.h b/libc/src/math/generic/log_range_reduction.h index c4dd649cc57375d96241e4e05ab58117f503f059..f04012c1d583767689f9812d0dc5178c67bc99f8 100644 --- a/libc/src/math/generic/log_range_reduction.h +++ b/libc/src/math/generic/log_range_reduction.h @@ -13,7 +13,7 @@ #include "src/__support/FPUtil/dyadic_float.h" #include "src/__support/UInt128.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Struct to store -log*(r) for 4 range reduction steps. struct LogRR { @@ -87,6 +87,6 @@ log_range_reduction(double m_x, const LogRR &log_table, static_cast(vv4 >> 64)})); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_MATH_GENERIC_LOG_RANGE_REDUCTION_H diff --git a/libc/src/math/generic/logb.cpp b/libc/src/math/generic/logb.cpp index eef428aba8aba488ea04f96f9b6ef343c191fe70..8cd6edce05c23f14e9f10ac003dbe517a4359dc6 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 1b1241b2982dec4f6e3d1f7ddc3cb345c95cc9d2..78aa33ebbf4a9554801a85ca78a9f0007328c74a 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 7f4dc08ed536e00657d79dc335443b7836d9d3ae..f18c3727a3168a813199cfa1eca3b7cda329a233 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 73634e009c74e96a54b5437ffd02a008aca9cab6..1f689f25931d4e8a464906847779a29f007758e9 100644 --- a/libc/src/math/generic/logf.cpp +++ b/libc/src/math/generic/logf.cpp @@ -49,7 +49,7 @@ // USA, January 16-22, 2022. // https://people.cs.rutgers.edu/~sn349/papers/rlibmall-popl-2022.pdf -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(float, logf, (float x)) { constexpr double LOG_2 = 0x1.62e42fefa39efp-1; @@ -169,4 +169,4 @@ LLVM_LIBC_FUNCTION(float, logf, (float x)) { return static_cast(r); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/lrint.cpp b/libc/src/math/generic/lrint.cpp index 162fa03e419efb32aaf2f6352b0deecf1c9e890b..59fde7b5018d32e598ed074edca86dc29b21a82f 100644 --- a/libc/src/math/generic/lrint.cpp +++ b/libc/src/math/generic/lrint.cpp @@ -10,11 +10,11 @@ #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(long, lrint, (double x)) { return fputil::round_to_signed_integer_using_current_rounding_mode(x); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/lrintf.cpp b/libc/src/math/generic/lrintf.cpp index 6444ecc2c3469309b39aa43309458456b705c2a1..e92014c79bdc4416f50fc8eff3d61c03dc5a59a5 100644 --- a/libc/src/math/generic/lrintf.cpp +++ b/libc/src/math/generic/lrintf.cpp @@ -10,11 +10,11 @@ #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(long, lrintf, (float x)) { return fputil::round_to_signed_integer_using_current_rounding_mode(x); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/lrintl.cpp b/libc/src/math/generic/lrintl.cpp index 3fcd97cc6d19ffd5d6a7b80ddbec617543a3c7ad..b363aacb39bb3298f5ecbdaaa0a5268635a4c6c9 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 413c06ff736fa2bd1672a0a211fd4436b676e5c4..a22d8723bdbac29c5a5bfbc8994f9ca03fd597b0 100644 --- a/libc/src/math/generic/lround.cpp +++ b/libc/src/math/generic/lround.cpp @@ -10,10 +10,10 @@ #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(long, lround, (double x)) { return fputil::round_to_signed_integer(x); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/lroundf.cpp b/libc/src/math/generic/lroundf.cpp index 919ae35aa0065b6a514a593e012b9d67f896017f..40c1323fafd6233fe2ee1e8cbe0235a5c81a0809 100644 --- a/libc/src/math/generic/lroundf.cpp +++ b/libc/src/math/generic/lroundf.cpp @@ -10,10 +10,10 @@ #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(long, lroundf, (float x)) { return fputil::round_to_signed_integer(x); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/lroundl.cpp b/libc/src/math/generic/lroundl.cpp index 9ffa36e0c7a0b32deb1ee7f652a8e19de2440e16..c0c3bde4e285ab559b065d406e09fcb34a4dc903 100644 --- a/libc/src/math/generic/lroundl.cpp +++ b/libc/src/math/generic/lroundl.cpp @@ -10,10 +10,10 @@ #include "src/__support/FPUtil/NearestIntegerOperations.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(long, lroundl, (long double x)) { return fputil::round_to_signed_integer(x); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/math_utils.cpp b/libc/src/math/generic/math_utils.cpp index cc922f73fbb45a824386b71eb3440381ec04fb11..14bbb2babc60a7c6e6fa35e084c0c8be674e4377 100644 --- a/libc/src/math/generic/math_utils.cpp +++ b/libc/src/math/generic/math_utils.cpp @@ -8,7 +8,7 @@ #include "math_utils.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { constexpr float XFlowValues::OVERFLOW_VALUE = 0x1p97f; constexpr float XFlowValues::UNDERFLOW_VALUE = 0x1p-95f; @@ -18,4 +18,4 @@ constexpr double XFlowValues::OVERFLOW_VALUE = 0x1p769; constexpr double XFlowValues::UNDERFLOW_VALUE = 0x1p-767; constexpr double XFlowValues::MAY_UNDERFLOW_VALUE = 0x1.8p-538; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/math_utils.h b/libc/src/math/generic/math_utils.h index f286c9ce9faedd58189fbb22362a050d08f02b91..38a14a47e88fa531fba36a4428996c19c2d35c57 100644 --- a/libc/src/math/generic/math_utils.h +++ b/libc/src/math/generic/math_utils.h @@ -18,7 +18,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE uint32_t as_uint32_bits(float x) { return cpp::bit_cast(x); @@ -102,6 +102,6 @@ LIBC_INLINE constexpr float invalid(T x) { return isnan(x) ? y : with_errno(y, EDOM); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_MATH_GENERIC_MATH_UTILS_H diff --git a/libc/src/math/generic/modf.cpp b/libc/src/math/generic/modf.cpp index 2c4f051234c14ca4524682d501a142ba7a025cb7..d465d194cc64c4f9a482d1209972db309ed5b348 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 a979cffeb96901e6dad146e7c88aa5581653ef05..daa6697cb62da470ac758cf94443d1e0daa02015 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 535c31981f17a371b965c2156574a19534e69d02..3271da2953dbdc000ce23198b8a0bd597e557597 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 b1becee4dd094c16d81c23ad1a7f8e5abbc96421..20cbf6c0e701aa48e0cf6d4f1e316d2a55514485 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 1b0c2cc0aa62933af60d6744fa4860115af05e7f..5fb103388d262e7e7ef509176ce2890595f15255 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 75eb49e5692b0279de7aff94ec90f416549b7228..9cbff0169b9b184a33159201295b4fea2f07bcb5 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 3566cd6b45184528cceba9d81d37e22949a781c5..57a58b10be9116c8c7af8b1606fdd6bf585f5d04 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 07dabdcd0807fe793afa96c95abd6d20899b9eec..dd09fb7f900cf745e0bdc4a916d61a24efde0041 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 6e5c3698a24d133bd3eade54a966825ac016eeb4..e12ad040b5659db001e7755536fd6756c67fff3c 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 f620bcda0948f8f04de2efd6f7687b131f0c1f80..551f2457ecb8e330cbebad954ef573465af25255 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 79c076d265c67108bf51c59b293f0165eea4654d..13a7360b423328976f7eb38495cfc052b6561391 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 149f45874978d1cb567760d9c605913e4942c499..3703a32057751aadabd81bc227864b789eb1efa4 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 9de40b23dce4cde8cbc473d85a0197f7aa8a8f91..5e8c5e9996b690a144c8794c915355bb2e010a27 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 1360ae70137aae656d071821f2dcfd454a741767..def5d4b6fdb98a67cb883f14db712cd78048fcb9 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 905547cca0e1d6acaeccda01748a5a1ba53e3849..bd88742e5a5c29e9c9a6414043d5411090e08bf6 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 d4232db52b7ee198e9f346fc162f4f597cc513a4..b59606f6266fa4c62ed2c5a3fd4e9f6df5bc037c 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 3756a05a9ac036f59f3558b67e54c30ed7c4b473..7a08af36a475332b7c0242cfacfb110798b6f26e 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 9427b6ffce47807e92a0e70e24f974761ae71444..e3189ea48b5698642b613c7010a3582c601e98a5 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 8c2e9c9ba700c5dd6f61f09c40cd9186626869a4..259a46f3765372e07903bafff7da1fc18ca27727 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 493d825e0468ac92c4ae49f6403ee1f084ca9a2b..5110f238cb05ffbb3ac9894aa7a8a20ec77e6959 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 b7366f723236cf31faece7b347526843efa6e329..ca8f19f35f7fe3d7d4536ac01a743e14201def32 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 bcdd61ea304d6d495a5b8c57486298af61e27c8d..9627390ea8b8d83bc55ffe750e1b0929be0da3fa 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 6c59c271c5addb67c814fe15d3cba1da23c0ecdc..c734225844079b3765731840cb9507331c6c027a 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 faccf6c378d618f4e9ff9288526e10146289b40b..3908f5892f144fca47d9d8ce31be4db91153fb13 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 391da1f01cce244203f73fd51387def4cd0548d3..4a4fa86dcfd895fb27369a5be3021b80a89e94a7 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 9ef6f230f4101185f688e620a66a3b30067f8f25..681338ec01f078e429253bb42dc6fa1ab4c763a8 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 1611567eef9779ee923a33ff98c68ed48fd101c4..7ed1c4381078b1f2460d9106db3c26829e680203 100644 --- a/libc/src/math/generic/sincosf.cpp +++ b/libc/src/math/generic/sincosf.cpp @@ -18,7 +18,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Exceptional values static constexpr int N_EXCEPTS = 6; @@ -200,4 +200,4 @@ LLVM_LIBC_FUNCTION(void, sincosf, (float x, float *sinp, float *cosp)) { sin_y, -sin_k, fputil::multiply_add(cosm1_y, cos_k, cos_k))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/sincosf_utils.h b/libc/src/math/generic/sincosf_utils.h index 2488f50720896cad25cbe3943cd92cc2dcea34ae..904df4f4ed08e17c5a4ba8e342f7b28091124b2b 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 01d2f70e73568bb152e514b1aea56d2c8a3b115a..6fc1abb83e2e7b99686b80e5be3de659ba732a77 100644 --- a/libc/src/math/generic/sinf.cpp +++ b/libc/src/math/generic/sinf.cpp @@ -26,7 +26,7 @@ #include "range_reduction.h" #endif -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(float, sinf, (float x)) { using FPBits = typename fputil::FPBits; @@ -155,4 +155,4 @@ LLVM_LIBC_FUNCTION(float, sinf, (float x)) { sin_y, cos_k, fputil::multiply_add(cosm1_y, sin_k, sin_k))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/sinhf.cpp b/libc/src/math/generic/sinhf.cpp index 3ebfe6ba07009ea1d611d240afe1022998c538fb..4917b9980bc6618590242068d073546eb0003640 100644 --- a/libc/src/math/generic/sinhf.cpp +++ b/libc/src/math/generic/sinhf.cpp @@ -12,7 +12,7 @@ #include "src/__support/macros/optimization.h" // LIBC_UNLIKELY #include "src/math/generic/explogxf.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(float, sinhf, (float x)) { using FPBits = typename fputil::FPBits; @@ -74,4 +74,4 @@ LLVM_LIBC_FUNCTION(float, sinhf, (float x)) { return static_cast(exp_pm_eval(x)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/sqrt.cpp b/libc/src/math/generic/sqrt.cpp index de21f329e15abb552a799d00789888978eca0870..b4d02785dcb43f826211d69d234244acf6fbb720 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 3ca8d381898bbc2a87a6a912117f48b16e9704cd..bc74252295b3a583eca12b8120a56f6bdbff9dc9 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 970646a2e4d1a9bfdf2b4a7520c1a978702b1f27..b2aaa279f9c2a1654691c9b65344f1753988f220 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 681f16177fde519c2eedefff8ae8b13304953ac5..7909e9e5d5568a3ce2906dbb9ff7b5379abbbe95 100644 --- a/libc/src/math/generic/tanf.cpp +++ b/libc/src/math/generic/tanf.cpp @@ -20,7 +20,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Exceptional cases for tanf. constexpr size_t N_EXCEPTS = 6; @@ -139,4 +139,4 @@ LLVM_LIBC_FUNCTION(float, tanf, (float x)) { multiply_add(sin_y, -sin_k, multiply_add(cosm1_y, cos_k, cos_k))); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/tanhf.cpp b/libc/src/math/generic/tanhf.cpp index 1620e37040216775829f9bf288a8f9ba367542c7..7d9f86cf9044b237941896b150f16779aeee882b 100644 --- a/libc/src/math/generic/tanhf.cpp +++ b/libc/src/math/generic/tanhf.cpp @@ -15,7 +15,7 @@ #include "src/__support/macros/properties/cpu_features.h" #include "src/math/generic/explogxf.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // 2^6 * log2(e) constexpr double LOG2_E_EXP2_6 = ExpBase::LOG2_B * 2.0; @@ -118,4 +118,4 @@ LLVM_LIBC_FUNCTION(float, tanhf, (float x)) { return static_cast((r - mh) / (r + mh)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/math/generic/trunc.cpp b/libc/src/math/generic/trunc.cpp index 50220d9ebaf027af730c7df9a20ec4689d93d8ba..d171ab1f092fd59a70abe6b91c43e784202ec0fe 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 dc11d5eebf27cd77bd1b94f5a338798f5283ec04..93bfb7f2882a5e03a01e4c5b04c0d76284b38341 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 df5fc03af7e893546b0f3e861f3a30c07fcfe338..3429129183100beeb0c6346b5f0fb250a0fc519f 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 1e84f7acd6a31b94b9350e6398ea0502c3fa6961..ad1407d61f620a5824a59a24980346abab2e6f73 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 4979116d47f81b28e54f50fb6cf8bd423b380e7a..c4fc58d9360385fe44bb2a828bc8202fe909e891 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 b09c3e64cb5f14ba54e426df27bc5fb01efd7456..6f804bdb90a1f0988a942bce954e893568d9b01e 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 fe3f451c47a5901b0c096b3cda87f32682266894..4d7e132462ac902a659e652ae554f54b44666505 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 d8b0a54867bf3f0db52d267293cde042b0f95658..c0d063d50ae53d6c1103997818703115b98a7629 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 64d7058eaa485e03b761bf33d79eef148f67fb11..398ffd0c74c074cdf31caa64397aafa3b0286115 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 850c4ee6592ceb60742b9d62bcc256167410f7a7..eada89c178d75c1e27f8293d0d85807e9445a9d2 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 22c8b731068d9d09723cb5bd2f69af82eedc0dd7..a5611c515a88d42931880a93b30c094f19dc6173 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 f3803af1ceb0bec294f066689e5eb2e4e9605fa0..41a6ddf60dbc35975ec6415ec7c5163243734695 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 48b52a84537e2308d911ddd034326afd10a40e80..c948e32f77eb92ac1379c0350fd0b3184f4951e7 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 f3c255f61c09ee469b6c77c07b85f1fa59376b98..a2c35371d12b6abcd569b8418fd01418a733a52c 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 f540b4c8a11c15cbe99007004160722dd1f2ccd4..67178b3e2735750e48b89ae7ac02d2a12831bc04 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 d6e9859d7810efa6cfbeae27291a6931c0b7520b..7303adcd347ee9177f4cce16ee04d7e2ade155c8 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 67b1862cdd4fd9205cc9af5355cb2057e0bee65f..bbf0c677b5e3ae4af41fde802bc52edb5d3eab5b 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 2ae5142722671ae58658a68246e8e09ee9f91fd8..0654cdd2abe08165fad8103e23eaeb530018e66d 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 ad1db4906e3bc8228e2efb0a5dc7d4efda0b7dcb..b689046468fbe508c9e4e13b55d1ceb96ba9caa8 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 b6b06da2dac0bb4e5c69ab54037bbd0659cf7a34..07dbbd6059c35f33ac0827e5b83b1847838d9e08 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 b89c9c3b1c7d44e1f13c7e5b8c52acb4babde5a8..ad35f9006b5122408030dd490147b13a39780876 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 35a4a8d5d7e9885d52333b27a817a88eba0ff0a8..9c7b600df7082e6c2b5ff5985b5fc9993a4a85ab 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 e732b7c198f224c47388bfb7f60da2beaa717364..7fbe9f4f0e0bee83f8bd0236dc04ebc4638c87f9 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 af06432d3b911b40c187933c16bc4137f7a0dcee..89b235f9c22af3230f87ad53f904a3a2112eb8f8 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 b0f9c8f88416378377184cc88728aff0faaba558..9fee6f856dc8b7ee508bbe73ee04fad8c0f9b833 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 e21b469c4ee2b6800669332898a9b999bc81378c..44d494a8ed57afbd7f0a72f07cbccb31cc8196e9 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 5e828372a503619595aa618dad0352b61aec83d3..daf98d94360511f44011b55cc913ebf39b4a9a12 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 ab840ba605a28395fe33773078da1dd2326ec454..9d8b5582f0407a356b72d88d028a342964935c39 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 32d54b83746c12903ab1a431fb8ac994c4c49cfe..8743e4eb7fb8d793c9d7f61f9b618ba798630dc6 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 2946e4781ae6c70f2b8c358a405e19e9316d0462..054e046f2abd3b8e7e32acdef204e160cf186f91 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 729f3bb49d3fccca18ebb414f500e2aa31e2b3a6..ed69dffe3ea831d20a0d10e834d6970e7bb047aa 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 fe814c764b878cdd680f2dddc4acfb89e6366fd8..60ca5af4987b6c4c03e6abf0478352ed6b5ca5fd 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 a712e455443471b69ca34995806445f4ce74a87c..e17f942a4d5fcf6595432074da8c06ce35a41c6b 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 81f04a2b857b62735e01135f40dc05ee26dbeae3..d02b1063561246d1ea363a8f9f277a7833120977 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 32af444959a06f4803911bfcb6aedcbe071f20c1..da7bd54ab08ae3026d0e9c1dc71cfa48b2385f46 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 c5872580988621ed7be7bcbf03b71a9639a9e72e..778e883acba04487c615cb1eea45aadd08e84b5b 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 dd97af97213328e9e317eda5816ccfe090a575b8..be666fd9f8740c349ce90a05533bd66a7899e669 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 b4708245d4959711e92df019d529e1a1ffd33917..773600f0f2501152a5fd4f43ad8e185918f59f83 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 352733d50a70995c64a73420f8c40da105e00652..534797a3e5860cad1a7a30b82151a0737f3508d2 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 7ae0811a3c3b5f66c8e31889a0c5301b936b470a..ac629761a4398ad18585eb3b46ac25b4ebff7956 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 fa0dd58cde51de55af245a8eda1c1bde0e423553..a0384f89eed3a65fdbd3a8d9f09f4138a1f95b26 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 7755174e445b22224e31cedd29d2d0f60d94781d..280ae49989f94463e886b88a358f0ac68a438cc0 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 7219d5a7dfa6d73f0cce536aa63568e336f3857c..b07c079682580a449d2df7c293e4f51bce2ae103 100644 --- a/libc/src/math/gpu/vendor/amdgpu/declarations.h +++ b/libc/src/math/gpu/vendor/amdgpu/declarations.h @@ -11,7 +11,7 @@ #include "src/__support/GPU/utils.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { extern "C" { float __ocml_acos_f32(float); @@ -58,6 +58,6 @@ float __ocml_remquo_f32(float, float, gpu::Private *); double __ocml_remquo_f64(double, double, gpu::Private *); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_MATH_GPU_AMDGPU_DECLARATIONS_H diff --git a/libc/src/math/gpu/vendor/amdgpu/platform.h b/libc/src/math/gpu/vendor/amdgpu/platform.h index 6ec47c24a93a2d702395b562777a09c7631d6e22..480a46bf14dfd889001fa5e8172e1bb4a892f22e 100644 --- a/libc/src/math/gpu/vendor/amdgpu/platform.h +++ b/libc/src/math/gpu/vendor/amdgpu/platform.h @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // The ROCm device library uses control globals to alter codegen for the // different targets. To avoid needing to link them in manually we simply @@ -109,6 +109,6 @@ extern const uint32_t __oclc_ISA_version = 11501; #endif } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_MATH_GPU_AMDGPU_PLATFORM_H diff --git a/libc/src/math/gpu/vendor/asinf.cpp b/libc/src/math/gpu/vendor/asinf.cpp index 9a9ffb23a7cbee3301a42eb55ee97f0b791ae0a9..595a48f82744d573d53671d756e346839131e49a 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 7d1d7e8709e11079d84bcf2686a50025ab3e4000..78e5543cf36656b3f51203303495630a68eadfd0 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 7193d8cb2a37349d2e3b0ff38500813238d08dbd..132c43d9e3af7ca8f480c4e0c1881ee8f166fa58 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 b044a735f8777d3087986693a43702e6da12ff25..521c4133243d9815d5e4068706584e103fde2467 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 a3e2d65b8f98c466f163006be9461d59ed7208fb..37c7507911ec2e32bca41af5fd32b0d9c74f3a07 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 3ce8fa6361d6eb82823ac2062ecae468588b2ef9..1bd42ba37e92d9ba06efdceca2e3706d3c86cc3d 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 3dc5c2b10cbcadb3936a9632e7ef91f630893928..3be05e58b51d96fc62271c0354f4e6a27ecfd928 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 c2933ecff94257cee7ef23584074c7bbff9761fd..1b945bbd7c47e490f753905b7d08540ee3fbe247 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 05b753583cd7da05e6998167e3ab189536d2b356..844809355087b4d4a33d258ce500bf8b26242611 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 818c3801b9f11bc9453265567c56cefe167b61dd..cb61557383dfa7c98ee827325a82e8bb369efc6b 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 e243385e43fd8e29d3bcfdc5887268f939bb58ca..89c194e4bc291ea07f1f111df69e6792060db0a8 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 062e4a760c7c3a488beec7347554d24c051e7ee1..c5497797dbe1b3e0001b902be64a01cfed626032 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 b06787cb0865c18abe556544d881ce917137b7fc..f30dafb46e5488317064c8b625e482847b52c9b0 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 a675d484238c569700d12c88fb99ef3bfdfaa3b7..e30736206a9a929f59c6ed45b6d1eff3ae3298f0 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 4bd47fa2810232a57c547f33e7ccdb9398486259..5fc2c1409c6e933a5d02b26d99d135764e7bad62 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 c6d398007cad4b7a80c450b13393d3cbaf5cd619..e928d375e03db33fdd3991745619a796744de413 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 5bac6fc76f8ddfceab4a313ccf85db9af44aeab1..45b629e3e2858581c518cfb169fccaca9867544c 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 34ce290e37fd9a4a5623771c6c3e865cc2d2c49c..533e9dcb8dbfb0fb99555c207199bbe4266e88c4 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 ea41099c35c0e01eb61e0325004dbccbaa3c34cc..1d075027b41c057b446831aeae1dfb1bb0d07dc2 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 e15f4e198c8d7f9f8b32f80ce813c38e1a00bc61..8dc2ff0a374af22d02a97e218d0d517571faffff 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 d9988fac0a45dc9c07187a287b79a36ff8d8c60d..f760a42563305bf24c1465c1420609c395d4c426 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 bdd40a6a217c34841dac590bd3af84dc40adcf96..d00d39115ffc334aa36f0e8a929bc2775f3dc9d3 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 064d2775460edc1f7452321c22bf55b526c0662a..aafd1609002b2b94f02088c412d6f068cf97ec8d 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 d1befb67c9788b0a85878ca147b43a355b3e3e54..39cd3ad0c021a5535ed336378ab696a5fc3adc79 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 51b8370759e9805de8f86f19aed77769ad1941df..e53701bda75cf45aa5b28f2e061ceff36625c884 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 0131d278020029ac4b8b7f0245339160b47684ae..ddb5ec00a036f558f314b41ef38f582141969d09 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 9e8e57e8a26f37fe1f1301749a5f34a86065735c..f88e17f10908426aad488bd86cffcf259b6eefe3 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 9780471e071c6bd857d2fb8309a79ada8991a2f3..7a39dc8fc814eae3555036d136bad006d9785451 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 8b6702834a04cf4923fd675993ce25a8c3558fe4..003a9a8a5dfa55d121eed4d850d823546fc035ab 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 6ea1743cf7a6f3ee725d346958950957f897ff70..4298d56db6a027c1ac16f49179583620b21c4a7b 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 7945bc096e6656a32cc9e833ea32eb344438c1c3..d49f2610a6919dbd2d83e37e9903ed707761d862 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 2fd2dcda6e465e7a2af1850c21b4116aee7bfa77..37e02d252b74fd7ceb7d57b8c1c2e1d01bafbceb 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 755efeaba530ba0a7425ff2a205f2ce6b9f8f34a..e92c9b3c2a6e3b6b616ff624b7b24ea67b0c538d 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 c2be2cd87aad6c60e4b6442a705bc3ae953d134a..b234885aa88c03a0cc1d8796b97062fa9c983f79 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 44aa286166cbf589a7ae91b4feb8374ef9506645..435533a90501b7c908cec16e53208355aaa4c6f6 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 6d02f8617201ac6b09ad0e22270a1b81fe2d98c8..0a4844c8a433efebd07064ae63658c220f1f2158 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 4eda066b60f53ca2bc3b602739d2719d2b89ab79..96e07c99b71a33437b503a0b727dad4f5948f09a 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 589d65fdc61d269e060d59ee24f48ddc92ac3354..d882157b0bc8d7f1e4ce575a1d9f9a9cd5c6bdfe 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 bf3593bef7e5012f5b738793d1bee24a65cdd256..17892ceb107da57908f77d499ffc29224cfdf8d3 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 4be642cbd0bc4e840f39aa3a61d6d5cf195ec0a9..af93227ab63bb946f28e35fce83908048ec35cc5 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 c65cb5536f125a6bd188a090f015cbca82c5568e..be6b3ae2e2fa0bd577d8c0663d911cb0cc33ea2c 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 4d1fcbb530a90336e9a7b82604e5bd51aee9af3e..99c399b62b7f6d2765f3fa5bbec2321ad80e9066 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 16587dc26c0c0cec1918da8c06562420e12cd34f..9a1bd9c89fcf0a3f17f38203c61a2fd65bff2d61 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 99b3363902930394e4ee94ed740829ec992480ab..a5266a8c154c5b5038dd6ed332be1cb8dd7d713d 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 de38d15849239373db52579b8a1d6137694b746c..57d764f1f2a0ddf403eb67c8844ad32ef1d1b343 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 a673a49de528649ed083e2f8457e2478553f25bb..1c9c2f3843a9536c237d504c9476ed4edbe16bab 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 6c901ee8f4c0c224ffb074d4d4eefd8fc18869d6..981473f9e8d5b0af968e1cd1c7a5c8d74e039c4e 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 084fd7f3ef814372dc9418f8e9ef870853c8160c..1d290b421f1515af4361ce44887ecd0c97d4cf89 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 96672077865a9a8b2b45e7d929346dd1a1e240cc..e851a6a4c4d5587abb23b8c3f83b431f937c1b8f 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 1afb76a107c1cdada2afabe8b92cf69b4e25f03f..edea34618ac0252891297bb4046a1e420aa99593 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 4d1cc1995341b8f6f5aa0f8f41ac67ddc6491933..1b4782f3445cad6119277857bd91d5104e5b7ba5 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 74f9a600666faf4ceec5b611641ba1a5c5d2f6c4..7a8bcc34bf5815e2104754fa14742bd5ac1a8c2e 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 f30d60155f1fd94e65b3f668b36d2c8e96859db0..c06b487171cd299401ca30683e1bf5ae69615d67 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 3ee9c045e171395b26be40dd523f520d333c848f..f2df0c86cad2234e67d020520ad988817fe74dad 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 96bd7b8cc9e1c972713caa81de5890748ad8d5ed..69c881ea844f9f93daf43905f0fd1e9d487845a9 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 eecf380f5e94dc08eeab84b05c4891a876a64323..023e84aa050920715fa2fe1bf7c83752f68f0e12 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 94dfba7080aa99e8d96f52ad9efc7fffdb04d69a..4dbcc60589812d07d6ad26c69282e29006c1a50a 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 5b2b7fc96df8715a8b029ea2883c40e0605cca5d..265b4fd92e0e8f9b56c167436533fd4ac8c03041 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 65faad1e07a6147e420496eee415f2ef8e403416..2141ca91da46bb7dc0bf4987967669a9de1fecc0 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 f859485a730bd90cd78daa760125a3182ec07fc3..9cb4251f72fe55980b098ebc1ef564fe1883095a 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 eff98b42ff5b8bda029946187885a3c83b70ddb2..67f5d7f89279b74b2bb46be598d619a1ac09c7ab 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 d86694136aff85f9e3e8c1764b08aff6235a7ea0..3d8249aaee2d66e9b2526fd7d9da3f2d39ae597a 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 d544ab5a55daad46e75894716b9ab719cfcbf238..ca3eadc8866b105b9494e1baefa4791fb3698f7c 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 0f25ce6167545affed46a00a799bbf0001c24783..48eb9ca885265b4635164127e02d5d3026ef7b39 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 ea00377f8e2adccf0411904660361a32156a8800..854f76fce9f758a75c719595279b34fe169a9621 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 f55ffedd15407522926c1cc5b5b83eae06a11da4..49f05493cf166bef344a46ec297268007a100312 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 94d2c543c908664e005315a4452d975283adb443..04b7743edc0aabcd8951d0d41fe246533f27292b 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 b875dcd702babe36fc1dc72252af2d3597b6f9d7..e24dd4320de659b3398acf7730190dc55fbd816d 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 46dcd3c91d628cd97df9004bfdc6f08d162e3191..e8d50180562864bdae739a162de201a6c4d6136a 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 3630e52c92d298c9d64ff91c14fadad2be64cf6a..bc32993a4bdc2a2a140ac20c2c2581f24388532e 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 195580190ba319df3756f0c4300d72e260c559f3..b69be468ab4552987a25d4e4ccf48d21ffa98201 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 62df79a1de2302b68ac5fce6ac4fa4b0ce8f2c91..e40f860f1a35e48e411a2dbe61bdc80074c3d0c5 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 af5159437532b2deab448f7af7d3d3d4c4d18e8e..93b2c8cd265dfe6573b429b227f1e4bf6284d66f 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 812acecadafadf416f85c21913f3022ee681ff00..c17901d220d189ce502b7376ffe72736ef9abbdb 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 8c555e816c8ba17889628e71c7efa7fe93c67ffa..4a67cc9693ba7c25cbf040f43b1524d514b52e77 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 3d318a7a2faba3349a6ebaf13c9ddb2c0aeced2d..9d4f4e82b7894680f701a61e4c6f99ad5d4f2ebf 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 a8b5aff0fcf386f0e87b9c3669395a1d47945a4f..86673dc597fd3035030c8ce94d39fc687dfd0e74 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 1dc732f6e89abad5b7b11ee0c410ab384d898201..91453a01f02fc5da0a6274bdb42c8561c62d91e5 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 21457e0d2e81aa886afea6ea6cf76bff9ba52607..85bf2aacbc17c271019c2e768e53e62500e86f47 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 ff89239c4bfde555b33377d8df99895f249e64ef..5ea2c6d98c0afbd5872543051142a50197bc683f 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 957a06b9792144e67306200b15b1bc0f4056812f..df292a252583f3ee1b99fe029c773c9d226bfbb2 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 3793f6bc1b881bbe93119f0926082fa6ec0483d7..3860dc03bcf58f8e8ddbb6c8171dc0c7dfc28d06 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 7029e86a52114c437b3e948b8f70682ec9048d82..e22cae6386e690cfb4311a35945c3300d734dff1 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 1f6d24de5f2e0b297b9df07112e441547d4ef6df..fc4c9eb182aa4c1d7b3e3e6938c0b89d7154c1f9 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 8afac0e5f6a03386cf76b5f1fe03067e445b739f..de7870df5d7669fc52909fd2446f26a2d9da58f0 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 912877867dc215903d7fdb6948a93ad67082702b..1b94e242c776e55ae75e677334fbaf9c1eb955e6 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 26fed175787a92e413929b0a9cacb12aece46cbe..dd9b4a6556837ccb28a9062bcdda3e899e39016f 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 ec2d67b8fd639b2e816fbb3c22a5b5c294431981..6582dc335d61304f550e854e3286974c2a4f659b 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 8a720fc23b6be7e500c7d0dafb14ec048c47e600..f1f89542013d70448085cbd9aa3c20bfaa324f8e 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 19a16d08a94d39f7c1d1804157e561d7aae52a72..31a9bbe86b56c3566eaedfc0ab448735e647b610 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 f2837635ab77c734d2c019d7aaa049047f9cce15..584af37f5f37c6bc6f8e883594981cb189ec02df 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 cb753fee6ea0d20bf411f17738765da819136925..7590e7df5ddb8b6a5178d88fb5217a6ae1716429 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 feb2e4f5e0dd5508e4426b073fe6f6598e92181a..8b8e8772706fdbba186714a650a3e673e21f86d2 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 d1b0e20fcc865957e163eefb7d37b626866bcc24..ba9b09929cc2f79fd4dab96c36aa3e203ffa0717 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 e4910ad95a81c2eacfe5d0677c5099574721d85a..3cd676bfb724e3ed2cec33d9e5ada2ad99024a9f 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 0091ba3a8cd006b775c572a2e6e4bd8193329593..d0246a32cdd30fca096b2635929de78f7f749c1f 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 2bf095de76f88d6167f4d591f4078d81b2ac5742..bddfa183f7ae70de79356603234da1c77582df2a 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 bb09ea4a77c53acaa878068d1257b705970bca8a..3e6a3b34c9a46eafaa575505a167e3fc3d86685e 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 6bab35adf781a0a463b8c64c0bc49b69cce6fddb..d6ca186ed16e1b9a3939564df4f847aa0ba74ced 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 43fb63e231de45a452e98c06a6d33ac13f7618f3..0abe87a055061caf8068f7ea37d370df665a5b08 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 e24f29e4d466e93b9f9baa4141d42265fd839292..9fc1dc4d93fbd26dd488ef86c094eb9dd5887be9 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 f5316eed29261905ed6acb4cbada7a365e0e36ea..6b5a5f9cab7f06a972475794dd1d37f3e235cdf8 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 6839a75072cd6048f74bad0095cfa35e96f9b955..876f147dde4f3c9e58b4adeaced52b589afd9303 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 f3919c46df603ab2b42d1bb2ea1baec8b05680fd..50ecdc74fb2d942e8e26a802585f13bb8dc24a6a 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 47ef983f4385ff523a64093ae4736d3f4bfea673..56539f52ce0e6c09190f77678a11ed1a68ce3819 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 e63db04c51b5dfc1a8351a71fad3b70094eb7a50..aa0b753e74ae33840ff23682c74307c5dd142512 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 2784ca261e4aa1940b7a7b8f41864669923da7fc..bf1b1f1d815c171371999548d1330d959cabb065 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 843ecec9fbfc9d100f5f0e9de633d30bb2567dee..65cb39f9e3926485b5b535d882f3b6b4eb878f68 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 2390e07b5dce57f566f6425726d39c4cedb561aa..d003e3f0964de20fe22f58c07c7d2cfa048aa22c 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 d1d06f3adfa8e64bb842b1cc8c072f330d5b0de7..fe4192a550386847af0fd91d9b7bf9a3a22cc946 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 5fbfa14507147a0d247296aa7279bb30addd2f1b..e632c1925ddc2bc7e8119f11dd9bd5be9134d462 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 05366db52ff8771697dd5d4d804a44faf79464c9..5d0121f158f11b940a758c6113a8d291d5655029 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 7a9fa01f4c2962bc71a745c73a68abd1e5f8a8bf..e0f06a8ba64cf4b3357626bb5bb8465cd3675005 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 5400c3d2328ebb31aea2160cf1e5ac77e5d5aef8..66561eef403dd8a3825143a8bde9bdc94d203506 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 ec5ba8001094d9dc6cb5e858d811b66e99b8ad2e..ff9d02efaffb7221733eb06cb275e36eab8cec0c 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 f7fed01f30d25bcad2019c9d5611127745993ea9..d766aff923dc9e02e018d1e8a8a14994b62520dd 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 b4f1cd7ea72f623dab2dc7e7e3aec1755070a7ff..e666d778154a3d878b7326f342c4c8fca350f774 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 2a78ffaa3c5ef70ed8539790ad6e19319a155f9f..38f414f65fcc0927c6d7f09b195585411fdce439 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 1d2480e3df147e837eb8dee19d9e7f7f8805583d..2cb8db4b7a859d2cf86bd4445f456997c5632c90 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 bda4acbe4122381a51719f29457836b1d177c50a..2c7b8aa6e8c836b09f0eda0ddf9a99a34c011682 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 f25ff77095c88b1b44619ee7f39dbb4f82668f0b..bc0e0fc7d1ffa35245a79fcdad4ce4b8c4df2804 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 983fcadd7dae304323d9ecea0b547c9044478ec0..862d5e3a0bc41d6d48457a4a18614d8d1723bbff 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 eab56482150e4a50ef6068ac8b681dc252895d53..c7743dfad7ba38a79f89628bfeca6421e4a2444e 100644 --- a/libc/src/network/htonl.h +++ b/libc/src/network/htonl.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { uint32_t htonl(uint32_t hostlong); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_NETWORK_HTONL_H diff --git a/libc/src/network/htons.cpp b/libc/src/network/htons.cpp index 1d2c6bf2f8836e3a676cad6b662c610345cc6843..e844454d5687f1561f1b8c094971c8a091a54fc7 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 a3abaf6ec6df7f6367132ca9d81af113d7b3c2e3..e0a379f94e5267af9d89c1b68e29cc9e0c26ed6d 100644 --- a/libc/src/network/htons.h +++ b/libc/src/network/htons.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { uint16_t htons(uint16_t hostshort); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_NETWORK_HTONS_H diff --git a/libc/src/network/ntohl.cpp b/libc/src/network/ntohl.cpp index c525f722ec5b381be55f48fc811b9de1266a5426..c00f4a5ae09c9d8e1bfccce21fa006f2d0c202d3 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 bec626f5e4cec0c6698fdc30595c5cff7825a339..2fc4ef059c587824f7b6fccc6b0f26a0c18f713b 100644 --- a/libc/src/network/ntohl.h +++ b/libc/src/network/ntohl.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { uint32_t ntohl(uint32_t netlong); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_NETWORK_NTOHL_H diff --git a/libc/src/network/ntohs.cpp b/libc/src/network/ntohs.cpp index 8556b3e28cdc35c6fa02d51991cebe47cb7c75bb..572b6860fa6b9f4439756a528b55bf56436d0c92 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 b10aaa9c8891b06cedc0920e18f9556ae4400c27..a84c52eeb9c2fad9ac2120e87b02bde57eea9c5d 100644 --- a/libc/src/network/ntohs.h +++ b/libc/src/network/ntohs.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { uint16_t ntohs(uint16_t netshort); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_NETWORK_NTOHS_H diff --git a/libc/src/pthread/pthread_atfork.cpp b/libc/src/pthread/pthread_atfork.cpp index 7136bf35816cbff16f280932a9b78c087fe46fd7..57191b8534771f1842ba88facb2cd316fd04e875 100644 --- a/libc/src/pthread/pthread_atfork.cpp +++ b/libc/src/pthread/pthread_atfork.cpp @@ -14,7 +14,7 @@ #include #include // For pthread_* type definitions. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_atfork, (__atfork_callback_t prepare, __atfork_callback_t parent, @@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(int, pthread_atfork, return register_atfork_callbacks(prepare, parent, child) ? 0 : ENOMEM; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_atfork.h b/libc/src/pthread/pthread_atfork.h index bd8bc8a35ef035edc266edba666f026a1de627c3..8b89d6895647b1042ddc3881d427417325244029 100644 --- a/libc/src/pthread/pthread_atfork.h +++ b/libc/src/pthread/pthread_atfork.h @@ -11,11 +11,11 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_atfork(__atfork_callback_t prepare, __atfork_callback_t parent, __atfork_callback_t child); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATFORK_H diff --git a/libc/src/pthread/pthread_attr_destroy.cpp b/libc/src/pthread/pthread_attr_destroy.cpp index f51b056ad030d0aa2bccc958344e83b5402ce0ed..a5bde84256fc63fec42f687fbd95ecc18acc0c76 100644 --- a/libc/src/pthread/pthread_attr_destroy.cpp +++ b/libc/src/pthread/pthread_attr_destroy.cpp @@ -12,11 +12,11 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_attr_destroy, (pthread_attr_t *)) { // There is nothing to cleanup. return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_attr_destroy.h b/libc/src/pthread/pthread_attr_destroy.h index 5d01bc8d782d6743e4cbf3535ae2d7044f49b562..532a0f45f7cd591d24cd74b473211bcccc5e9a51 100644 --- a/libc/src/pthread/pthread_attr_destroy.h +++ b/libc/src/pthread/pthread_attr_destroy.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_attr_destroy(pthread_attr_t *attr); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATTR_DESTROY_H diff --git a/libc/src/pthread/pthread_attr_getdetachstate.cpp b/libc/src/pthread/pthread_attr_getdetachstate.cpp index 18f4637e1c8fec2879277edab8a1acd9aa6f51d8..4bff85d45c17cc450c1c084eff66515427b98822 100644 --- a/libc/src/pthread/pthread_attr_getdetachstate.cpp +++ b/libc/src/pthread/pthread_attr_getdetachstate.cpp @@ -12,7 +12,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_attr_getdetachstate, (const pthread_attr_t *attr, int *detachstate)) { @@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(int, pthread_attr_getdetachstate, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_attr_getdetachstate.h b/libc/src/pthread/pthread_attr_getdetachstate.h index fd5ee886daebde142025d6bcc491d794f7009e0d..57a47b73bd50be80b121c26520beaff6e89f0a87 100644 --- a/libc/src/pthread/pthread_attr_getdetachstate.h +++ b/libc/src/pthread/pthread_attr_getdetachstate.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detach_state); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATTR_GETDETACHSTATE_H diff --git a/libc/src/pthread/pthread_attr_getguardsize.cpp b/libc/src/pthread/pthread_attr_getguardsize.cpp index 79d80feed713ee055d9756fd1438c819f70f8a95..8f28db8d9c96c329566c5e873e7b95f55006bb42 100644 --- a/libc/src/pthread/pthread_attr_getguardsize.cpp +++ b/libc/src/pthread/pthread_attr_getguardsize.cpp @@ -12,7 +12,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_attr_getguardsize, (const pthread_attr_t *__restrict attr, @@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(int, pthread_attr_getguardsize, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_attr_getguardsize.h b/libc/src/pthread/pthread_attr_getguardsize.h index 61072b9350fe9a9ccd5a8e4c764cb6c19aa07c5a..ef2e75828f9e2c0276f4c101372a8943fb0cd861 100644 --- a/libc/src/pthread/pthread_attr_getguardsize.h +++ b/libc/src/pthread/pthread_attr_getguardsize.h @@ -11,11 +11,11 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_attr_getguardsize(const pthread_attr_t *__restrict attr, size_t *__restrict guardsize); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATTR_GETGUARDSIZE_H diff --git a/libc/src/pthread/pthread_attr_getstack.cpp b/libc/src/pthread/pthread_attr_getstack.cpp index 564b8fde52f84c5f125e72171b04e8eb2e3f71ad..8788fbc1ffdd33b9d22bd7554322f565bf467cfe 100644 --- a/libc/src/pthread/pthread_attr_getstack.cpp +++ b/libc/src/pthread/pthread_attr_getstack.cpp @@ -14,17 +14,17 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_attr_getstack, (const pthread_attr_t *__restrict attr, void **__restrict stack, size_t *__restrict stacksize)) { // As of writing this `pthread_attr_getstacksize` can never fail. - int result = __llvm_libc::pthread_attr_getstacksize(attr, stacksize); + int result = LIBC_NAMESPACE::pthread_attr_getstacksize(attr, stacksize); if (LIBC_UNLIKELY(result != 0)) return result; *stack = attr->__stack; return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_attr_getstack.h b/libc/src/pthread/pthread_attr_getstack.h index d0164738349b53fae5fc9058b00bcd16e60b752a..22ac24a89e42243aaa3d296681e9bd3b2756cf90 100644 --- a/libc/src/pthread/pthread_attr_getstack.h +++ b/libc/src/pthread/pthread_attr_getstack.h @@ -11,12 +11,12 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_attr_getstack(const pthread_attr_t *__restrict attr, void **__restrict stack, size_t *__restrict stacksize); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATTR_GETSTACK_H diff --git a/libc/src/pthread/pthread_attr_getstacksize.cpp b/libc/src/pthread/pthread_attr_getstacksize.cpp index 2b33d6fc8a447e243d00a1e530659e69fa9d9e0f..ecc4787951dfa1c4d7538c433699784d22ded255 100644 --- a/libc/src/pthread/pthread_attr_getstacksize.cpp +++ b/libc/src/pthread/pthread_attr_getstacksize.cpp @@ -12,7 +12,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_attr_getstacksize, (const pthread_attr_t *__restrict attr, @@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(int, pthread_attr_getstacksize, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_attr_getstacksize.h b/libc/src/pthread/pthread_attr_getstacksize.h index cb27a5e1927ecb9b65ed830e68c2f648d9fe317b..3136f08ffb71163a5192c5a6430a1fd082403a5a 100644 --- a/libc/src/pthread/pthread_attr_getstacksize.h +++ b/libc/src/pthread/pthread_attr_getstacksize.h @@ -11,11 +11,11 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_attr_getstacksize(const pthread_attr_t *__restrict attr, size_t *__restrict stacksize); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATTR_GETSTACKSIZE_H diff --git a/libc/src/pthread/pthread_attr_init.cpp b/libc/src/pthread/pthread_attr_init.cpp index 32e54efce34ab2cab4159e1012af5923e6aad88f..13d302c18f98a711fc0549d4c4275629ae757ed7 100644 --- a/libc/src/pthread/pthread_attr_init.cpp +++ b/libc/src/pthread/pthread_attr_init.cpp @@ -13,7 +13,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_attr_init, (pthread_attr_t * attr)) { *attr = pthread_attr_t{ @@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, pthread_attr_init, (pthread_attr_t * attr)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_attr_init.h b/libc/src/pthread/pthread_attr_init.h index 609e65381db7d8cbef5ae55a78504c5f85f0c9b1..3a2ad3d2b8b81122664b8cec64b4a13b86110e1a 100644 --- a/libc/src/pthread/pthread_attr_init.h +++ b/libc/src/pthread/pthread_attr_init.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_attr_init(pthread_attr_t *attr); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATTR_INIT_H diff --git a/libc/src/pthread/pthread_attr_setdetachstate.cpp b/libc/src/pthread/pthread_attr_setdetachstate.cpp index e136538e054fc3cc70d21865292cd18762ef0def..029b4d514ef43dcc3c8ee03d669dd5697da5673c 100644 --- a/libc/src/pthread/pthread_attr_setdetachstate.cpp +++ b/libc/src/pthread/pthread_attr_setdetachstate.cpp @@ -13,7 +13,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_attr_setdetachstate, (pthread_attr_t * attr, int detachstate)) { @@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, pthread_attr_setdetachstate, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_attr_setdetachstate.h b/libc/src/pthread/pthread_attr_setdetachstate.h index a8f586619f53e6b1eeb290c416414688424d2d0b..2b994d9e99d30749b543e23fb8a66288a8c51547 100644 --- a/libc/src/pthread/pthread_attr_setdetachstate.h +++ b/libc/src/pthread/pthread_attr_setdetachstate.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_attr_setdetachstate(pthread_attr_t *attr, int detach_state); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATTR_SETDETACHSTATE_H diff --git a/libc/src/pthread/pthread_attr_setguardsize.cpp b/libc/src/pthread/pthread_attr_setguardsize.cpp index dd2584a552920c703784de37465759fd409e607d..98855b20cb0fb324a512c42af0c85e591834fac5 100644 --- a/libc/src/pthread/pthread_attr_setguardsize.cpp +++ b/libc/src/pthread/pthread_attr_setguardsize.cpp @@ -14,7 +14,7 @@ #include // For EXEC_PAGESIZE. #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_attr_setguardsize, (pthread_attr_t *__restrict attr, size_t guardsize)) { @@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, pthread_attr_setguardsize, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_attr_setguardsize.h b/libc/src/pthread/pthread_attr_setguardsize.h index d9e159874f262eda006d5491ffa23c9ec9bfd791..64d896af0266688c11905c5b3212bfded472c89b 100644 --- a/libc/src/pthread/pthread_attr_setguardsize.h +++ b/libc/src/pthread/pthread_attr_setguardsize.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_attr_setguardsize(pthread_attr_t *attr, size_t guardsize); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATTR_SETGUARDSIZE_H diff --git a/libc/src/pthread/pthread_attr_setstack.cpp b/libc/src/pthread/pthread_attr_setstack.cpp index a16196acf23b07d2cc34316602d11dec99434e76..dde4e3fd70ed232a07e9cf1d882a43d3e5385e92 100644 --- a/libc/src/pthread/pthread_attr_setstack.cpp +++ b/libc/src/pthread/pthread_attr_setstack.cpp @@ -16,7 +16,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_attr_setstack, (pthread_attr_t *__restrict attr, void *stack, @@ -35,4 +35,4 @@ LLVM_LIBC_FUNCTION(int, pthread_attr_setstack, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_attr_setstack.h b/libc/src/pthread/pthread_attr_setstack.h index 44ee2c9e35de162a27ccf9a93676d60bd774ec96..fe2a7f4fbd061adc795b078fdd253eae045acd3b 100644 --- a/libc/src/pthread/pthread_attr_setstack.h +++ b/libc/src/pthread/pthread_attr_setstack.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_attr_setstack(pthread_attr_t *attr, void *stack, size_t stacksize); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATTR_SETSTACK_H diff --git a/libc/src/pthread/pthread_attr_setstacksize.cpp b/libc/src/pthread/pthread_attr_setstacksize.cpp index b23a7ced09aa3f1c44cdbe15dd21600ceb0f28b1..642a888aba706d22426fadac439c56c4e2b8f31a 100644 --- a/libc/src/pthread/pthread_attr_setstacksize.cpp +++ b/libc/src/pthread/pthread_attr_setstacksize.cpp @@ -13,7 +13,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_attr_setstacksize, (pthread_attr_t *__restrict attr, size_t stacksize)) { @@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, pthread_attr_setstacksize, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_attr_setstacksize.h b/libc/src/pthread/pthread_attr_setstacksize.h index 40ee5c07d44eacb50d897504a82b43ab82776c03..f5940948949b8348377adecf435ffb036ad907a3 100644 --- a/libc/src/pthread/pthread_attr_setstacksize.h +++ b/libc/src/pthread/pthread_attr_setstacksize.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ATTR_SETSTACKSIZE_H diff --git a/libc/src/pthread/pthread_create.cpp b/libc/src/pthread/pthread_create.cpp index 9eebb80001a895d397efc1ca1f085674dd9e5a8a..8b406cd09326ad5794d26ade5d19576e4f04305a 100644 --- a/libc/src/pthread/pthread_create.cpp +++ b/libc/src/pthread/pthread_create.cpp @@ -22,9 +22,9 @@ #include #include // For pthread_* type definitions. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -static_assert(sizeof(pthread_t) == sizeof(__llvm_libc::Thread), +static_assert(sizeof(pthread_t) == sizeof(LIBC_NAMESPACE::Thread), "Mismatch between pthread_t and internal Thread."); LLVM_LIBC_FUNCTION(int, pthread_create, @@ -34,7 +34,7 @@ LLVM_LIBC_FUNCTION(int, pthread_create, pthread_attr_t default_attr; if (attr == nullptr) { // We failed to initialize attributes (should be impossible) - if (LIBC_UNLIKELY(__llvm_libc::pthread_attr_init(&default_attr) != 0)) + if (LIBC_UNLIKELY(LIBC_NAMESPACE::pthread_attr_init(&default_attr) != 0)) return EINVAL; attr = &default_attr; @@ -46,21 +46,21 @@ LLVM_LIBC_FUNCTION(int, pthread_create, // As of writing this all the `pthread_attr_get*` functions always succeed. if (LIBC_UNLIKELY( - __llvm_libc::pthread_attr_getstack(attr, &stack, &stacksize) != 0)) + LIBC_NAMESPACE::pthread_attr_getstack(attr, &stack, &stacksize) != 0)) return EINVAL; - if (LIBC_UNLIKELY(__llvm_libc::pthread_attr_getguardsize(attr, &guardsize) != - 0)) + if (LIBC_UNLIKELY( + LIBC_NAMESPACE::pthread_attr_getguardsize(attr, &guardsize) != 0)) return EINVAL; if (LIBC_UNLIKELY( - __llvm_libc::pthread_attr_getdetachstate(attr, &detachstate) != 0)) + LIBC_NAMESPACE::pthread_attr_getdetachstate(attr, &detachstate) != 0)) return EINVAL; if (attr == &default_attr) // Should we fail here? Its non-issue as the moment as pthread_attr_destroy // can only succeed. - if (LIBC_UNLIKELY(__llvm_libc::pthread_attr_destroy(&default_attr) != 0)) + if (LIBC_UNLIKELY(LIBC_NAMESPACE::pthread_attr_destroy(&default_attr) != 0)) return EINVAL; if (stacksize && stacksize < PTHREAD_STACK_MIN) @@ -76,7 +76,7 @@ LLVM_LIBC_FUNCTION(int, pthread_create, // Thread::run will check validity of the `stack` argument (stack alignment is // universal, not sure a pthread requirement). - auto *thread = reinterpret_cast<__llvm_libc::Thread *>(th); + auto *thread = reinterpret_cast(th); int result = thread->run(func, arg, stack, stacksize, guardsize, detachstate == PTHREAD_CREATE_DETACHED); if (result != 0 && result != EPERM && result != EINVAL) @@ -84,4 +84,4 @@ LLVM_LIBC_FUNCTION(int, pthread_create, return result; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_create.h b/libc/src/pthread/pthread_create.h index 6df6c9559ea94403b2f1858da06455db2321b3b9..75466e39df7e17c407f8dce1441f660c8c174f6b 100644 --- a/libc/src/pthread/pthread_create.h +++ b/libc/src/pthread/pthread_create.h @@ -11,12 +11,12 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_create(pthread_t *__restrict thread, const pthread_attr_t *__restrict attr, __pthread_start_t func, void *arg); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_CREATE_H diff --git a/libc/src/pthread/pthread_detach.cpp b/libc/src/pthread/pthread_detach.cpp index 009438e16c4c3d3386eb53b8f68c0a8a51a464cd..e8b69b6576265cd9a693ea5b483efe0ab96b2e2c 100644 --- a/libc/src/pthread/pthread_detach.cpp +++ b/libc/src/pthread/pthread_detach.cpp @@ -13,9 +13,9 @@ #include // For pthread_* type definitions. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -static_assert(sizeof(pthread_t) == sizeof(__llvm_libc::Thread), +static_assert(sizeof(pthread_t) == sizeof(LIBC_NAMESPACE::Thread), "Mismatch between pthread_t and internal Thread."); LLVM_LIBC_FUNCTION(int, pthread_detach, (pthread_t th)) { @@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, pthread_detach, (pthread_t th)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_detach.h b/libc/src/pthread/pthread_detach.h index 5beab40b3061af4355390089365885a016472d8b..d54fdf854de391a048935aca130ad08911c05711 100644 --- a/libc/src/pthread/pthread_detach.h +++ b/libc/src/pthread/pthread_detach.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_detach(pthread_t thread); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_DETACH_H diff --git a/libc/src/pthread/pthread_equal.cpp b/libc/src/pthread/pthread_equal.cpp index 29460204ae1d91f1febd35a764dae279c6cd1302..f154e9ba9a4212714d2309ff43d827c23719e68f 100644 --- a/libc/src/pthread/pthread_equal.cpp +++ b/libc/src/pthread/pthread_equal.cpp @@ -13,9 +13,9 @@ #include // For pthread_* type definitions. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -static_assert(sizeof(pthread_t) == sizeof(__llvm_libc::Thread), +static_assert(sizeof(pthread_t) == sizeof(LIBC_NAMESPACE::Thread), "Mismatch between pthread_t and internal Thread."); LLVM_LIBC_FUNCTION(int, pthread_equal, (pthread_t lhs, pthread_t rhs)) { @@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, pthread_equal, (pthread_t lhs, pthread_t rhs)) { return *lhs_internal == *rhs_internal; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_equal.h b/libc/src/pthread/pthread_equal.h index aa5dfed54a5e01cf7166e739183eded6e464acf3..448fb8fc07d1d4212b6f84e399e8471623113021 100644 --- a/libc/src/pthread/pthread_equal.h +++ b/libc/src/pthread/pthread_equal.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_equal(pthread_t lhs, pthread_t rhs); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_EQUAL_H diff --git a/libc/src/pthread/pthread_exit.cpp b/libc/src/pthread/pthread_exit.cpp index 1d1a7377f8326a1f63e30c7c79de56e956ec88b6..acba665d0fa4f8ade6da81eac3ed523317a938b0 100644 --- a/libc/src/pthread/pthread_exit.cpp +++ b/libc/src/pthread/pthread_exit.cpp @@ -13,13 +13,13 @@ #include // For pthread_* type definitions. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -static_assert(sizeof(pthread_t) == sizeof(__llvm_libc::Thread), +static_assert(sizeof(pthread_t) == sizeof(LIBC_NAMESPACE::Thread), "Mismatch between pthread_t and internal Thread."); LLVM_LIBC_FUNCTION(void, pthread_exit, (void *retval)) { - __llvm_libc::thread_exit(ThreadReturnValue(retval), ThreadStyle::POSIX); + LIBC_NAMESPACE::thread_exit(ThreadReturnValue(retval), ThreadStyle::POSIX); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_exit.h b/libc/src/pthread/pthread_exit.h index 40051d70e0e00c226524a5a388f311abc08ce7c7..6617dab84c69e6054a1f0db1b0b1dc001b34c6c1 100644 --- a/libc/src/pthread/pthread_exit.h +++ b/libc/src/pthread/pthread_exit.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { [[noreturn]] void pthread_exit(void *retval); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_EXIT_H diff --git a/libc/src/pthread/pthread_getname_np.cpp b/libc/src/pthread/pthread_getname_np.cpp index e1c3549974b6b69916ae488d020f1989c6b2d767..3de8c2e92f7a04ef317b8eda8d89c730abead5ae 100644 --- a/libc/src/pthread/pthread_getname_np.cpp +++ b/libc/src/pthread/pthread_getname_np.cpp @@ -16,17 +16,17 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -static_assert(sizeof(pthread_t) == sizeof(__llvm_libc::Thread), +static_assert(sizeof(pthread_t) == sizeof(LIBC_NAMESPACE::Thread), "Mismatch between pthread_t and internal Thread."); LLVM_LIBC_FUNCTION(int, pthread_getname_np, (pthread_t th, char *buf, size_t len)) { - auto *thread = reinterpret_cast<__llvm_libc::Thread *>(&th); + auto *thread = reinterpret_cast(&th); cpp::span name_buf(buf, len); cpp::StringStream name_stream(name_buf); return thread->get_name(name_stream); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_getname_np.h b/libc/src/pthread/pthread_getname_np.h index da9c77150e0af3ce4c71f9d5794059dcee409f1f..a51573749ba877f00e18608085442e3c74f99d52 100644 --- a/libc/src/pthread/pthread_getname_np.h +++ b/libc/src/pthread/pthread_getname_np.h @@ -12,10 +12,10 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_getname_np(pthread_t, char *, size_t); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_GETNAME_NP_H diff --git a/libc/src/pthread/pthread_getspecific.cpp b/libc/src/pthread/pthread_getspecific.cpp index 02545564a8cccfd911a6e4bd4a2f399ec6b6fd1b..3893b52efd6e9a9e014469eddf47b5f64b715b69 100644 --- a/libc/src/pthread/pthread_getspecific.cpp +++ b/libc/src/pthread/pthread_getspecific.cpp @@ -14,10 +14,10 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void *, pthread_getspecific, (pthread_key_t key)) { return get_tss_value(key); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_getspecific.h b/libc/src/pthread/pthread_getspecific.h index c7da0137d5450543b95f5354972eecff07d44c41..28439838bd65b2ab818a0a29e4af9ca0e5b619ce 100644 --- a/libc/src/pthread/pthread_getspecific.h +++ b/libc/src/pthread/pthread_getspecific.h @@ -12,10 +12,10 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void *pthread_getspecific(pthread_key_t); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_GETSPECIFIC_H diff --git a/libc/src/pthread/pthread_join.cpp b/libc/src/pthread/pthread_join.cpp index b888260247cd855696bf1de89800acc1097c73a7..8d4c2dd46c474ca7e0d90ed6348d2c8a857058d6 100644 --- a/libc/src/pthread/pthread_join.cpp +++ b/libc/src/pthread/pthread_join.cpp @@ -13,9 +13,9 @@ #include // For pthread_* type definitions. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -static_assert(sizeof(pthread_t) == sizeof(__llvm_libc::Thread), +static_assert(sizeof(pthread_t) == sizeof(LIBC_NAMESPACE::Thread), "Mismatch between pthread_t and internal Thread."); LLVM_LIBC_FUNCTION(int, pthread_join, (pthread_t th, void **retval)) { @@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, pthread_join, (pthread_t th, void **retval)) { return result; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_join.h b/libc/src/pthread/pthread_join.h index 1200fba3b20d8ee6a1e75c452feb2edf8981e22e..506efaead40fffaa0abc0365ad7e6a1fc5860510 100644 --- a/libc/src/pthread/pthread_join.h +++ b/libc/src/pthread/pthread_join.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_join(pthread_t thread, void **retval); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_JOIN_H diff --git a/libc/src/pthread/pthread_key_create.cpp b/libc/src/pthread/pthread_key_create.cpp index 1dc8eecfa5a2187b2798a32fa370c9322ff18e5c..81c1f39954a5b2c8efc23465e69ce014204b0b76 100644 --- a/libc/src/pthread/pthread_key_create.cpp +++ b/libc/src/pthread/pthread_key_create.cpp @@ -14,15 +14,15 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_key_create, (pthread_key_t * key, __pthread_tss_dtor_t dtor)) { - auto k = __llvm_libc::new_tss_key(dtor); + auto k = LIBC_NAMESPACE::new_tss_key(dtor); if (!k) return EINVAL; *key = *k; return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_key_create.h b/libc/src/pthread/pthread_key_create.h index cd5916ab01fbecfff7758978d8a0e2051985626c..f12c9088e7c86d964dc8db3ea39e1123e5aa131c 100644 --- a/libc/src/pthread/pthread_key_create.h +++ b/libc/src/pthread/pthread_key_create.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_key_create(pthread_key_t *key, __pthread_tss_dtor_t dtor); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_KEY_CREATE_H diff --git a/libc/src/pthread/pthread_key_delete.cpp b/libc/src/pthread/pthread_key_delete.cpp index d45424cf60135785f9e0fdd0887a7f92669b9882..18a4cc7e18665dd466d580585448a6cb63fb8332 100644 --- a/libc/src/pthread/pthread_key_delete.cpp +++ b/libc/src/pthread/pthread_key_delete.cpp @@ -14,13 +14,13 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_key_delete, (pthread_key_t key)) { - if (__llvm_libc::tss_key_delete(key)) + if (LIBC_NAMESPACE::tss_key_delete(key)) return 0; else return EINVAL; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_key_delete.h b/libc/src/pthread/pthread_key_delete.h index 3ec528dde71970b765db1260b33c608ffae753cf..5b7e40bb373a6e7c3251f79d59fa35ccf5800312 100644 --- a/libc/src/pthread/pthread_key_delete.h +++ b/libc/src/pthread/pthread_key_delete.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_key_delete(pthread_key_t key); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_KEY_DELETE_H diff --git a/libc/src/pthread/pthread_mutex_destroy.cpp b/libc/src/pthread/pthread_mutex_destroy.cpp index acb344bbea52f383f21dc4e5d1bbd6041607d5d5..65f4b7901f4f19b08cf2999203c168790eca95db 100644 --- a/libc/src/pthread/pthread_mutex_destroy.cpp +++ b/libc/src/pthread/pthread_mutex_destroy.cpp @@ -13,7 +13,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_mutex_destroy, (pthread_mutex_t * mutex)) { auto *m = reinterpret_cast(mutex); @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutex_destroy, (pthread_mutex_t * mutex)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_mutex_destroy.h b/libc/src/pthread/pthread_mutex_destroy.h index b6461a0da9f39f35fe3309860c4527569513d233..2df303eb2d6ca59aad5c86b6613330d06f0dd561 100644 --- a/libc/src/pthread/pthread_mutex_destroy.h +++ b/libc/src/pthread/pthread_mutex_destroy.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_mutex_destroy(pthread_mutex_t *mutex); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEX_DESTROY_H diff --git a/libc/src/pthread/pthread_mutex_init.cpp b/libc/src/pthread/pthread_mutex_init.cpp index 5038ee08875939be5bd0177e25e13f90bc280d85..f64d1fe68ad202142a48e0e90763a74802605ad5 100644 --- a/libc/src/pthread/pthread_mutex_init.cpp +++ b/libc/src/pthread/pthread_mutex_init.cpp @@ -15,7 +15,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { static_assert(sizeof(Mutex) <= sizeof(pthread_mutex_t), "The public pthread_mutex_t type cannot accommodate the internal " @@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutex_init, return err == MutexError::NONE ? 0 : EAGAIN; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_mutex_init.h b/libc/src/pthread/pthread_mutex_init.h index 678cac32d900d4875ab66b03cad40c8c1e13b05f..e6b5a0ac7eef96089688a831af5b4ae1842b1cf9 100644 --- a/libc/src/pthread/pthread_mutex_init.h +++ b/libc/src/pthread/pthread_mutex_init.h @@ -11,11 +11,11 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *__restrict attr); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEX_INIT_H diff --git a/libc/src/pthread/pthread_mutex_lock.cpp b/libc/src/pthread/pthread_mutex_lock.cpp index 9daffafff942fea18254fea3f27201147618095c..efc6f75e43429a30a0f060d3e512530beee625cb 100644 --- a/libc/src/pthread/pthread_mutex_lock.cpp +++ b/libc/src/pthread/pthread_mutex_lock.cpp @@ -13,7 +13,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // The implementation currently handles only plain mutexes. LLVM_LIBC_FUNCTION(int, pthread_mutex_lock, (pthread_mutex_t * mutex)) { @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutex_lock, (pthread_mutex_t * mutex)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_mutex_lock.h b/libc/src/pthread/pthread_mutex_lock.h index bb47e59809698206e7c5a25290d6a8ac29ed3452..c5a835e4fc870609ae9bd8b6978ba9b5e5f168bf 100644 --- a/libc/src/pthread/pthread_mutex_lock.h +++ b/libc/src/pthread/pthread_mutex_lock.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_mutex_lock(pthread_mutex_t *mutex); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEX_LOCK_H diff --git a/libc/src/pthread/pthread_mutex_unlock.cpp b/libc/src/pthread/pthread_mutex_unlock.cpp index 3cc8c7cdac09b908b6bd99d4b345647d652babf3..b0819bd5fcd89454e5e34adac0bbeaa7caa4b732 100644 --- a/libc/src/pthread/pthread_mutex_unlock.cpp +++ b/libc/src/pthread/pthread_mutex_unlock.cpp @@ -13,7 +13,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // The implementation currently handles only plain mutexes. LLVM_LIBC_FUNCTION(int, pthread_mutex_unlock, (pthread_mutex_t * mutex)) { @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutex_unlock, (pthread_mutex_t * mutex)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_mutex_unlock.h b/libc/src/pthread/pthread_mutex_unlock.h index 4653841244eb79193d6407ac1263e01928d0b79f..303ec001d23787b33ab692fef3d0a2fb78502558 100644 --- a/libc/src/pthread/pthread_mutex_unlock.h +++ b/libc/src/pthread/pthread_mutex_unlock.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_mutex_unlock(pthread_mutex_t *mutex); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEX_UNLOCK_H diff --git a/libc/src/pthread/pthread_mutexattr.h b/libc/src/pthread/pthread_mutexattr.h index b65c672d34ce41a1180367aba93cf5c28767d663..8b435854416a781f9bdcb2dda8d2a68e88e451cb 100644 --- a/libc/src/pthread/pthread_mutexattr.h +++ b/libc/src/pthread/pthread_mutexattr.h @@ -13,7 +13,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { enum class PThreadMutexAttrPos : unsigned int { TYPE_SHIFT = 0, @@ -43,6 +43,6 @@ LIBC_INLINE int get_mutexattr_robust(pthread_mutexattr_t attr) { unsigned(PThreadMutexAttrPos::ROBUST_SHIFT); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEXATTR_H diff --git a/libc/src/pthread/pthread_mutexattr_destroy.cpp b/libc/src/pthread/pthread_mutexattr_destroy.cpp index cedfbe31c2ba59eae3d4f125bd28631f41b3c08e..9722d2b551cd72b255b48de0041a4b383f48a5af 100644 --- a/libc/src/pthread/pthread_mutexattr_destroy.cpp +++ b/libc/src/pthread/pthread_mutexattr_destroy.cpp @@ -13,10 +13,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_mutexattr_destroy, (pthread_mutexattr_t *)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_mutexattr_destroy.h b/libc/src/pthread/pthread_mutexattr_destroy.h index 2d7a5ed24e75bea6fc10ea3085b249c4d59e0c58..32a8b949fad8e1d036c42a31a3e6389e7f12dd8f 100644 --- a/libc/src/pthread/pthread_mutexattr_destroy.h +++ b/libc/src/pthread/pthread_mutexattr_destroy.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_mutexattr_destroy(pthread_mutexattr_t *attr); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEXATTR_DESTROY_H diff --git a/libc/src/pthread/pthread_mutexattr_getpshared.cpp b/libc/src/pthread/pthread_mutexattr_getpshared.cpp index 636bc1ae05edf274acd26ced47798fd8270d23b9..a89af08464e2f1d65979151ff67a737cc53b02e6 100644 --- a/libc/src/pthread/pthread_mutexattr_getpshared.cpp +++ b/libc/src/pthread/pthread_mutexattr_getpshared.cpp @@ -13,7 +13,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_mutexattr_getpshared, (const pthread_mutexattr_t *__restrict attr, @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutexattr_getpshared, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_mutexattr_getpshared.h b/libc/src/pthread/pthread_mutexattr_getpshared.h index 12c60ea00b6852f99a16f593a25cb7b7376092f2..843fa36583d67d3ed76648fcb72ed22ccb5689da 100644 --- a/libc/src/pthread/pthread_mutexattr_getpshared.h +++ b/libc/src/pthread/pthread_mutexattr_getpshared.h @@ -11,11 +11,11 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_mutexattr_getpshared(const pthread_mutexattr_t *__restrict attr, int *__restrict pshared); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEXATTR_GETPSHARED_H diff --git a/libc/src/pthread/pthread_mutexattr_getrobust.cpp b/libc/src/pthread/pthread_mutexattr_getrobust.cpp index e3677ee415bf13f0a4ae8e08d67426866d53a2a0..9c54b075dd9444836fab72da7251d2c09c7469e0 100644 --- a/libc/src/pthread/pthread_mutexattr_getrobust.cpp +++ b/libc/src/pthread/pthread_mutexattr_getrobust.cpp @@ -13,7 +13,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_mutexattr_getrobust, (const pthread_mutexattr_t *__restrict attr, @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutexattr_getrobust, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_mutexattr_getrobust.h b/libc/src/pthread/pthread_mutexattr_getrobust.h index 762cde0317fb91d491338598e867e21684bdd56e..5ef2b929d704998725e190586d7f65ca830f9f4e 100644 --- a/libc/src/pthread/pthread_mutexattr_getrobust.h +++ b/libc/src/pthread/pthread_mutexattr_getrobust.h @@ -11,11 +11,11 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_mutexattr_getrobust(const pthread_mutexattr_t *__restrict attr, int *__restrict robust); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEXATTR_GETROBUST_H diff --git a/libc/src/pthread/pthread_mutexattr_gettype.cpp b/libc/src/pthread/pthread_mutexattr_gettype.cpp index 6a17e889fcf24431b7f57491c4433c2f2d0541ad..c54396eff6fd85fb28ac54e76965c4fb1b2bb67b 100644 --- a/libc/src/pthread/pthread_mutexattr_gettype.cpp +++ b/libc/src/pthread/pthread_mutexattr_gettype.cpp @@ -13,7 +13,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_mutexattr_gettype, (const pthread_mutexattr_t *__restrict attr, @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutexattr_gettype, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_mutexattr_gettype.h b/libc/src/pthread/pthread_mutexattr_gettype.h index b0a7ea82e161240ba6666739a865f8dbb30eb23b..b0e7c6e8e6a0c80a236d51e551d408b208f85742 100644 --- a/libc/src/pthread/pthread_mutexattr_gettype.h +++ b/libc/src/pthread/pthread_mutexattr_gettype.h @@ -11,11 +11,11 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_mutexattr_gettype(const pthread_mutexattr_t *__restrict attr, int *__restrict type); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEXATTR_GETTYPE_H diff --git a/libc/src/pthread/pthread_mutexattr_init.cpp b/libc/src/pthread/pthread_mutexattr_init.cpp index 818aea1d388c0fe30e26f1f3893409b56af40b91..439d198249a1ee2216aae0e1795d0b5882ea5cf9 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 af6cf29d9be686d6330273f7893efc30878660c9..13de2e5925102cdd789ef20fb28e67ba18fa6ed1 100644 --- a/libc/src/pthread/pthread_mutexattr_init.h +++ b/libc/src/pthread/pthread_mutexattr_init.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_mutexattr_init(pthread_mutexattr_t *attr); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEXATTR_INIT_H diff --git a/libc/src/pthread/pthread_mutexattr_setpshared.cpp b/libc/src/pthread/pthread_mutexattr_setpshared.cpp index 1554031865a49e91915457767f53f9b197aed345..f654d337bac253adf835c050534ab4a98598d186 100644 --- a/libc/src/pthread/pthread_mutexattr_setpshared.cpp +++ b/libc/src/pthread/pthread_mutexattr_setpshared.cpp @@ -14,7 +14,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_mutexattr_setpshared, (pthread_mutexattr_t *__restrict attr, int pshared)) { @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutexattr_setpshared, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_mutexattr_setpshared.h b/libc/src/pthread/pthread_mutexattr_setpshared.h index 21c7734e1fe1b560c017844391c14ac2c49164b6..0726b7792fedba35d3c2c4a079443809473b2a64 100644 --- a/libc/src/pthread/pthread_mutexattr_setpshared.h +++ b/libc/src/pthread/pthread_mutexattr_setpshared.h @@ -11,11 +11,11 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_mutexattr_setpshared(pthread_mutexattr_t *__restrict attr, int pshared); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEXATTR_SETPSHARED_H diff --git a/libc/src/pthread/pthread_mutexattr_setrobust.cpp b/libc/src/pthread/pthread_mutexattr_setrobust.cpp index b09e3971d44000d350f0da72f438084119395944..15fdac61e438dfdd76f030afe2123fa868ef3c94 100644 --- a/libc/src/pthread/pthread_mutexattr_setrobust.cpp +++ b/libc/src/pthread/pthread_mutexattr_setrobust.cpp @@ -14,7 +14,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_mutexattr_setrobust, (pthread_mutexattr_t *__restrict attr, int robust)) { @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutexattr_setrobust, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_mutexattr_setrobust.h b/libc/src/pthread/pthread_mutexattr_setrobust.h index 253a319e6e50839b22883a71e39e639534f8d007..8361a14e38f6825e22d33779295ca2aab5a37973 100644 --- a/libc/src/pthread/pthread_mutexattr_setrobust.h +++ b/libc/src/pthread/pthread_mutexattr_setrobust.h @@ -11,11 +11,11 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_mutexattr_setrobust(pthread_mutexattr_t *__restrict attr, int robust); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEXATTR_SETROBUST_H diff --git a/libc/src/pthread/pthread_mutexattr_settype.cpp b/libc/src/pthread/pthread_mutexattr_settype.cpp index e8134654e5e1b3e055474619a49f479fff6f4ea7..d5514a1cbf8322a76aed9d025c114306fb9f780e 100644 --- a/libc/src/pthread/pthread_mutexattr_settype.cpp +++ b/libc/src/pthread/pthread_mutexattr_settype.cpp @@ -14,7 +14,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_mutexattr_settype, (pthread_mutexattr_t *__restrict attr, int type)) { @@ -28,4 +28,4 @@ LLVM_LIBC_FUNCTION(int, pthread_mutexattr_settype, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_mutexattr_settype.h b/libc/src/pthread/pthread_mutexattr_settype.h index 2411558ae217f29b6dd26556028e3154f33f9927..8ad3285bacf3043a69817a4eab1eb78d389df3ce 100644 --- a/libc/src/pthread/pthread_mutexattr_settype.h +++ b/libc/src/pthread/pthread_mutexattr_settype.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_mutexattr_settype(pthread_mutexattr_t *__restrict attr, int type); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_MUTEXATTR_SETTYPE_H diff --git a/libc/src/pthread/pthread_once.cpp b/libc/src/pthread/pthread_once.cpp index 4d141a67203684498db471c851a5d4a64e692ed9..0e0045e9c540701aad58539acfd72855cf54b7b3 100644 --- a/libc/src/pthread/pthread_once.cpp +++ b/libc/src/pthread/pthread_once.cpp @@ -12,7 +12,7 @@ #include // For pthread_once_t and __pthread_once_func_t definitions. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_once, (pthread_once_t * flag, __pthread_once_func_t func)) { @@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(int, pthread_once, reinterpret_cast(func)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_once.h b/libc/src/pthread/pthread_once.h index b9b7212f72af688451dc7194a715beb759722ed7..25ee70a99c4d4c52bd0740cd571a24bcee34f888 100644 --- a/libc/src/pthread/pthread_once.h +++ b/libc/src/pthread/pthread_once.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_once(pthread_once_t *flag, __pthread_once_func_t func); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_ONCE_H diff --git a/libc/src/pthread/pthread_self.cpp b/libc/src/pthread/pthread_self.cpp index 5b3145f34930ce0364d7ac6c7b2434efcec01f9b..3e74f964c9af286632ab56ba04d7054863618257 100644 --- a/libc/src/pthread/pthread_self.cpp +++ b/libc/src/pthread/pthread_self.cpp @@ -13,9 +13,9 @@ #include // For pthread_* type definitions. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -static_assert(sizeof(pthread_t) == sizeof(__llvm_libc::Thread), +static_assert(sizeof(pthread_t) == sizeof(LIBC_NAMESPACE::Thread), "Mismatch between pthread_t and internal Thread."); LLVM_LIBC_FUNCTION(pthread_t, pthread_self, ()) { @@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(pthread_t, pthread_self, ()) { return th; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_self.h b/libc/src/pthread/pthread_self.h index 1c4080bb9f63276117b2421337c8e8c555205725..058072e45ed288103241fb44d3decada4eadda8c 100644 --- a/libc/src/pthread/pthread_self.h +++ b/libc/src/pthread/pthread_self.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { pthread_t pthread_self(); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_SELF_H diff --git a/libc/src/pthread/pthread_setname_np.cpp b/libc/src/pthread/pthread_setname_np.cpp index 425c25bd3a5f7dc78470608f9516788b16625a89..e211d7e082740b829518cc4a6c3eea65458a0a66 100644 --- a/libc/src/pthread/pthread_setname_np.cpp +++ b/libc/src/pthread/pthread_setname_np.cpp @@ -14,14 +14,14 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -static_assert(sizeof(pthread_t) == sizeof(__llvm_libc::Thread), +static_assert(sizeof(pthread_t) == sizeof(LIBC_NAMESPACE::Thread), "Mismatch between pthread_t and internal Thread."); LLVM_LIBC_FUNCTION(int, pthread_setname_np, (pthread_t th, const char *name)) { - auto *thread = reinterpret_cast<__llvm_libc::Thread *>(&th); + auto *thread = reinterpret_cast(&th); return thread->set_name(cpp::string_view(name)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_setname_np.h b/libc/src/pthread/pthread_setname_np.h index 25b8c1f4f5e0f0cca425ffc5e12bb824828e855e..e240425ae2b46bf608831d06d40073455aff1806 100644 --- a/libc/src/pthread/pthread_setname_np.h +++ b/libc/src/pthread/pthread_setname_np.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_setname_np(pthread_t, const char *name); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_SETNAME_NP_H diff --git a/libc/src/pthread/pthread_setspecific.cpp b/libc/src/pthread/pthread_setspecific.cpp index 15504f7f536304e44dc209b3701489186a8680cf..e9b23d8483a8ff5ba64eadfc68d091e0d17213ee 100644 --- a/libc/src/pthread/pthread_setspecific.cpp +++ b/libc/src/pthread/pthread_setspecific.cpp @@ -14,7 +14,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, pthread_setspecific, (pthread_key_t key, const void *data)) { @@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, pthread_setspecific, return EINVAL; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/pthread/pthread_setspecific.h b/libc/src/pthread/pthread_setspecific.h index 4211a8e79e87636837ced48c3ea323c9ce375373..af9a890fd0aebdc805654b522ba83ed9b1174d83 100644 --- a/libc/src/pthread/pthread_setspecific.h +++ b/libc/src/pthread/pthread_setspecific.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int pthread_setspecific(pthread_key_t, const void *); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_PTHREAD_PTHREAD_SETSPECIFIC_H diff --git a/libc/src/sched/linux/sched_get_priority_max.cpp b/libc/src/sched/linux/sched_get_priority_max.cpp index c2954e3e8fbc437f6e08210a5834a5bc3a2a8648..0b6537ecd84c6ffd7dc3d74b344618a8e601df2d 100644 --- a/libc/src/sched/linux/sched_get_priority_max.cpp +++ b/libc/src/sched/linux/sched_get_priority_max.cpp @@ -14,10 +14,11 @@ #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sched_get_priority_max, (int policy)) { - int ret = __llvm_libc::syscall_impl(SYS_sched_get_priority_max, policy); + int ret = + LIBC_NAMESPACE::syscall_impl(SYS_sched_get_priority_max, policy); if (ret < 0) { libc_errno = -ret; return -1; @@ -25,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, sched_get_priority_max, (int policy)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sched/linux/sched_get_priority_min.cpp b/libc/src/sched/linux/sched_get_priority_min.cpp index 442b8572ab413e230160f9213a2037ad50971b2f..1240a500887eeb639a6e127b975a3b91431497bb 100644 --- a/libc/src/sched/linux/sched_get_priority_min.cpp +++ b/libc/src/sched/linux/sched_get_priority_min.cpp @@ -14,10 +14,11 @@ #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sched_get_priority_min, (int policy)) { - int ret = __llvm_libc::syscall_impl(SYS_sched_get_priority_min, policy); + int ret = + LIBC_NAMESPACE::syscall_impl(SYS_sched_get_priority_min, policy); if (ret < 0) { libc_errno = -ret; return -1; @@ -25,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, sched_get_priority_min, (int policy)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sched/linux/sched_getaffinity.cpp b/libc/src/sched/linux/sched_getaffinity.cpp index fcdd8c32e156e3c3d71a43977ef8c13f752d924c..476576178fa48f041f4aae2a1f866a09c68486d8 100644 --- a/libc/src/sched/linux/sched_getaffinity.cpp +++ b/libc/src/sched/linux/sched_getaffinity.cpp @@ -16,12 +16,12 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sched_getaffinity, (pid_t tid, size_t cpuset_size, cpu_set_t *mask)) { - int ret = __llvm_libc::syscall_impl(SYS_sched_getaffinity, tid, - cpuset_size, mask); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_sched_getaffinity, tid, + cpuset_size, mask); if (ret < 0) { libc_errno = -ret; return -1; @@ -36,4 +36,4 @@ LLVM_LIBC_FUNCTION(int, sched_getaffinity, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sched/linux/sched_getcpucount.cpp b/libc/src/sched/linux/sched_getcpucount.cpp index bcb5e8222145a67947ad6126acce22fe8c66da74..a816d92e4c0b5bf96f9a39d3111765fbb8a8ad07 100644 --- a/libc/src/sched/linux/sched_getcpucount.cpp +++ b/libc/src/sched/linux/sched_getcpucount.cpp @@ -13,7 +13,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, __sched_getcpucount, (size_t cpuset_size, const cpu_set_t *mask)) { @@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, __sched_getcpucount, return result; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sched/linux/sched_getparam.cpp b/libc/src/sched/linux/sched_getparam.cpp index 3b19c2e1f802c22d209f45ea8c261ecf3c37055b..64a62c5fd5e84ada4f7e333efa1248df6cbdcf49 100644 --- a/libc/src/sched/linux/sched_getparam.cpp +++ b/libc/src/sched/linux/sched_getparam.cpp @@ -14,11 +14,11 @@ #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sched_getparam, (pid_t tid, struct sched_param *param)) { - int ret = __llvm_libc::syscall_impl(SYS_sched_getparam, tid, param); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_sched_getparam, tid, param); if (ret < 0) { libc_errno = -ret; return -1; @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, sched_getparam, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sched/linux/sched_getscheduler.cpp b/libc/src/sched/linux/sched_getscheduler.cpp index 1f9affb00ed4584e1cd968b1e92e19ebda24460d..992a11d292591604dc330cf8ce6bc742268f6b2e 100644 --- a/libc/src/sched/linux/sched_getscheduler.cpp +++ b/libc/src/sched/linux/sched_getscheduler.cpp @@ -14,10 +14,10 @@ #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sched_getscheduler, (pid_t tid)) { - int ret = __llvm_libc::syscall_impl(SYS_sched_getscheduler, tid); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_sched_getscheduler, tid); if (ret < 0) { libc_errno = -ret; return -1; @@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, sched_getscheduler, (pid_t tid)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sched/linux/sched_rr_get_interval.cpp b/libc/src/sched/linux/sched_rr_get_interval.cpp index c50dc711620b1d192fea42b48f940c8e18224345..9d7d0e9d1ef6a15e36f00867e73b3b253a124820 100644 --- a/libc/src/sched/linux/sched_rr_get_interval.cpp +++ b/libc/src/sched/linux/sched_rr_get_interval.cpp @@ -18,12 +18,13 @@ #include // For __kernel_timespec. #endif -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sched_rr_get_interval, (pid_t tid, struct timespec *tp)) { #ifdef SYS_sched_rr_get_interval - int ret = __llvm_libc::syscall_impl(SYS_sched_rr_get_interval, tid, tp); + int ret = + LIBC_NAMESPACE::syscall_impl(SYS_sched_rr_get_interval, tid, tp); #elif defined(SYS_sched_rr_get_interval_time64) // The difference between the and SYS_sched_rr_get_interval // SYS_sched_rr_get_interval_time64 syscalls is the data type used for the @@ -31,16 +32,16 @@ LLVM_LIBC_FUNCTION(int, sched_rr_get_interval, int ret; if (tp) { struct __kernel_timespec ts32; - ret = __llvm_libc::syscall_impl(SYS_sched_rr_get_interval_time64, tid, - &ts32); + ret = LIBC_NAMESPACE::syscall_impl(SYS_sched_rr_get_interval_time64, + tid, &ts32); if (ret == 0) { tp->tv_sec = ts32.tv_sec; tp->tv_nsec = ts32.tv_nsec; } } else // When tp is a nullptr, we still do the syscall to set ret and errno - ret = __llvm_libc::syscall_impl(SYS_sched_rr_get_interval_time64, tid, - nullptr); + ret = LIBC_NAMESPACE::syscall_impl(SYS_sched_rr_get_interval_time64, + tid, nullptr); #else #error \ "sched_rr_get_interval and sched_rr_get_interval_time64 syscalls not available." @@ -52,4 +53,4 @@ LLVM_LIBC_FUNCTION(int, sched_rr_get_interval, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sched/linux/sched_setaffinity.cpp b/libc/src/sched/linux/sched_setaffinity.cpp index 1c99254191721692243646a1b596a3c28a0034ff..509894258e126ccb83e2a8cd07139fbd3145870c 100644 --- a/libc/src/sched/linux/sched_setaffinity.cpp +++ b/libc/src/sched/linux/sched_setaffinity.cpp @@ -15,12 +15,12 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sched_setaffinity, (pid_t tid, size_t cpuset_size, const cpu_set_t *mask)) { - int ret = __llvm_libc::syscall_impl(SYS_sched_setaffinity, tid, - cpuset_size, mask); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_sched_setaffinity, tid, + cpuset_size, mask); if (ret < 0) { libc_errno = -ret; return -1; @@ -28,4 +28,4 @@ LLVM_LIBC_FUNCTION(int, sched_setaffinity, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sched/linux/sched_setparam.cpp b/libc/src/sched/linux/sched_setparam.cpp index 28698003b14826d948bbf879ee4bf3a9a109c0bd..79acf78ef887ef94eb36f7d5a66e905da920e410 100644 --- a/libc/src/sched/linux/sched_setparam.cpp +++ b/libc/src/sched/linux/sched_setparam.cpp @@ -14,11 +14,11 @@ #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sched_setparam, (pid_t tid, const struct sched_param *param)) { - int ret = __llvm_libc::syscall_impl(SYS_sched_setparam, tid, param); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_sched_setparam, tid, param); if (ret < 0) { libc_errno = -ret; return -1; @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, sched_setparam, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sched/linux/sched_setscheduler.cpp b/libc/src/sched/linux/sched_setscheduler.cpp index c0b6205a47d003cce41871f4d59852f9f92ea132..1c18526a3c8146cdb03ca7a366505d914298bbaa 100644 --- a/libc/src/sched/linux/sched_setscheduler.cpp +++ b/libc/src/sched/linux/sched_setscheduler.cpp @@ -14,12 +14,12 @@ #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sched_setscheduler, (pid_t tid, int policy, const struct sched_param *param)) { - int ret = __llvm_libc::syscall_impl(SYS_sched_setscheduler, tid, policy, - param); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_sched_setscheduler, tid, + policy, param); if (ret < 0) { libc_errno = -ret; return -1; @@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(int, sched_setscheduler, return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sched/linux/sched_yield.cpp b/libc/src/sched/linux/sched_yield.cpp index 27a6f372b04722ef5585b49d11afbf65c82bb1dc..6878a375aa092b11e543cd51608ffdd254609c86 100644 --- a/libc/src/sched/linux/sched_yield.cpp +++ b/libc/src/sched/linux/sched_yield.cpp @@ -14,10 +14,10 @@ #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sched_yield, ()) { - int ret = __llvm_libc::syscall_impl(SYS_sched_yield); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_sched_yield); // As of writing this, yield() cannot fail if (ret < 0) { libc_errno = -ret; @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, sched_yield, ()) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sched/sched_get_priority_max.h b/libc/src/sched/sched_get_priority_max.h index 3ddcb086278364c12f4d206ea4841c1d3d6abf73..01611dae7bd126882a75dc2e8616bea62ff1d033 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 10bca87beadcb924cc6c373b4537e753add7c5be..f4b5d5487887cabd5270ad26f363267e1f957cf1 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 12317729b02ba0e51bbb1df5e82c8f35920877c3..2f29b7e2a0b9e8b449c146f0e0f27a370c5586a4 100644 --- a/libc/src/sched/sched_getaffinity.h +++ b/libc/src/sched/sched_getaffinity.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int sched_getaffinity(pid_t tid, size_t cpuset_size, cpu_set_t *mask); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SCHED_SCHED_GETAFFINITY_H diff --git a/libc/src/sched/sched_getcpucount.h b/libc/src/sched/sched_getcpucount.h index f55ec147d5825a941d38c41a2b367e76df0e68c5..a0c696fd1f4ae06af5fe13b217dc72112d570670 100644 --- a/libc/src/sched/sched_getcpucount.h +++ b/libc/src/sched/sched_getcpucount.h @@ -12,12 +12,12 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // This function is for internal use in the CPU_COUNT macro, but since that's a // macro and will be applied to client files, this must be a public entrypoint. int __sched_getcpucount(size_t cpuset_size, const cpu_set_t *mask); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SCHED_SCHED_GETCPUCOUNT_H diff --git a/libc/src/sched/sched_getparam.h b/libc/src/sched/sched_getparam.h index fcae11b71f8b536d79d3f9ade536a5fa4c84940d..09bed7012e3fddb3e5b53a992353c08113c8c899 100644 --- a/libc/src/sched/sched_getparam.h +++ b/libc/src/sched/sched_getparam.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int sched_getparam(pid_t tid, struct sched_param *param); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SCHED_SCHED_GETPARAM_H diff --git a/libc/src/sched/sched_getscheduler.h b/libc/src/sched/sched_getscheduler.h index 543b72d5a66fc3ac4370f7f857de245899bb7bd5..6e4fe060a6c4ef3667eb910b372d072365ffcd61 100644 --- a/libc/src/sched/sched_getscheduler.h +++ b/libc/src/sched/sched_getscheduler.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int sched_getscheduler(pid_t tid); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SCHED_SCHED_GETSCHEDULER_H diff --git a/libc/src/sched/sched_rr_get_interval.h b/libc/src/sched/sched_rr_get_interval.h index b90e4c3c26accd491fdc6ed6cafa47f63576e867..f9eb2d9a2220d5c82eeb94a074798f2a09de7e20 100644 --- a/libc/src/sched/sched_rr_get_interval.h +++ b/libc/src/sched/sched_rr_get_interval.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int sched_rr_get_interval(pid_t tid, struct timespec *tp); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SCHED_SCHED_RR_GET_INTERVAL_H diff --git a/libc/src/sched/sched_setaffinity.h b/libc/src/sched/sched_setaffinity.h index 9f3f8fe3b174845874c90434c98e2f55076f89df..5da6dd43e7d5d7ac9aded38b4b79ec5c2efc5ece 100644 --- a/libc/src/sched/sched_setaffinity.h +++ b/libc/src/sched/sched_setaffinity.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int sched_setaffinity(pid_t pid, size_t cpuset_size, const cpu_set_t *mask); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SCHED_SCHED_SETAFFINITY_H diff --git a/libc/src/sched/sched_setparam.h b/libc/src/sched/sched_setparam.h index 1707597045fd757b83d18abc2f1e84ab5c321e43..c371bc0bc75316529e3cff2680efd899c5ce4b6b 100644 --- a/libc/src/sched/sched_setparam.h +++ b/libc/src/sched/sched_setparam.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int sched_setparam(pid_t tid, const struct sched_param *param); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SCHED_SCHED_SETPARAM_H diff --git a/libc/src/sched/sched_setscheduler.h b/libc/src/sched/sched_setscheduler.h index 2a56e27cdf138f2d342224b5c3c72e5dc00dc794..8e0cb0d0629aee7475e971711fec4afabb11bd76 100644 --- a/libc/src/sched/sched_setscheduler.h +++ b/libc/src/sched/sched_setscheduler.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int sched_setscheduler(pid_t tid, int policy, const struct sched_param *param); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SCHED_SCHED_SETSCHEDULER_H diff --git a/libc/src/sched/sched_yield.h b/libc/src/sched/sched_yield.h index a64950039cdc8727893312853e07cc533262c254..493646a84edbbfd694583679b73089e072ef882f 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 5937504cf7e0810e24e3c415e6608f814044bd03..3697d62968c27c902970c6eae6ee78d83830b1bc 100644 --- a/libc/src/setjmp/longjmp.h +++ b/libc/src/setjmp/longjmp.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void longjmp(__jmp_buf *buf, int val); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SETJMP_LONGJMP_H diff --git a/libc/src/setjmp/riscv64/longjmp.cpp b/libc/src/setjmp/riscv64/longjmp.cpp index 7d8acd316845bc6dcc23a12d10a6dae8a446160b..0aed25e8125adceac8a0833b823a3950a2a7b9de 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 1ffc8d404f3c9df785ce13e5c12317835cf4f824..826aa4021d3f4f6dc4eb58149efe1118f486839e 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 9dc5396d58b46648d5ae9bdc0a97d1b92977c4f7..52c835c7414c72afc226b8fcae2fb55132363ad8 100644 --- a/libc/src/setjmp/setjmp_impl.h +++ b/libc/src/setjmp/setjmp_impl.h @@ -13,10 +13,10 @@ // public header setjmp.h which is also included. here. #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int setjmp(__jmp_buf *buf); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SETJMP_SETJMP_IMPL_H diff --git a/libc/src/setjmp/x86_64/longjmp.cpp b/libc/src/setjmp/x86_64/longjmp.cpp index d509b25b1d525017bae467e9e1353e7a23abe1f7..32340463e9f37baa14302f65cf0c6798af0abf04 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 988db6452571d59033eb873686f0cf404bac67d9..8b6981d4cc34a24230934a6efa3f541f01785149 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 52d5b0da6cc14e160eb6935f4fcbd52e4a4ca938..a6d18935459ca274af1602b0a1e540c9453dcac9 100644 --- a/libc/src/signal/kill.h +++ b/libc/src/signal/kill.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int kill(pid_t pid, int sig); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SIGNAL_KILL_H diff --git a/libc/src/signal/linux/__restore.cpp b/libc/src/signal/linux/__restore.cpp index 947373031f157801b5b8843b40587772dc807aec..36fa375d672e18c2da556bbd50e47b909172d1c3 100644 --- a/libc/src/signal/linux/__restore.cpp +++ b/libc/src/signal/linux/__restore.cpp @@ -14,14 +14,14 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { extern "C" void __restore_rt() __attribute__((no_sanitize("all"), hidden)); extern "C" void __restore_rt() { - __llvm_libc::syscall_impl(SYS_rt_sigreturn); + LIBC_NAMESPACE::syscall_impl(SYS_rt_sigreturn); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/signal/linux/kill.cpp b/libc/src/signal/linux/kill.cpp index 10d50761edf3ad1beb3255012e5ccd99db190a6b..a02b3b1d140035d5816fe2bdb16a8a3e9edc4505 100644 --- a/libc/src/signal/linux/kill.cpp +++ b/libc/src/signal/linux/kill.cpp @@ -16,10 +16,10 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, kill, (pid_t pid, int sig)) { - int ret = __llvm_libc::syscall_impl(SYS_kill, pid, sig); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_kill, pid, sig); // A negative return value indicates an error with the magnitude of the // value being the error code. @@ -31,4 +31,4 @@ LLVM_LIBC_FUNCTION(int, kill, (pid_t pid, int sig)) { return ret; // always 0 } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/signal/linux/raise.cpp b/libc/src/signal/linux/raise.cpp index 0a9bf295b016eae2f4efd1a326c97a12a248641c..dd6f5eb4b35754226670ca0a285d441980305b1f 100644 --- a/libc/src/signal/linux/raise.cpp +++ b/libc/src/signal/linux/raise.cpp @@ -11,16 +11,16 @@ #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, raise, (int sig)) { ::sigset_t sigset; block_all_signals(sigset); - long pid = __llvm_libc::syscall_impl(SYS_getpid); - long tid = __llvm_libc::syscall_impl(SYS_gettid); - int ret = __llvm_libc::syscall_impl(SYS_tgkill, pid, tid, sig); + long pid = LIBC_NAMESPACE::syscall_impl(SYS_getpid); + long tid = LIBC_NAMESPACE::syscall_impl(SYS_gettid); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_tgkill, pid, tid, sig); restore_signals(sigset); return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/signal/linux/sigaction.cpp b/libc/src/signal/linux/sigaction.cpp index 08f4d0a8f575f4564a99a260fb5e5e1c096fb7b2..7ddc2dc5cbcc70074e93b4f364f62f1585aa9824 100644 --- a/libc/src/signal/linux/sigaction.cpp +++ b/libc/src/signal/linux/sigaction.cpp @@ -14,7 +14,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TOOD: Some architectures will have their signal trampoline functions in the // vdso, use those when available. @@ -34,7 +34,7 @@ LLVM_LIBC_FUNCTION(int, sigaction, } KernelSigaction kernel_old; - int ret = __llvm_libc::syscall_impl( + int ret = LIBC_NAMESPACE::syscall_impl( SYS_rt_sigaction, signal, libc_new ? &kernel_new : nullptr, libc_old ? &kernel_old : nullptr, sizeof(sigset_t)); if (ret) { @@ -47,4 +47,4 @@ LLVM_LIBC_FUNCTION(int, sigaction, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/signal/linux/sigaddset.cpp b/libc/src/signal/linux/sigaddset.cpp index ff65c04e3e9527603e556a3a2819bba0c25c585a..536391734e058752ce9e20ba9723bbe9ff21a262 100644 --- a/libc/src/signal/linux/sigaddset.cpp +++ b/libc/src/signal/linux/sigaddset.cpp @@ -13,7 +13,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sigaddset, (sigset_t * set, int signum)) { if (set != nullptr && add_signal(*set, signum)) @@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(int, sigaddset, (sigset_t * set, int signum)) { return -1; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/signal/linux/sigaltstack.cpp b/libc/src/signal/linux/sigaltstack.cpp index 1e58dc725e4b4e3b74491deaa03cc6f8d323efd6..47e0b23f4bad5c24a43a235192171690e1ffa4cb 100644 --- a/libc/src/signal/linux/sigaltstack.cpp +++ b/libc/src/signal/linux/sigaltstack.cpp @@ -15,7 +15,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sigaltstack, (const stack_t *__restrict ss, stack_t *__restrict oss)) { @@ -34,7 +34,7 @@ LLVM_LIBC_FUNCTION(int, sigaltstack, } } - int ret = __llvm_libc::syscall_impl(SYS_sigaltstack, ss, oss); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_sigaltstack, ss, oss); if (ret < 0) { libc_errno = -ret; return -1; @@ -42,4 +42,4 @@ LLVM_LIBC_FUNCTION(int, sigaltstack, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/signal/linux/sigdelset.cpp b/libc/src/signal/linux/sigdelset.cpp index ebaa4122c067e37c37b51c9326f23f9ca99d923a..5cb645e461cf8e493ee95c62a24dbc428213eeba 100644 --- a/libc/src/signal/linux/sigdelset.cpp +++ b/libc/src/signal/linux/sigdelset.cpp @@ -13,7 +13,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sigdelset, (sigset_t * set, int signum)) { if (set != nullptr && delete_signal(*set, signum)) @@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(int, sigdelset, (sigset_t * set, int signum)) { return -1; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/signal/linux/sigemptyset.cpp b/libc/src/signal/linux/sigemptyset.cpp index 6f4c731b0831acfea6930cc88576d543ffe0956a..d08191e8ce4e0baba7fbe1f5dce0cccd3204009c 100644 --- a/libc/src/signal/linux/sigemptyset.cpp +++ b/libc/src/signal/linux/sigemptyset.cpp @@ -14,7 +14,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sigemptyset, (sigset_t * set)) { if (!set) { @@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, sigemptyset, (sigset_t * set)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/signal/linux/sigfillset.cpp b/libc/src/signal/linux/sigfillset.cpp index 9c3796dbee47f9d01a1e0888021a44d5d7ee8bc9..e17c85a897ce746e4e5d67758391ab02c32022da 100644 --- a/libc/src/signal/linux/sigfillset.cpp +++ b/libc/src/signal/linux/sigfillset.cpp @@ -13,7 +13,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sigfillset, (sigset_t * set)) { if (!set) { @@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, sigfillset, (sigset_t * set)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/signal/linux/signal.cpp b/libc/src/signal/linux/signal.cpp index 464a23c2977540a89b7dadbacbb7a8a7543e6ae2..a517fa73ba8a2cec90a83b98756482a6998a4dd6 100644 --- a/libc/src/signal/linux/signal.cpp +++ b/libc/src/signal/linux/signal.cpp @@ -13,15 +13,16 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(sighandler_t, signal, (int signum, sighandler_t handler)) { struct sigaction action, old; action.sa_handler = handler; action.sa_flags = SA_RESTART; // Errno will already be set so no need to worry about changing errno here. - return __llvm_libc::sigaction(signum, &action, &old) == -1 ? SIG_ERR - : old.sa_handler; + return LIBC_NAMESPACE::sigaction(signum, &action, &old) == -1 + ? SIG_ERR + : old.sa_handler; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/signal/linux/signal_utils.h b/libc/src/signal/linux/signal_utils.h index 7b976fcafc869917d68c3a35d23eaba1307fcfe6..ca6fd3aeb1a6ed6df241743d12992d8b000c49a2 100644 --- a/libc/src/signal/linux/signal_utils.h +++ b/libc/src/signal/linux/signal_utils.h @@ -16,7 +16,7 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // The POSIX definition of struct sigaction and the sigaction data structure // expected by the rt_sigaction syscall differ in their definition. So, we @@ -96,15 +96,15 @@ LIBC_INLINE constexpr bool delete_signal(sigset_t &set, int signal) { LIBC_INLINE int block_all_signals(sigset_t &set) { sigset_t full = full_set(); - return __llvm_libc::syscall_impl(SYS_rt_sigprocmask, SIG_BLOCK, &full, - &set, sizeof(sigset_t)); + return LIBC_NAMESPACE::syscall_impl(SYS_rt_sigprocmask, SIG_BLOCK, &full, + &set, sizeof(sigset_t)); } LIBC_INLINE int restore_signals(const sigset_t &set) { - return __llvm_libc::syscall_impl(SYS_rt_sigprocmask, SIG_SETMASK, &set, - nullptr, sizeof(sigset_t)); + return LIBC_NAMESPACE::syscall_impl(SYS_rt_sigprocmask, SIG_SETMASK, + &set, nullptr, sizeof(sigset_t)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SIGNAL_LINUX_SIGNAL_UTILS_H diff --git a/libc/src/signal/linux/sigprocmask.cpp b/libc/src/signal/linux/sigprocmask.cpp index f47cbd89ab2bb3fddca4c4fd7f6c935edfc24d66..79a35dd59d75c8ae90f6eab9a568f7d40d6a7bbd 100644 --- a/libc/src/signal/linux/sigprocmask.cpp +++ b/libc/src/signal/linux/sigprocmask.cpp @@ -16,13 +16,13 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sigprocmask, (int how, const sigset_t *__restrict set, sigset_t *__restrict oldset)) { - int ret = __llvm_libc::syscall_impl(SYS_rt_sigprocmask, how, set, oldset, - sizeof(sigset_t)); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_rt_sigprocmask, how, set, + oldset, sizeof(sigset_t)); if (!ret) return 0; @@ -30,4 +30,4 @@ LLVM_LIBC_FUNCTION(int, sigprocmask, return -1; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/signal/raise.h b/libc/src/signal/raise.h index 624b93c97b61097ce35a38b43de1d386bdb93c41..ee4f3c9f826a9b076c0634018d937d9fbf131479 100644 --- a/libc/src/signal/raise.h +++ b/libc/src/signal/raise.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int raise(int sig); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SIGNAL_RAISE_H diff --git a/libc/src/signal/sigaction.h b/libc/src/signal/sigaction.h index 8315a56bb01666c4fd2bdc5489414845e02fc508..c36a3ec9fedfaa333a093705fd227dd9461f8a69 100644 --- a/libc/src/signal/sigaction.h +++ b/libc/src/signal/sigaction.h @@ -11,11 +11,11 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int sigaction(int signal, const struct sigaction *__restrict libc_new, struct sigaction *__restrict libc_old); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SIGNAL_SIGACTION_H diff --git a/libc/src/signal/sigaddset.h b/libc/src/signal/sigaddset.h index 7d4613e32c03663197feb6cac2b686f7dc6984eb..626eb20a295c839788d02fc4f826a610da6b116b 100644 --- a/libc/src/signal/sigaddset.h +++ b/libc/src/signal/sigaddset.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int sigaddset(sigset_t *set, int signum); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SIGNAL_SIGADDSET_H diff --git a/libc/src/signal/sigaltstack.h b/libc/src/signal/sigaltstack.h index 7cc77aad883aa126a6e3c31fd021175abae0fa04..705bd368ce47b592570a6e01d5ccb0514f87a808 100644 --- a/libc/src/signal/sigaltstack.h +++ b/libc/src/signal/sigaltstack.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int sigaltstack(const stack_t *__restrict ss, stack_t *__restrict oss); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SIGNAL_SIGALTSTACK_H diff --git a/libc/src/signal/sigdelset.h b/libc/src/signal/sigdelset.h index 2283bb5fa701c29d1153b989944ec84d2e2b0f02..c4fdb9975fa3d0fa25f06b1522006175b2f5cd75 100644 --- a/libc/src/signal/sigdelset.h +++ b/libc/src/signal/sigdelset.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int sigdelset(sigset_t *set, int signum); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SIGNAL_SIGDELSET_H diff --git a/libc/src/signal/sigemptyset.h b/libc/src/signal/sigemptyset.h index bcb9c1a994e0a0f5016b06f52822287ee665e537..f3763d1f4f3d44d8698c1e6effb01df4bc4c7b0d 100644 --- a/libc/src/signal/sigemptyset.h +++ b/libc/src/signal/sigemptyset.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int sigemptyset(sigset_t *set); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SIGNAL_SIGEMPTYSET_H diff --git a/libc/src/signal/sigfillset.h b/libc/src/signal/sigfillset.h index 08a70a40afc76772af2cbc64ad2514742cd0fd7e..d8e3168871ea8a4fcf017401a361956b1d4d686f 100644 --- a/libc/src/signal/sigfillset.h +++ b/libc/src/signal/sigfillset.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int sigfillset(sigset_t *set); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SIGNAL_SIGFILLSET_H diff --git a/libc/src/signal/signal.h b/libc/src/signal/signal.h index c45564cf9e4662b439d0cc1080c35dbf0718986c..15bb5f01232eee831447ed24d609d7a4a4f44fc2 100644 --- a/libc/src/signal/signal.h +++ b/libc/src/signal/signal.h @@ -11,12 +11,12 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { using sighandler_t = __sighandler_t; sighandler_t signal(int signum, sighandler_t handler); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SIGNAL_SIGNAL_H diff --git a/libc/src/signal/sigprocmask.h b/libc/src/signal/sigprocmask.h index 490a16df7d6ff51423fb0b192b96d3ef80bf84cf..e0658860579e4ef0cf2c40f0d119faf964841550 100644 --- a/libc/src/signal/sigprocmask.h +++ b/libc/src/signal/sigprocmask.h @@ -11,11 +11,11 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int sigprocmask(int how, const sigset_t *__restrict set, sigset_t *__restrict oldset); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SIGNAL_SIGPROCMASK_H diff --git a/libc/src/spawn/file_actions.h b/libc/src/spawn/file_actions.h index ee509a1e0ad9c88c904ccc6d8d9901898e470db1..7113256bf49cb749a3eac9bbd52e0996282cc301 100644 --- a/libc/src/spawn/file_actions.h +++ b/libc/src/spawn/file_actions.h @@ -12,7 +12,7 @@ #include // For mode_t #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { struct BaseSpawnFileAction { enum ActionType { @@ -67,6 +67,6 @@ struct SpawnFileDup2Action : public BaseSpawnFileAction { newfd(new_fdesc) {} }; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SPAWN_FILE_ACTIONS_H diff --git a/libc/src/spawn/linux/posix_spawn.cpp b/libc/src/spawn/linux/posix_spawn.cpp index 44c79f9400a8f1a924e48778306358691519747f..0a0467df4959e952266f8857a8a88a8bacf05a3f 100644 --- a/libc/src/spawn/linux/posix_spawn.cpp +++ b/libc/src/spawn/linux/posix_spawn.cpp @@ -18,7 +18,7 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace { @@ -27,9 +27,9 @@ pid_t fork() { // to avoid duplicating the complete stack from the parent. A new stack will // be created on exec anyway so duplicating the full stack is unnecessary. #ifdef SYS_fork - return __llvm_libc::syscall_impl(SYS_fork); + return LIBC_NAMESPACE::syscall_impl(SYS_fork); #elif defined(SYS_clone) - return __llvm_libc::syscall_impl(SYS_clone, SIGCHLD, 0); + return LIBC_NAMESPACE::syscall_impl(SYS_clone, SIGCHLD, 0); #else #error "fork or clone syscalls not available." #endif @@ -37,10 +37,10 @@ pid_t fork() { cpp::optional open(const char *path, int oflags, mode_t mode) { #ifdef SYS_open - int fd = __llvm_libc::syscall_impl(SYS_open, path, oflags, mode); + int fd = LIBC_NAMESPACE::syscall_impl(SYS_open, path, oflags, mode); #else - int fd = - __llvm_libc::syscall_impl(SYS_openat, AT_FDCWD, path, oflags, mode); + int fd = LIBC_NAMESPACE::syscall_impl(SYS_openat, AT_FDCWD, path, oflags, + mode); #endif if (fd > 0) return fd; @@ -50,14 +50,14 @@ cpp::optional open(const char *path, int oflags, mode_t mode) { return cpp::nullopt; } -void close(int fd) { __llvm_libc::syscall_impl(SYS_close, fd); } +void close(int fd) { LIBC_NAMESPACE::syscall_impl(SYS_close, fd); } // We use dup3 if dup2 is not available, similar to our implementation of dup2 bool dup2(int fd, int newfd) { #ifdef SYS_dup2 - int ret = __llvm_libc::syscall_impl(SYS_dup2, fd, newfd); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_dup2, fd, newfd); #elif defined(SYS_dup3) - int ret = __llvm_libc::syscall_impl(SYS_dup3, fd, newfd, 0); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_dup3, fd, newfd, 0); #else #error "dup2 and dup3 syscalls not available." #endif @@ -68,8 +68,8 @@ bool dup2(int fd, int newfd) { // exit implementation which exits with code 127. void exit() { for (;;) { - __llvm_libc::syscall_impl(SYS_exit_group, 127); - __llvm_libc::syscall_impl(SYS_exit, 127); + LIBC_NAMESPACE::syscall_impl(SYS_exit_group, 127); + LIBC_NAMESPACE::syscall_impl(SYS_exit, 127); } } @@ -117,7 +117,7 @@ void child_process(const char *__restrict path, } } - if (__llvm_libc::syscall_impl(SYS_execve, path, argv, envp) < 0) + if (LIBC_NAMESPACE::syscall_impl(SYS_execve, path, argv, envp) < 0) exit(); } @@ -145,4 +145,4 @@ LLVM_LIBC_FUNCTION(int, posix_spawn, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/spawn/posix_spawn.h b/libc/src/spawn/posix_spawn.h index 721462701b25ffa210b4514c1c51a6e95c3686de..354b94c2d2d73d81434c69faa3ee49356a465cf4 100644 --- a/libc/src/spawn/posix_spawn.h +++ b/libc/src/spawn/posix_spawn.h @@ -11,13 +11,13 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int posix_spawn(pid_t *__restrict pid, const char *__restrict path, const posix_spawn_file_actions_t *file_actions, const posix_spawnattr_t *__restrict attr, char *const *__restrict argv, char *const *__restrict envp); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SPAWN_POSIX_SPAWN_H diff --git a/libc/src/spawn/posix_spawn_file_actions_addclose.cpp b/libc/src/spawn/posix_spawn_file_actions_addclose.cpp index 492c3e0b8bc112aeac387862909f9b610b455369..9b3c4885dfd770243f6cf894c64c878e27db4e74 100644 --- a/libc/src/spawn/posix_spawn_file_actions_addclose.cpp +++ b/libc/src/spawn/posix_spawn_file_actions_addclose.cpp @@ -15,7 +15,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, posix_spawn_file_actions_addclose, (posix_spawn_file_actions_t *__restrict actions, int fd)) { @@ -33,4 +33,4 @@ LLVM_LIBC_FUNCTION(int, posix_spawn_file_actions_addclose, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/spawn/posix_spawn_file_actions_addclose.h b/libc/src/spawn/posix_spawn_file_actions_addclose.h index 5eda292760daf74e5841a47df3f9deb5c9acdab9..c84965180fa7ab6ed38c1080a91b42f5fa417f3c 100644 --- a/libc/src/spawn/posix_spawn_file_actions_addclose.h +++ b/libc/src/spawn/posix_spawn_file_actions_addclose.h @@ -11,11 +11,11 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int posix_spawn_file_actions_addclose( posix_spawn_file_actions_t *__restrict actions, int fd); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SPAWN_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE_H diff --git a/libc/src/spawn/posix_spawn_file_actions_adddup2.cpp b/libc/src/spawn/posix_spawn_file_actions_adddup2.cpp index ca18629ba6832f7d00904bfe8c9cf39def529845..caa558e2a9a5f2afe4c15a6518d6f42a72cf4de7 100644 --- a/libc/src/spawn/posix_spawn_file_actions_adddup2.cpp +++ b/libc/src/spawn/posix_spawn_file_actions_adddup2.cpp @@ -15,7 +15,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, posix_spawn_file_actions_adddup2, (posix_spawn_file_actions_t * actions, int fd, int newfd)) { @@ -33,4 +33,4 @@ LLVM_LIBC_FUNCTION(int, posix_spawn_file_actions_adddup2, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/spawn/posix_spawn_file_actions_adddup2.h b/libc/src/spawn/posix_spawn_file_actions_adddup2.h index 33444184f973628725efcb29ceef2fc8325d41aa..7a7f3a5fb5bfdaf61049e938aa364a8711719a44 100644 --- a/libc/src/spawn/posix_spawn_file_actions_adddup2.h +++ b/libc/src/spawn/posix_spawn_file_actions_adddup2.h @@ -11,11 +11,11 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *actions, int fd, int newfd); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SPAWN_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2_H diff --git a/libc/src/spawn/posix_spawn_file_actions_addopen.cpp b/libc/src/spawn/posix_spawn_file_actions_addopen.cpp index 3b12c8bbc17ce5ace7ea225019fcbe4b6aa0989e..c544f04bd54ae7f071866657c9cf9df60021f8c7 100644 --- a/libc/src/spawn/posix_spawn_file_actions_addopen.cpp +++ b/libc/src/spawn/posix_spawn_file_actions_addopen.cpp @@ -15,7 +15,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, posix_spawn_file_actions_addopen, (posix_spawn_file_actions_t *__restrict actions, int fd, @@ -34,4 +34,4 @@ LLVM_LIBC_FUNCTION(int, posix_spawn_file_actions_addopen, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/spawn/posix_spawn_file_actions_addopen.h b/libc/src/spawn/posix_spawn_file_actions_addopen.h index ff757d42e5142f58d2297373494707df2f627364..121213abe50f8c6532b2c7b76ffb02712359bf51 100644 --- a/libc/src/spawn/posix_spawn_file_actions_addopen.h +++ b/libc/src/spawn/posix_spawn_file_actions_addopen.h @@ -11,12 +11,12 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int posix_spawn_file_actions_addopen( posix_spawn_file_actions_t *__restrict actions, int fd, const char *__restrict path, int oflag, mode_t mode); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SPAWN_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN_H diff --git a/libc/src/spawn/posix_spawn_file_actions_destroy.cpp b/libc/src/spawn/posix_spawn_file_actions_destroy.cpp index 7be531c67322c36554fd072dd8d72a471131c1f8..73e0ac828cd6997a0d9a4892a0b27871fce39244 100644 --- a/libc/src/spawn/posix_spawn_file_actions_destroy.cpp +++ b/libc/src/spawn/posix_spawn_file_actions_destroy.cpp @@ -15,7 +15,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, posix_spawn_file_actions_destroy, (posix_spawn_file_actions_t * actions)) { @@ -49,4 +49,4 @@ LLVM_LIBC_FUNCTION(int, posix_spawn_file_actions_destroy, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/spawn/posix_spawn_file_actions_destroy.h b/libc/src/spawn/posix_spawn_file_actions_destroy.h index 89f3c55dd99b5f9e6ebb33f606e30995d588e6b0..28b9b05b9e79a9dd7d83fb4a2a0fd98cc3b3566e 100644 --- a/libc/src/spawn/posix_spawn_file_actions_destroy.h +++ b/libc/src/spawn/posix_spawn_file_actions_destroy.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *actions); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SPAWN_POSIX_SPAWN_FILE_ACTIONS_DESTROY_H diff --git a/libc/src/spawn/posix_spawn_file_actions_init.cpp b/libc/src/spawn/posix_spawn_file_actions_init.cpp index 99502ff44962badbf05c4652aed44208a2b96e0b..04e5610c717c6973a7db8d08e312b77a62039dc9 100644 --- a/libc/src/spawn/posix_spawn_file_actions_init.cpp +++ b/libc/src/spawn/posix_spawn_file_actions_init.cpp @@ -12,7 +12,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, posix_spawn_file_actions_init, (posix_spawn_file_actions_t * actions)) { @@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(int, posix_spawn_file_actions_init, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/spawn/posix_spawn_file_actions_init.h b/libc/src/spawn/posix_spawn_file_actions_init.h index da354e1b0ebae80d19b509ba3c5529a04546aea6..d7b228fff08d0bee2b30c44ed80aa6e062d5f2b8 100644 --- a/libc/src/spawn/posix_spawn_file_actions_init.h +++ b/libc/src/spawn/posix_spawn_file_actions_init.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int posix_spawn_file_actions_init(posix_spawn_file_actions_t *actions); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SPAWN_POSIX_SPAWN_FILE_ACTIONS_INIT_H diff --git a/libc/src/stdio/clearerr.h b/libc/src/stdio/clearerr.h index 446e0fd40f87fcbaf78264afedfef5fdf128df2d..b8e8d7c5cab82cffcd1e1bc39e7ed2cf6cdd9ad2 100644 --- a/libc/src/stdio/clearerr.h +++ b/libc/src/stdio/clearerr.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void clearerr(::FILE *stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_CLEARERR_H diff --git a/libc/src/stdio/clearerr_unlocked.h b/libc/src/stdio/clearerr_unlocked.h index 8c14fd230a06f4e5c7d2c47c50c9ac72d51b5cb8..ff447cea61370cd949e76c9bab5cd8089db524ee 100644 --- a/libc/src/stdio/clearerr_unlocked.h +++ b/libc/src/stdio/clearerr_unlocked.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void clearerr_unlocked(::FILE *stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_CLEARERR_UNLOCKED_H diff --git a/libc/src/stdio/fclose.h b/libc/src/stdio/fclose.h index 21ffa4350391e3da0b4099f221f11658647f919f..7fe6951a080dcae9ceb768ce4d6118d3df14fce8 100644 --- a/libc/src/stdio/fclose.h +++ b/libc/src/stdio/fclose.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fclose(::FILE *stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FCLOSE_H diff --git a/libc/src/stdio/feof.h b/libc/src/stdio/feof.h index eab056ea2fdeb0f23d197cb1a55d5867571051d4..66a49bdd257015c36e3419d60c90260e88195013 100644 --- a/libc/src/stdio/feof.h +++ b/libc/src/stdio/feof.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int feof(::FILE *stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FEOF_H diff --git a/libc/src/stdio/feof_unlocked.h b/libc/src/stdio/feof_unlocked.h index 8e20f964ba31327828cef501c438b64e8cb2cd36..359609c597900b213219def6016bcd8dc5425f1e 100644 --- a/libc/src/stdio/feof_unlocked.h +++ b/libc/src/stdio/feof_unlocked.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int feof_unlocked(::FILE *stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FEOF_UNLOCKED_H diff --git a/libc/src/stdio/ferror.h b/libc/src/stdio/ferror.h index 3971cff6cac0ccaa1493a67c4716d85cea9dab41..194dff6320c8384ef67469dd742d229e995ba42c 100644 --- a/libc/src/stdio/ferror.h +++ b/libc/src/stdio/ferror.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int ferror(::FILE *stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FERROR_H diff --git a/libc/src/stdio/ferror_unlocked.h b/libc/src/stdio/ferror_unlocked.h index 9b0f12c7852c1067e19ad4064668039634fa37cc..86281025368c36aecd6e7a8bd2fa4f26d67a988f 100644 --- a/libc/src/stdio/ferror_unlocked.h +++ b/libc/src/stdio/ferror_unlocked.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int ferror_unlocked(::FILE *stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FERROR_UNLOCKED_H diff --git a/libc/src/stdio/fflush.cpp b/libc/src/stdio/fflush.cpp index d7a565214fc3cd52d5c6492d65ee3d228cbd1f5e..dc5275b1cd08e170c23e2bfbdf5c40cbe9dd32b9 100644 --- a/libc/src/stdio/fflush.cpp +++ b/libc/src/stdio/fflush.cpp @@ -12,10 +12,10 @@ #include "src/errno/libc_errno.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fflush, (::FILE * stream)) { - int result = reinterpret_cast<__llvm_libc::File *>(stream)->flush(); + int result = reinterpret_cast(stream)->flush(); if (result != 0) { libc_errno = result; return EOF; @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, fflush, (::FILE * stream)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/fflush.h b/libc/src/stdio/fflush.h index f2adbe17e8ef2881475757b93c6f886183060079..839fd986f15b543423110a26f37d876b8e91aa35 100644 --- a/libc/src/stdio/fflush.h +++ b/libc/src/stdio/fflush.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fflush(::FILE *stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FFLUSH_H diff --git a/libc/src/stdio/fgetc.h b/libc/src/stdio/fgetc.h index 13d22ded7f3f88c5063f5c1255b9ce54c8e8b99b..26a32482a3ba78f6e65b33337093ddd8960d0ac2 100644 --- a/libc/src/stdio/fgetc.h +++ b/libc/src/stdio/fgetc.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fgetc(::FILE *f); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FGETC_H diff --git a/libc/src/stdio/fgetc_unlocked.h b/libc/src/stdio/fgetc_unlocked.h index e374a6d0f6ce1881b1b8adcaeca2a5a79d8fcf3c..f765e8d502be791e8bfa092efa12c58387f0f6b6 100644 --- a/libc/src/stdio/fgetc_unlocked.h +++ b/libc/src/stdio/fgetc_unlocked.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fgetc_unlocked(::FILE *f); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FGETC_UNLOCKED_H diff --git a/libc/src/stdio/fgets.h b/libc/src/stdio/fgets.h index 6f4ed93ff03dcd1dc067fe55ed9a7c589e58c8c9..4264557862479392b93665017cdb1e3de0aa1fe9 100644 --- a/libc/src/stdio/fgets.h +++ b/libc/src/stdio/fgets.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { char *fgets(char *__restrict str, int count, ::FILE *__restrict raw_stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FGETS_H diff --git a/libc/src/stdio/flockfile.cpp b/libc/src/stdio/flockfile.cpp index 3b13a6f4d813da539aee41a6b09b9c1b13f06513..62606c92b9ea93770cedbed3990cec51827c9d04 100644 --- a/libc/src/stdio/flockfile.cpp +++ b/libc/src/stdio/flockfile.cpp @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, flockfile, (::FILE * stream)) { - reinterpret_cast<__llvm_libc::File *>(stream)->lock(); + reinterpret_cast(stream)->lock(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/flockfile.h b/libc/src/stdio/flockfile.h index 961ad8f941cdfacb870421298a337361d3852253..1509c140c5e711fbe7bf1cc5de34acd3003f76fe 100644 --- a/libc/src/stdio/flockfile.h +++ b/libc/src/stdio/flockfile.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void flockfile(::FILE *stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FLOCKFILE_H diff --git a/libc/src/stdio/fopen.h b/libc/src/stdio/fopen.h index f8ab0542d2a6ff467d00c058c9f4c2f544cc5ed1..68f93f5168f079276dddd42213878a2e4dd4afd4 100644 --- a/libc/src/stdio/fopen.h +++ b/libc/src/stdio/fopen.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { ::FILE *fopen(const char *__restrict name, const char *__restrict mode); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FOPEN_H diff --git a/libc/src/stdio/fopencookie.cpp b/libc/src/stdio/fopencookie.cpp index 7a4479ccae02567e0713ee2e4f4cf4135b89f5a0..2cb7ad2f46ebf6c34b0a89466bb5ee65832d45e2 100644 --- a/libc/src/stdio/fopencookie.cpp +++ b/libc/src/stdio/fopencookie.cpp @@ -14,11 +14,11 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace { -class CookieFile : public __llvm_libc::File { +class CookieFile : public LIBC_NAMESPACE::File { void *cookie; cookie_io_functions_t ops; @@ -96,4 +96,4 @@ LLVM_LIBC_FUNCTION(::FILE *, fopencookie, return reinterpret_cast<::FILE *>(file); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/fopencookie.h b/libc/src/stdio/fopencookie.h index d78e5ac3317da17a6ab77f31fc8c2f37faa8108e..3dff8949dd4351b50294af95a0e5f0d434e52a17 100644 --- a/libc/src/stdio/fopencookie.h +++ b/libc/src/stdio/fopencookie.h @@ -11,11 +11,11 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { ::FILE *fopencookie(void *cookie, const char *__restrict mode, cookie_io_functions_t desc); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FOPENCOOKIE_H diff --git a/libc/src/stdio/fprintf.cpp b/libc/src/stdio/fprintf.cpp index e13ed4d075ac856d95afd04e4486cee1f4ad8bdd..87b0e74ae09bfb8a003eebdbe273798629a66147 100644 --- a/libc/src/stdio/fprintf.cpp +++ b/libc/src/stdio/fprintf.cpp @@ -15,7 +15,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fprintf, (::FILE *__restrict stream, const char *__restrict format, @@ -30,4 +30,4 @@ LLVM_LIBC_FUNCTION(int, fprintf, return ret_val; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/fprintf.h b/libc/src/stdio/fprintf.h index caac3e88ee4fed039fa537f97259ca94b655092c..41cd8a858b430c745df3cb7f6a8d7422dc6865f1 100644 --- a/libc/src/stdio/fprintf.h +++ b/libc/src/stdio/fprintf.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fprintf(::FILE *__restrict stream, const char *__restrict format, ...); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FPRINTF_H diff --git a/libc/src/stdio/fputc.h b/libc/src/stdio/fputc.h index 24732ecb74e87ea061acc18de7c0bb474130af31..578e569072a1f27f9fbe33d5dfdb7eed67ca548f 100644 --- a/libc/src/stdio/fputc.h +++ b/libc/src/stdio/fputc.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fputc(int c, ::FILE *stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FPUTC_H diff --git a/libc/src/stdio/fputs.h b/libc/src/stdio/fputs.h index 2419fe8eeac7065bf29448b71b9d4ad69501e6d2..0238e46e628a61175eeadfe1ee43cecc2cf61970 100644 --- a/libc/src/stdio/fputs.h +++ b/libc/src/stdio/fputs.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fputs(const char *__restrict str, ::FILE *__restrict stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FPUTS_H diff --git a/libc/src/stdio/fread.h b/libc/src/stdio/fread.h index 995367cda4560d866c8d97950870217a2803dd61..ae2295095b9cf5050b5d851287a72b8fa68b4282 100644 --- a/libc/src/stdio/fread.h +++ b/libc/src/stdio/fread.h @@ -11,11 +11,11 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { size_t fread(void *__restrict buffer, size_t size, size_t nmemb, ::FILE *stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FREAD_H diff --git a/libc/src/stdio/fread_unlocked.h b/libc/src/stdio/fread_unlocked.h index 5c965b0f168cd2f2f6f1558bf3cdeb388b315884..7cd0ed3e35c57700df5b119e80f24ad4fc8fc308 100644 --- a/libc/src/stdio/fread_unlocked.h +++ b/libc/src/stdio/fread_unlocked.h @@ -11,11 +11,11 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { size_t fread_unlocked(void *__restrict buffer, size_t size, size_t nmemb, ::FILE *stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FREAD_UNLOCKED_H diff --git a/libc/src/stdio/fscanf.cpp b/libc/src/stdio/fscanf.cpp index 4fe0a3e57dcaa197cf54a5c55bf0adf2b2cc2918..188e28e50d0bd7fcbab3d89ff63669593a2528cd 100644 --- a/libc/src/stdio/fscanf.cpp +++ b/libc/src/stdio/fscanf.cpp @@ -15,7 +15,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fscanf, (::FILE *__restrict stream, const char *__restrict format, @@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(int, fscanf, return (ret_val == -1) ? EOF : ret_val; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/fscanf.h b/libc/src/stdio/fscanf.h index cc36cd7c9af8e318ab5cbf9524e60adaf9464e18..0e2247d74f0e57456fb7532d55b497df3eb98987 100644 --- a/libc/src/stdio/fscanf.h +++ b/libc/src/stdio/fscanf.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fscanf(::FILE *__restrict stream, const char *__restrict format, ...); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FSCANF_H diff --git a/libc/src/stdio/fseek.cpp b/libc/src/stdio/fseek.cpp index 928ff84db3a309e88c3186c860bedcd382cbbe20..7666e71e699d563cfe4d23c30f4986743ea72b59 100644 --- a/libc/src/stdio/fseek.cpp +++ b/libc/src/stdio/fseek.cpp @@ -12,11 +12,11 @@ #include "src/errno/libc_errno.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fseek, (::FILE * stream, long offset, int whence)) { auto result = - reinterpret_cast<__llvm_libc::File *>(stream)->seek(offset, whence); + reinterpret_cast(stream)->seek(offset, whence); if (!result.has_value()) { libc_errno = result.error(); return -1; @@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, fseek, (::FILE * stream, long offset, int whence)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/fseek.h b/libc/src/stdio/fseek.h index f3865c4efd23ff29426f8d5057e3f6c5a797ef73..6a7f715d2f99890186af4aca33dca3eab467b06e 100644 --- a/libc/src/stdio/fseek.h +++ b/libc/src/stdio/fseek.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fseek(::FILE *stream, long offset, int whence); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FSEEK_H diff --git a/libc/src/stdio/ftell.cpp b/libc/src/stdio/ftell.cpp index 697e9bc1b4b32e733b4496450b130c3d06ab5261..5f7803150534b316273a3ea3fac5a67ff5c794ce 100644 --- a/libc/src/stdio/ftell.cpp +++ b/libc/src/stdio/ftell.cpp @@ -12,10 +12,10 @@ #include "src/errno/libc_errno.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(long, ftell, (::FILE * stream)) { - auto result = reinterpret_cast<__llvm_libc::File *>(stream)->tell(); + auto result = reinterpret_cast(stream)->tell(); if (!result.has_value()) { libc_errno = result.error(); return -1; @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(long, ftell, (::FILE * stream)) { return result.value(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/ftell.h b/libc/src/stdio/ftell.h index 95d4494709181274dd2ee6a552b14391244dbbc6..e72bb8b32bd947b308b2be04ecbf240551adfe0d 100644 --- a/libc/src/stdio/ftell.h +++ b/libc/src/stdio/ftell.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { long ftell(::FILE *f); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FTELL_H diff --git a/libc/src/stdio/funlockfile.cpp b/libc/src/stdio/funlockfile.cpp index 6c7dbee303cbb387cee6bc808c584d4d795b6876..88e2eaef8ba038eee4d9cb60f6a4cf39d2bb52c4 100644 --- a/libc/src/stdio/funlockfile.cpp +++ b/libc/src/stdio/funlockfile.cpp @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, funlockfile, (::FILE * stream)) { - reinterpret_cast<__llvm_libc::File *>(stream)->unlock(); + reinterpret_cast(stream)->unlock(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/funlockfile.h b/libc/src/stdio/funlockfile.h index cb04b7e9550ec0e54edcc565ecade8372a21f3b2..c50f9dd1d70099025798a693ee03394b6be8eb25 100644 --- a/libc/src/stdio/funlockfile.h +++ b/libc/src/stdio/funlockfile.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void funlockfile(::FILE *stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FUNLOCKFILE_H diff --git a/libc/src/stdio/fwrite.h b/libc/src/stdio/fwrite.h index eb258fcec33b79d36ff1a9d2a002cf88e5a476d6..a71f20cff023ac84093ca495a25196e4bc6582af 100644 --- a/libc/src/stdio/fwrite.h +++ b/libc/src/stdio/fwrite.h @@ -11,11 +11,11 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { size_t fwrite(const void *__restrict ptr, size_t size, size_t nmemb, ::FILE *__restrict stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FWRITE_H diff --git a/libc/src/stdio/fwrite_unlocked.h b/libc/src/stdio/fwrite_unlocked.h index 33bcc219d2efa3b32d6fc3269680ad8068050286..7012e0d16737a9491975e31f6396e9078578af5d 100644 --- a/libc/src/stdio/fwrite_unlocked.h +++ b/libc/src/stdio/fwrite_unlocked.h @@ -11,11 +11,11 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { size_t fwrite_unlocked(const void *__restrict ptr, size_t size, size_t nmemb, ::FILE *__restrict stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_FWRITE_UNLOCKED_H diff --git a/libc/src/stdio/generic/clearerr.cpp b/libc/src/stdio/generic/clearerr.cpp index 95556bfdf73903accf874597cbcd7ce822bf77d6..1f1ce38639f50c8eaf0bec7653248f1b026c8c8e 100644 --- a/libc/src/stdio/generic/clearerr.cpp +++ b/libc/src/stdio/generic/clearerr.cpp @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, clearerr, (::FILE * stream)) { - reinterpret_cast<__llvm_libc::File *>(stream)->clearerr(); + reinterpret_cast(stream)->clearerr(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/clearerr_unlocked.cpp b/libc/src/stdio/generic/clearerr_unlocked.cpp index 88f26a82dbbe378f2f0ca0599932343c38af9d81..2840e3703ca93924b25db73aca085190d43cdfb1 100644 --- a/libc/src/stdio/generic/clearerr_unlocked.cpp +++ b/libc/src/stdio/generic/clearerr_unlocked.cpp @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, clearerr_unlocked, (::FILE * stream)) { - reinterpret_cast<__llvm_libc::File *>(stream)->clearerr_unlocked(); + reinterpret_cast(stream)->clearerr_unlocked(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/fclose.cpp b/libc/src/stdio/generic/fclose.cpp index da75e9bc1fdf738f90df534a45d3ac61937f000a..cc163ab21e78d0fb8b00f6b55d1de2f80d7e7b2e 100644 --- a/libc/src/stdio/generic/fclose.cpp +++ b/libc/src/stdio/generic/fclose.cpp @@ -12,10 +12,10 @@ #include "src/errno/libc_errno.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fclose, (::FILE * stream)) { - int result = reinterpret_cast<__llvm_libc::File *>(stream)->close(); + int result = reinterpret_cast(stream)->close(); if (result != 0) { libc_errno = result; return EOF; @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, fclose, (::FILE * stream)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/feof.cpp b/libc/src/stdio/generic/feof.cpp index 3d22a19f05d3adbf3eb6412612b10d633cf30f7f..311561c4271f0154e3ef319c144b37b2655ce91f 100644 --- a/libc/src/stdio/generic/feof.cpp +++ b/libc/src/stdio/generic/feof.cpp @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, feof, (::FILE * stream)) { - return reinterpret_cast<__llvm_libc::File *>(stream)->iseof(); + return reinterpret_cast(stream)->iseof(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/feof_unlocked.cpp b/libc/src/stdio/generic/feof_unlocked.cpp index fdb9e2ca369d711ed98d87cda2f94d9bcb9f4004..e8c718c1369613607e399f8b4560c40be619daab 100644 --- a/libc/src/stdio/generic/feof_unlocked.cpp +++ b/libc/src/stdio/generic/feof_unlocked.cpp @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, feof_unlocked, (::FILE * stream)) { - return reinterpret_cast<__llvm_libc::File *>(stream)->iseof_unlocked(); + return reinterpret_cast(stream)->iseof_unlocked(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/ferror.cpp b/libc/src/stdio/generic/ferror.cpp index 12bfc2a857a538058badf38d65d0084dd1a289f1..65cf99fe4847301dcc274d8e06594bf533dfedfc 100644 --- a/libc/src/stdio/generic/ferror.cpp +++ b/libc/src/stdio/generic/ferror.cpp @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, ferror, (::FILE * stream)) { - return reinterpret_cast<__llvm_libc::File *>(stream)->error(); + return reinterpret_cast(stream)->error(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/ferror_unlocked.cpp b/libc/src/stdio/generic/ferror_unlocked.cpp index 301aa83dac8ad0891738eea5375229c26d4a2d15..089ea4ab36b5766dfa708a2a474bd2932f241576 100644 --- a/libc/src/stdio/generic/ferror_unlocked.cpp +++ b/libc/src/stdio/generic/ferror_unlocked.cpp @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, ferror_unlocked, (::FILE * stream)) { - return reinterpret_cast<__llvm_libc::File *>(stream)->error_unlocked(); + return reinterpret_cast(stream)->error_unlocked(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/fgetc.cpp b/libc/src/stdio/generic/fgetc.cpp index 9a6109636364a3b730afda6b1f365193ad5658a3..771811382fd59542201605dea73dae8b62b69a35 100644 --- a/libc/src/stdio/generic/fgetc.cpp +++ b/libc/src/stdio/generic/fgetc.cpp @@ -12,11 +12,11 @@ #include "src/errno/libc_errno.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fgetc, (::FILE * stream)) { unsigned char c; - auto result = reinterpret_cast<__llvm_libc::File *>(stream)->read(&c, 1); + auto result = reinterpret_cast(stream)->read(&c, 1); size_t r = result.value; if (result.has_error()) libc_errno = result.error; @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, fgetc, (::FILE * stream)) { return c; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/fgetc_unlocked.cpp b/libc/src/stdio/generic/fgetc_unlocked.cpp index 032a9fbac019ce278112b4ab0f731ff089770c40..e7aaf9dc8ea22368ea20b34635ea856c54885f33 100644 --- a/libc/src/stdio/generic/fgetc_unlocked.cpp +++ b/libc/src/stdio/generic/fgetc_unlocked.cpp @@ -12,12 +12,12 @@ #include "src/errno/libc_errno.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fgetc_unlocked, (::FILE * stream)) { unsigned char c; auto result = - reinterpret_cast<__llvm_libc::File *>(stream)->read_unlocked(&c, 1); + reinterpret_cast(stream)->read_unlocked(&c, 1); size_t r = result.value; if (result.has_error()) libc_errno = result.error; @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, fgetc_unlocked, (::FILE * stream)) { return c; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/fgets.cpp b/libc/src/stdio/generic/fgets.cpp index dd5051a32cea821b80566429e10c4a0fa3097f60..8c9dac8bd3b31f9358056eb35b409e21db53add5 100644 --- a/libc/src/stdio/generic/fgets.cpp +++ b/libc/src/stdio/generic/fgets.cpp @@ -13,7 +13,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(char *, fgets, (char *__restrict str, int count, @@ -22,7 +22,7 @@ LLVM_LIBC_FUNCTION(char *, fgets, return nullptr; unsigned char c = '\0'; - auto stream = reinterpret_cast<__llvm_libc::File *__restrict>(raw_stream); + auto stream = reinterpret_cast(raw_stream); stream->lock(); // i is an int because it's frequently compared to count, which is also int. @@ -52,4 +52,4 @@ LLVM_LIBC_FUNCTION(char *, fgets, return str; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/fopen.cpp b/libc/src/stdio/generic/fopen.cpp index 3062a059ae16a7166d723fc3db0972ad9c4e62fe..794ef0366dd6693e0a07957ae782d8b94c85c54d 100644 --- a/libc/src/stdio/generic/fopen.cpp +++ b/libc/src/stdio/generic/fopen.cpp @@ -12,11 +12,11 @@ #include "src/errno/libc_errno.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(::FILE *, fopen, (const char *__restrict name, const char *__restrict mode)) { - auto result = __llvm_libc::openfile(name, mode); + auto result = LIBC_NAMESPACE::openfile(name, mode); if (!result.has_value()) { libc_errno = result.error(); return nullptr; @@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(::FILE *, fopen, return reinterpret_cast<::FILE *>(result.value()); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/fputc.cpp b/libc/src/stdio/generic/fputc.cpp index 5f41e5ca31844b98deaa3c1a99783eb930f0b06b..ecbe45e97208d483f38c5df57686147d9cf2db3a 100644 --- a/libc/src/stdio/generic/fputc.cpp +++ b/libc/src/stdio/generic/fputc.cpp @@ -12,12 +12,12 @@ #include "src/errno/libc_errno.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fputc, (int c, ::FILE *stream)) { unsigned char uc = static_cast(c); - auto result = reinterpret_cast<__llvm_libc::File *>(stream)->write(&uc, 1); + auto result = reinterpret_cast(stream)->write(&uc, 1); if (result.has_error()) libc_errno = result.error; size_t written = result.value; @@ -29,4 +29,4 @@ LLVM_LIBC_FUNCTION(int, fputc, (int c, ::FILE *stream)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/fputs.cpp b/libc/src/stdio/generic/fputs.cpp index d8ba18f003cb796a6871eea4085db878871e93cb..ef77ad43a1b42789b783e71b4c5671f615653fac 100644 --- a/libc/src/stdio/generic/fputs.cpp +++ b/libc/src/stdio/generic/fputs.cpp @@ -13,13 +13,13 @@ #include "src/errno/libc_errno.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fputs, (const char *__restrict str, ::FILE *__restrict stream)) { cpp::string_view str_view(str); - auto result = reinterpret_cast<__llvm_libc::File *>(stream)->write( + auto result = reinterpret_cast(stream)->write( str, str_view.size()); if (result.has_error()) libc_errno = result.error; @@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(int, fputs, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/fread.cpp b/libc/src/stdio/generic/fread.cpp index affc6b7e8a0da22a92ccd9ac20c7f63f100541c6..e8bd2517df6f80c0d9d5d9ee61b934e2b0f23c1e 100644 --- a/libc/src/stdio/generic/fread.cpp +++ b/libc/src/stdio/generic/fread.cpp @@ -12,18 +12,18 @@ #include "src/errno/libc_errno.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(size_t, fread, (void *__restrict buffer, size_t size, size_t nmemb, ::FILE *stream)) { if (size == 0 || nmemb == 0) return 0; - auto result = - reinterpret_cast<__llvm_libc::File *>(stream)->read(buffer, size * nmemb); + auto result = reinterpret_cast(stream)->read( + buffer, size * nmemb); if (result.has_error()) libc_errno = result.error; return result.value / size; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/fread_unlocked.cpp b/libc/src/stdio/generic/fread_unlocked.cpp index 3f922c5a5b48f71b298fda343ae4ddae5cad664a..9810c9d6519d9c26ec3c0a27df49434781f1bcd5 100644 --- a/libc/src/stdio/generic/fread_unlocked.cpp +++ b/libc/src/stdio/generic/fread_unlocked.cpp @@ -12,18 +12,18 @@ #include "src/errno/libc_errno.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(size_t, fread_unlocked, (void *__restrict buffer, size_t size, size_t nmemb, ::FILE *stream)) { if (size == 0 || nmemb == 0) return 0; - auto result = reinterpret_cast<__llvm_libc::File *>(stream)->read_unlocked( + auto result = reinterpret_cast(stream)->read_unlocked( buffer, size * nmemb); if (result.has_error()) libc_errno = result.error; return result.value / size; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/fwrite.cpp b/libc/src/stdio/generic/fwrite.cpp index cc6c45079bb2c0db0a01ff7dcd2efba34579eb38..bd11f62a7121c5daa324a4de9caca1e89fd9b373 100644 --- a/libc/src/stdio/generic/fwrite.cpp +++ b/libc/src/stdio/generic/fwrite.cpp @@ -12,14 +12,14 @@ #include "src/errno/libc_errno.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(size_t, fwrite, (const void *__restrict buffer, size_t size, size_t nmemb, ::FILE *stream)) { if (size == 0 || nmemb == 0) return 0; - auto result = reinterpret_cast<__llvm_libc::File *>(stream)->write( + auto result = reinterpret_cast(stream)->write( buffer, size * nmemb); if (result.has_error()) libc_errno = result.error; @@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(size_t, fwrite, return result.value / size; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/fwrite_unlocked.cpp b/libc/src/stdio/generic/fwrite_unlocked.cpp index 736dfe0fc761cfde66d687c9b465c71dcf763cd6..5ab7c766087b7b57bcce33dff1b073de6a7b0d28 100644 --- a/libc/src/stdio/generic/fwrite_unlocked.cpp +++ b/libc/src/stdio/generic/fwrite_unlocked.cpp @@ -12,7 +12,7 @@ #include "src/errno/libc_errno.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(size_t, fwrite_unlocked, (const void *__restrict buffer, size_t size, size_t nmemb, @@ -20,12 +20,13 @@ LLVM_LIBC_FUNCTION(size_t, fwrite_unlocked, if (size == 0 || nmemb == 0) return 0; - auto result = reinterpret_cast<__llvm_libc::File *>(stream)->write_unlocked( - buffer, size * nmemb); + auto result = + reinterpret_cast(stream)->write_unlocked( + buffer, size * nmemb); if (result.has_error()) libc_errno = result.error; return result.value / size; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/getc.cpp b/libc/src/stdio/generic/getc.cpp index 730be685c2ce23cc0f0e6867059dafabfb795c8c..5cea28d506f6bc72803993e6b298ae25f35450db 100644 --- a/libc/src/stdio/generic/getc.cpp +++ b/libc/src/stdio/generic/getc.cpp @@ -12,11 +12,11 @@ #include "src/errno/libc_errno.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, getc, (::FILE * stream)) { unsigned char c; - auto result = reinterpret_cast<__llvm_libc::File *>(stream)->read(&c, 1); + auto result = reinterpret_cast(stream)->read(&c, 1); size_t r = result.value; if (result.has_error()) libc_errno = result.error; @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, getc, (::FILE * stream)) { return c; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/getc_unlocked.cpp b/libc/src/stdio/generic/getc_unlocked.cpp index 4eae5c13d858847574f95c9173b4385bb8859e7d..883405e84bad0745e7402c86313be925e4475d3a 100644 --- a/libc/src/stdio/generic/getc_unlocked.cpp +++ b/libc/src/stdio/generic/getc_unlocked.cpp @@ -12,12 +12,12 @@ #include "src/errno/libc_errno.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, getc_unlocked, (::FILE * stream)) { unsigned char c; auto result = - reinterpret_cast<__llvm_libc::File *>(stream)->read_unlocked(&c, 1); + reinterpret_cast(stream)->read_unlocked(&c, 1); size_t r = result.value; if (result.has_error()) libc_errno = result.error; @@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(int, getc_unlocked, (::FILE * stream)) { return c; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/getchar.cpp b/libc/src/stdio/generic/getchar.cpp index 91e01e37125f2a2ce96af87985bea70724b941a1..181999fe56c4220e880ad3697f75ff36b9b36a63 100644 --- a/libc/src/stdio/generic/getchar.cpp +++ b/libc/src/stdio/generic/getchar.cpp @@ -12,7 +12,7 @@ #include "src/errno/libc_errno.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, getchar, ()) { unsigned char c; @@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, getchar, ()) { return c; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/getchar_unlocked.cpp b/libc/src/stdio/generic/getchar_unlocked.cpp index 1a9a44ea4279e86604e68f7aa89036dead2c6027..be98d0333ec87bb2946e0d3afa77a185b408f456 100644 --- a/libc/src/stdio/generic/getchar_unlocked.cpp +++ b/libc/src/stdio/generic/getchar_unlocked.cpp @@ -12,7 +12,7 @@ #include "src/errno/libc_errno.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, getchar_unlocked, ()) { unsigned char c; @@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, getchar_unlocked, ()) { return c; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/putc.cpp b/libc/src/stdio/generic/putc.cpp index 37937dfb7e6077c806dfcb910ff33c173295813d..58e3b4d1bae4dba166c431ef5c4711818f01507b 100644 --- a/libc/src/stdio/generic/putc.cpp +++ b/libc/src/stdio/generic/putc.cpp @@ -12,12 +12,12 @@ #include "src/errno/libc_errno.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, putc, (int c, ::FILE *stream)) { unsigned char uc = static_cast(c); - auto result = reinterpret_cast<__llvm_libc::File *>(stream)->write(&uc, 1); + auto result = reinterpret_cast(stream)->write(&uc, 1); if (result.has_error()) libc_errno = result.error; size_t written = result.value; @@ -29,4 +29,4 @@ LLVM_LIBC_FUNCTION(int, putc, (int c, ::FILE *stream)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/putchar.cpp b/libc/src/stdio/generic/putchar.cpp index 9190b714dd3f8d68b25deac042159b36d78e5b31..4a4aeb54c9c6f31a13025277869bb0d221f44f00 100644 --- a/libc/src/stdio/generic/putchar.cpp +++ b/libc/src/stdio/generic/putchar.cpp @@ -12,12 +12,12 @@ #include "src/errno/libc_errno.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, putchar, (int c)) { unsigned char uc = static_cast(c); - auto result = __llvm_libc::stdout->write(&uc, 1); + auto result = LIBC_NAMESPACE::stdout->write(&uc, 1); if (result.has_error()) libc_errno = result.error; size_t written = result.value; @@ -29,4 +29,4 @@ LLVM_LIBC_FUNCTION(int, putchar, (int c)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/generic/puts.cpp b/libc/src/stdio/generic/puts.cpp index ffcbf56ce96d66fb4d2a351d0fb3d8a9aecb5a51..d8d69332566cd0fe2d3ac2e9efd8b6218cefa573 100644 --- a/libc/src/stdio/generic/puts.cpp +++ b/libc/src/stdio/generic/puts.cpp @@ -13,11 +13,11 @@ #include "src/errno/libc_errno.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, puts, (const char *__restrict str)) { cpp::string_view str_view(str); - auto result = __llvm_libc::stdout->write(str, str_view.size()); + auto result = LIBC_NAMESPACE::stdout->write(str, str_view.size()); if (result.has_error()) libc_errno = result.error; size_t written = result.value; @@ -25,7 +25,7 @@ LLVM_LIBC_FUNCTION(int, puts, (const char *__restrict str)) { // The stream should be in an error state in this case. return EOF; } - result = __llvm_libc::stdout->write("\n", 1); + result = LIBC_NAMESPACE::stdout->write("\n", 1); if (result.has_error()) libc_errno = result.error; written = result.value; @@ -36,4 +36,4 @@ LLVM_LIBC_FUNCTION(int, puts, (const char *__restrict str)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/getc.h b/libc/src/stdio/getc.h index b5de6a75858072f6bf6c66378075d82138e4a11e..c085d35d7de9c77c91ebfd5844d548c71a9675b4 100644 --- a/libc/src/stdio/getc.h +++ b/libc/src/stdio/getc.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int getc(::FILE *f); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_GETC_H diff --git a/libc/src/stdio/getc_unlocked.h b/libc/src/stdio/getc_unlocked.h index b318dfc934e90c25471b52c6f22c29ae60fd3421..f4e1165dd75dcf93a9d441849ceff16416bcb31c 100644 --- a/libc/src/stdio/getc_unlocked.h +++ b/libc/src/stdio/getc_unlocked.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int getc_unlocked(::FILE *f); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_GETC_UNLOCKED_H diff --git a/libc/src/stdio/getchar.h b/libc/src/stdio/getchar.h index 51f2f7afa194534097266588117f48c6f4a89c7c..4168808d3e329968b0de3cbf18368ab0ac7a1515 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 6bbd49a76a62b853c613d1704eb1f6f4f8490293..24fdb752f5530f23415952df1df0d361e31cdf4e 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 01c34ca936b11a187f1d211134b4401bf4ebf87f..2267fdf8115eed088e8f927dc63012e3b232f80c 100644 --- a/libc/src/stdio/gpu/clearerr.cpp +++ b/libc/src/stdio/gpu/clearerr.cpp @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, clearerr, (::FILE * stream)) { rpc::Client::Port port = rpc::client.open(); @@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(void, clearerr, (::FILE * stream)) { port.close(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/fclose.cpp b/libc/src/stdio/gpu/fclose.cpp index a8e36bcb27c8585df0eec4b10bef2ad593415e6c..bdedbe51ec38eabb17f31ea8954de696539144a0 100644 --- a/libc/src/stdio/gpu/fclose.cpp +++ b/libc/src/stdio/gpu/fclose.cpp @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fclose, (::FILE * stream)) { uint64_t ret = 0; @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, fclose, (::FILE * stream)) { return static_cast(ret); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/feof.cpp b/libc/src/stdio/gpu/feof.cpp index 27d27a445812c043a1d42e2a15b6824f83fefd0a..ddcef384142c42434e6aa85d8aff9aa65669a826 100644 --- a/libc/src/stdio/gpu/feof.cpp +++ b/libc/src/stdio/gpu/feof.cpp @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, feof, (::FILE * stream)) { int ret; @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, feof, (::FILE * stream)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/ferror.cpp b/libc/src/stdio/gpu/ferror.cpp index e4bd631f392d4ead88e19b93b53baef455854509..9ed598fb67541e97547ec7de9f6aa41951b780d1 100644 --- a/libc/src/stdio/gpu/ferror.cpp +++ b/libc/src/stdio/gpu/ferror.cpp @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, ferror, (::FILE * stream)) { int ret; @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, ferror, (::FILE * stream)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/fgetc.cpp b/libc/src/stdio/gpu/fgetc.cpp index ff4ef27ccb88e9a11cb082014fd8d50cc8f1630f..56f42a04857fb28f9221e1c0196f85764a9719c8 100644 --- a/libc/src/stdio/gpu/fgetc.cpp +++ b/libc/src/stdio/gpu/fgetc.cpp @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fgetc, (::FILE * stream)) { unsigned char c; @@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(int, fgetc, (::FILE * stream)) { return c; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/fgets.cpp b/libc/src/stdio/gpu/fgets.cpp index df00451e2a9703447bf2be5ab14d303554d94ee7..4cabd15001a7f54dbd8d3747985862d9d412324f 100644 --- a/libc/src/stdio/gpu/fgets.cpp +++ b/libc/src/stdio/gpu/fgets.cpp @@ -14,7 +14,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(char *, fgets, (char *__restrict str, int count, @@ -33,8 +33,8 @@ LLVM_LIBC_FUNCTION(char *, fgets, str[i] = c; } - bool has_error = __llvm_libc::ferror(stream); - bool has_eof = __llvm_libc::feof(stream); + bool has_error = LIBC_NAMESPACE::ferror(stream); + bool has_eof = LIBC_NAMESPACE::feof(stream); if (has_error || (i == 0 && has_eof)) return nullptr; @@ -43,4 +43,4 @@ LLVM_LIBC_FUNCTION(char *, fgets, return str; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/file.h b/libc/src/stdio/gpu/file.h index 4b07f9fab2eb6255df709eeec8ed3f9a60e319e6..2cab2e6d36a25911d830a9873808d418d6cf901c 100644 --- a/libc/src/stdio/gpu/file.h +++ b/libc/src/stdio/gpu/file.h @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace file { enum Stream { @@ -94,4 +94,4 @@ LIBC_INLINE uint64_t read(::FILE *f, void *data, size_t size) { } } // namespace file -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/fopen.cpp b/libc/src/stdio/gpu/fopen.cpp index 5d88b65e9f702d0d1d0df82916a4e6e2af0198f3..41d2c89473168ee97dda2a53b626311dfb6627b8 100644 --- a/libc/src/stdio/gpu/fopen.cpp +++ b/libc/src/stdio/gpu/fopen.cpp @@ -12,7 +12,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(::FILE *, fopen, (const char *__restrict path, const char *__restrict mode)) { @@ -29,4 +29,4 @@ LLVM_LIBC_FUNCTION(::FILE *, fopen, return reinterpret_cast(file); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/fputc.cpp b/libc/src/stdio/gpu/fputc.cpp index 90d238972972ec02504f7615fc162c9119da3fa6..e6ef12f4b2f804c768b828bb853901fbbbdf3848 100644 --- a/libc/src/stdio/gpu/fputc.cpp +++ b/libc/src/stdio/gpu/fputc.cpp @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fputc, (int c, ::FILE *stream)) { unsigned char uc = static_cast(c); @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, fputc, (int c, ::FILE *stream)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/fputs.cpp b/libc/src/stdio/gpu/fputs.cpp index c5919e8913746fa20665d87c87e0c14c361e9b80..1b6e0732b98cd60aac856e314e7e020df992db6f 100644 --- a/libc/src/stdio/gpu/fputs.cpp +++ b/libc/src/stdio/gpu/fputs.cpp @@ -13,7 +13,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fputs, (const char *__restrict str, ::FILE *__restrict stream)) { @@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, fputs, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/fread.cpp b/libc/src/stdio/gpu/fread.cpp index 2b9112ee50eb39ac935ef109834eda040adb9e32..fe367ae1aa2499387f0d27b5130f03b56c195313 100644 --- a/libc/src/stdio/gpu/fread.cpp +++ b/libc/src/stdio/gpu/fread.cpp @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(size_t, fread, (void *__restrict buffer, size_t size, size_t nmemb, @@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(size_t, fread, return result / size; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/fwrite.cpp b/libc/src/stdio/gpu/fwrite.cpp index fccaabd0673ec5c2a3452c0a2dfe565c6c8d84f8..a059bd5ea3b7192442e4ec2422346acde649bb47 100644 --- a/libc/src/stdio/gpu/fwrite.cpp +++ b/libc/src/stdio/gpu/fwrite.cpp @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(size_t, fwrite, (const void *__restrict buffer, size_t size, size_t nmemb, @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(size_t, fwrite, return result / size; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/getc.cpp b/libc/src/stdio/gpu/getc.cpp index a2272221d6b7b926dd357f5a542953b74f9a8f92..b50e3963c31a1158e9c9fcbc5f21833204d225a2 100644 --- a/libc/src/stdio/gpu/getc.cpp +++ b/libc/src/stdio/gpu/getc.cpp @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, getc, (::FILE * stream)) { unsigned char c; @@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(int, getc, (::FILE * stream)) { return c; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/getchar.cpp b/libc/src/stdio/gpu/getchar.cpp index a7a6e6c55c13e1af23995e13c479672fcc641a1b..c8a004124a2e57079052ae23ed5bcf5e17bc9dbe 100644 --- a/libc/src/stdio/gpu/getchar.cpp +++ b/libc/src/stdio/gpu/getchar.cpp @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, getchar, ()) { unsigned char c; @@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(int, getchar, ()) { return c; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/putc.cpp b/libc/src/stdio/gpu/putc.cpp index d450edb6596df1c8ab447067dc270d519d568e80..b5ecbfc65d67794515cbc51e0159d8ab96a4c3dc 100644 --- a/libc/src/stdio/gpu/putc.cpp +++ b/libc/src/stdio/gpu/putc.cpp @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, putc, (int c, ::FILE *stream)) { unsigned char uc = static_cast(c); @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, putc, (int c, ::FILE *stream)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/putchar.cpp b/libc/src/stdio/gpu/putchar.cpp index df577544b8ba40563fdf983e6bfee3a4166b8673..57663eec40f3b7f8dfb3b720d76538d989d93b8b 100644 --- a/libc/src/stdio/gpu/putchar.cpp +++ b/libc/src/stdio/gpu/putchar.cpp @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, putchar, (int c)) { unsigned char uc = static_cast(c); @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, putchar, (int c)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/puts.cpp b/libc/src/stdio/gpu/puts.cpp index e50e2cc7d55d50667270925f5d048ccb7fc703f2..10573a862a4c2083a41d41870edeb14679969462 100644 --- a/libc/src/stdio/gpu/puts.cpp +++ b/libc/src/stdio/gpu/puts.cpp @@ -13,7 +13,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, puts, (const char *__restrict str)) { cpp::string_view str_view(str); @@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, puts, (const char *__restrict str)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/gpu/stderr.cpp b/libc/src/stdio/gpu/stderr.cpp index 5e7b79e80e8a190d4228e929b4569cd2b8fbf0fb..70846827064a38a93d8b9891abf07b5cc09ecfeb 100644 --- a/libc/src/stdio/gpu/stderr.cpp +++ b/libc/src/stdio/gpu/stderr.cpp @@ -8,9 +8,9 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { static struct { } stub; FILE *stderr = reinterpret_cast(&stub); -} // namespace __llvm_libc -extern "C" FILE *stderr = reinterpret_cast(&__llvm_libc::stub); +} // namespace LIBC_NAMESPACE +extern "C" FILE *stderr = reinterpret_cast(&LIBC_NAMESPACE::stub); diff --git a/libc/src/stdio/gpu/stdin.cpp b/libc/src/stdio/gpu/stdin.cpp index 408852b461de4ddbfe899e39c2e5047ab0c03f13..1a58461c3dec9313e38dc7661c654439320f49b3 100644 --- a/libc/src/stdio/gpu/stdin.cpp +++ b/libc/src/stdio/gpu/stdin.cpp @@ -8,9 +8,9 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { static struct { } stub; FILE *stdin = reinterpret_cast(&stub); -} // namespace __llvm_libc -extern "C" FILE *stdin = reinterpret_cast(&__llvm_libc::stub); +} // namespace LIBC_NAMESPACE +extern "C" FILE *stdin = reinterpret_cast(&LIBC_NAMESPACE::stub); diff --git a/libc/src/stdio/gpu/stdout.cpp b/libc/src/stdio/gpu/stdout.cpp index 02425d31e1e2513dffed8a4d0041dea62e7f825c..abeeff2ce9f53c7798ebe5e1fb5e0527c861a3ea 100644 --- a/libc/src/stdio/gpu/stdout.cpp +++ b/libc/src/stdio/gpu/stdout.cpp @@ -8,9 +8,9 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { static struct { } stub; FILE *stdout = reinterpret_cast(&stub); -} // namespace __llvm_libc -extern "C" FILE *stdout = reinterpret_cast(&__llvm_libc::stub); +} // namespace LIBC_NAMESPACE +extern "C" FILE *stdout = reinterpret_cast(&LIBC_NAMESPACE::stub); diff --git a/libc/src/stdio/linux/remove.cpp b/libc/src/stdio/linux/remove.cpp index 1f975679e2f9bf646957c31c14b08bfeb6ab5e50..b2742c29a3e26a1a971bd1ed850d68a4a5ee4f3d 100644 --- a/libc/src/stdio/linux/remove.cpp +++ b/libc/src/stdio/linux/remove.cpp @@ -15,19 +15,19 @@ #include // For AT_* macros. #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, remove, (const char *path)) { // We first try unlinking it as a file. If it is ia file, it will succeed. If // it fails with EISDIR, we will try unlinking it as a directory. - int ret = __llvm_libc::syscall_impl(SYS_unlinkat, AT_FDCWD, path, 0); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_unlinkat, AT_FDCWD, path, 0); if (ret == -EISDIR) - ret = __llvm_libc::syscall_impl(SYS_unlinkat, AT_FDCWD, path, - AT_REMOVEDIR); + ret = LIBC_NAMESPACE::syscall_impl(SYS_unlinkat, AT_FDCWD, path, + AT_REMOVEDIR); if (ret >= 0) return 0; libc_errno = -ret; return -1; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/printf.cpp b/libc/src/stdio/printf.cpp index c59a084353b5c1da12be44c681d7ba638849f8c4..5701ca9eb2704c80bc5e15e096f6803d26829e38 100644 --- a/libc/src/stdio/printf.cpp +++ b/libc/src/stdio/printf.cpp @@ -16,12 +16,12 @@ #include #ifndef LIBC_COPT_STDIO_USE_SYSTEM_FILE -#define PRINTF_STDOUT __llvm_libc::stdout +#define PRINTF_STDOUT LIBC_NAMESPACE::stdout #else // LIBC_COPT_STDIO_USE_SYSTEM_FILE #define PRINTF_STDOUT ::stdout #endif // LIBC_COPT_STDIO_USE_SYSTEM_FILE -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, printf, (const char *__restrict format, ...)) { va_list vlist; @@ -35,4 +35,4 @@ LLVM_LIBC_FUNCTION(int, printf, (const char *__restrict format, ...)) { return ret_val; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/printf.h b/libc/src/stdio/printf.h index c568b04adb7c5403463717e5fbbf248bf652ae0c..c5b4603c589d516a4393d537aeb9976181a75490 100644 --- a/libc/src/stdio/printf.h +++ b/libc/src/stdio/printf.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int printf(const char *__restrict format, ...); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_PRINTF_H diff --git a/libc/src/stdio/printf_core/char_converter.h b/libc/src/stdio/printf_core/char_converter.h index ffd2422c822f7e6f681f160b402b026fa9557f98..9b1501ff24b0d8402e4530b985ab9fcac6786352 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 e27deb4cbf5995354dec62f8c54c0ad16578d246..74a36cbf7432fbe53e447b47ffb77b48983048e1 100644 --- a/libc/src/stdio/printf_core/converter.cpp +++ b/libc/src/stdio/printf_core/converter.cpp @@ -21,7 +21,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { int convert(Writer *writer, const FormatSection &to_conv) { @@ -86,4 +86,4 @@ int convert(Writer *writer, const FormatSection &to_conv) { } } // namespace printf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/printf_core/converter.h b/libc/src/stdio/printf_core/converter.h index ae281ba99ec070e0f9f35ca271c080dc06a0c30b..d653f1e56dc28050a6714b6c6d0099684cee6726 100644 --- a/libc/src/stdio/printf_core/converter.h +++ b/libc/src/stdio/printf_core/converter.h @@ -14,7 +14,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { // convert will call a conversion function to convert the FormatSection into @@ -23,6 +23,6 @@ namespace printf_core { int convert(Writer *writer, const FormatSection &to_conv); } // namespace printf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_CONVERTER_H diff --git a/libc/src/stdio/printf_core/converter_utils.h b/libc/src/stdio/printf_core/converter_utils.h index 54948a2a5f1fd15c1d0f0c1270b91f27f5744eda..4540bba6346e2f073f0f13fe670b095b4cfd43fc 100644 --- a/libc/src/stdio/printf_core/converter_utils.h +++ b/libc/src/stdio/printf_core/converter_utils.h @@ -16,7 +16,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { LIBC_INLINE uintmax_t apply_length_modifier(uintmax_t num, LengthModifier lm) { @@ -53,6 +53,6 @@ LIBC_INLINE uintmax_t apply_length_modifier(uintmax_t num, LengthModifier lm) { } } // namespace printf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_CONVERTER_UTILS_H diff --git a/libc/src/stdio/printf_core/core_structs.h b/libc/src/stdio/printf_core/core_structs.h index 771d5a8cff437e5666b2896d99df8f50d29917b1..e96bc4dc0f8dd3ceacd38b3dab880a66f755de9e 100644 --- a/libc/src/stdio/printf_core/core_structs.h +++ b/libc/src/stdio/printf_core/core_structs.h @@ -15,7 +15,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { // These length modifiers match the length modifiers in the format string, which @@ -111,6 +111,6 @@ constexpr int NULLPTR_WRITE_ERROR = -3; constexpr int INT_CONVERSION_ERROR = -4; } // namespace printf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_CORE_STRUCTS_H diff --git a/libc/src/stdio/printf_core/float_dec_converter.h b/libc/src/stdio/printf_core/float_dec_converter.h index 5e6f1d127370ce7d532fc7a2e10f3868de5e7cc7..8c5ba0d241eda54bbffa6f3fb7f16667a3ff879d 100644 --- a/libc/src/stdio/printf_core/float_dec_converter.h +++ b/libc/src/stdio/printf_core/float_dec_converter.h @@ -28,7 +28,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { using MantissaInt = fputil::FPBits::UIntType; @@ -1176,6 +1176,6 @@ LIBC_INLINE int convert_float_dec_auto(Writer *writer, } } // namespace printf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_FLOAT_DEC_CONVERTER_H diff --git a/libc/src/stdio/printf_core/float_hex_converter.h b/libc/src/stdio/printf_core/float_hex_converter.h index 4bd0f91b68a7badd5e55735035f88ad11938a4f6..e264af9844bd2446d142eb54d17b541a95016e4a 100644 --- a/libc/src/stdio/printf_core/float_hex_converter.h +++ b/libc/src/stdio/printf_core/float_hex_converter.h @@ -22,7 +22,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { using MantissaInt = fputil::FPBits::UIntType; @@ -256,6 +256,6 @@ LIBC_INLINE int convert_float_hex_exp(Writer *writer, } } // namespace printf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_FLOAT_HEX_CONVERTER_H diff --git a/libc/src/stdio/printf_core/float_inf_nan_converter.h b/libc/src/stdio/printf_core/float_inf_nan_converter.h index 0b7a1c3835523fb6dfe776ecb6a9848077df3d5b..3c24c393b35483402420e2dc32f2c662e2dbf186 100644 --- a/libc/src/stdio/printf_core/float_inf_nan_converter.h +++ b/libc/src/stdio/printf_core/float_inf_nan_converter.h @@ -18,7 +18,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { using MantissaInt = fputil::FPBits::UIntType; @@ -79,6 +79,6 @@ LIBC_INLINE int convert_inf_nan(Writer *writer, const FormatSection &to_conv) { } } // namespace printf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_FLOAT_INF_NAN_CONVERTER_H diff --git a/libc/src/stdio/printf_core/int_converter.h b/libc/src/stdio/printf_core/int_converter.h index 044721b5afde00bd57178e78190fc2784927628d..348e81a1fa536bf0b791712fdb953ccb72f221ec 100644 --- a/libc/src/stdio/printf_core/int_converter.h +++ b/libc/src/stdio/printf_core/int_converter.h @@ -20,7 +20,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { // These functions only work on characters that are already known to be in the @@ -189,6 +189,6 @@ LIBC_INLINE int convert_int(Writer *writer, const FormatSection &to_conv) { } } // namespace printf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_INT_CONVERTER_H diff --git a/libc/src/stdio/printf_core/parser.h b/libc/src/stdio/printf_core/parser.h index ddffe9694b6671ef95d8c94603e72f62796afa55..7cf87dd6e17d1989f23ab2389a1add2861a70791 100644 --- a/libc/src/stdio/printf_core/parser.h +++ b/libc/src/stdio/printf_core/parser.h @@ -19,7 +19,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { template struct int_type_of { @@ -558,6 +558,6 @@ 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 60d1e210eee4cf86de9087f12cd6feb60c3678c0..54e70f58c87fe2894b02b28f6b7cd41398d69c6a 100644 --- a/libc/src/stdio/printf_core/printf_main.cpp +++ b/libc/src/stdio/printf_core/printf_main.cpp @@ -16,7 +16,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { int printf_main(Writer *writer, const char *__restrict str, @@ -39,4 +39,4 @@ int printf_main(Writer *writer, const char *__restrict str, } } // namespace printf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/printf_core/printf_main.h b/libc/src/stdio/printf_core/printf_main.h index 341bd4cef8543a7618090d01df3d4ece4aab3aed..15c6977622afb3f92205e5dfbcd93dc198c6bf2d 100644 --- a/libc/src/stdio/printf_core/printf_main.h +++ b/libc/src/stdio/printf_core/printf_main.h @@ -14,13 +14,13 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { int printf_main(Writer *writer, const char *__restrict str, internal::ArgList &args); } // namespace printf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_PRINTF_MAIN_H diff --git a/libc/src/stdio/printf_core/ptr_converter.h b/libc/src/stdio/printf_core/ptr_converter.h index 6304abcdb6ddafbc55ebe8951b25ebd96f78e366..73c6e608a59a78445fc48805162e633dff437088 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 460f195f5d9032a432c2861b1f139bf663bd3333..158315311e9eadec2187badbf74f844c0bd1d1e8 100644 --- a/libc/src/stdio/printf_core/string_converter.h +++ b/libc/src/stdio/printf_core/string_converter.h @@ -17,7 +17,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { LIBC_INLINE int convert_string(Writer *writer, const FormatSection &to_conv) { @@ -59,6 +59,6 @@ LIBC_INLINE int convert_string(Writer *writer, const FormatSection &to_conv) { } } // namespace printf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_STRING_CONVERTER_H diff --git a/libc/src/stdio/printf_core/vfprintf_internal.h b/libc/src/stdio/printf_core/vfprintf_internal.h index d66b53bd1bced45411fbe7d6f2e783740c720f24..c16c3ae15fb7c55e2afb631c14bdef46f4a58be3 100644 --- a/libc/src/stdio/printf_core/vfprintf_internal.h +++ b/libc/src/stdio/printf_core/vfprintf_internal.h @@ -18,26 +18,26 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { #ifndef LIBC_COPT_STDIO_USE_SYSTEM_FILE LIBC_INLINE int ferror_unlocked(FILE *f) { - return reinterpret_cast<__llvm_libc::File *>(f)->error_unlocked(); + return reinterpret_cast(f)->error_unlocked(); } LIBC_INLINE void flockfile(FILE *f) { - reinterpret_cast<__llvm_libc::File *>(f)->lock(); + reinterpret_cast(f)->lock(); } LIBC_INLINE void funlockfile(FILE *f) { - reinterpret_cast<__llvm_libc::File *>(f)->unlock(); + reinterpret_cast(f)->unlock(); } LIBC_INLINE size_t fwrite_unlocked(const void *ptr, size_t size, size_t nmemb, FILE *f) { - return reinterpret_cast<__llvm_libc::File *>(f)->write_unlocked(ptr, - size * nmemb); + return reinterpret_cast(f)->write_unlocked( + ptr, size * nmemb); } #else // defined(LIBC_COPT_STDIO_USE_SYSTEM_FILE) LIBC_INLINE int ferror_unlocked(::FILE *f) { return ::ferror_unlocked(f); } @@ -84,6 +84,6 @@ LIBC_INLINE int vfprintf_internal(::FILE *__restrict stream, } } // namespace printf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_VFPRINTF_INTERNAL_H diff --git a/libc/src/stdio/printf_core/write_int_converter.h b/libc/src/stdio/printf_core/write_int_converter.h index 82049426f7eff7e521da35956a5fb5c366b32657..35cafacd5a8c1ea06b87c9981ace5613b4c41c74 100644 --- a/libc/src/stdio/printf_core/write_int_converter.h +++ b/libc/src/stdio/printf_core/write_int_converter.h @@ -16,7 +16,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { LIBC_INLINE int convert_write_int(Writer *writer, @@ -63,6 +63,6 @@ LIBC_INLINE int convert_write_int(Writer *writer, } } // namespace printf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_PRINTF_CORE_WRITE_INT_CONVERTER_H diff --git a/libc/src/stdio/printf_core/writer.cpp b/libc/src/stdio/printf_core/writer.cpp index 5f8091aec58a289a47efdfca3fe98c5af89a2978..c831ca14c9d91724995315a3b2e8a949d67b3913 100644 --- a/libc/src/stdio/printf_core/writer.cpp +++ b/libc/src/stdio/printf_core/writer.cpp @@ -14,7 +14,7 @@ #include "src/string/memory_utils/inline_memset.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { int Writer::pad(char new_char, size_t length) { @@ -44,4 +44,4 @@ int Writer::pad(char new_char, size_t length) { } } // namespace printf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/printf_core/writer.h b/libc/src/stdio/printf_core/writer.h index 1cf05de5a49d1b790ad5a739e0781365cd70be3a..1d4ff9916ee5f5ceb2c7293690e603ee65e7b1c6 100644 --- a/libc/src/stdio/printf_core/writer.h +++ b/libc/src/stdio/printf_core/writer.h @@ -17,7 +17,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace printf_core { struct WriteBuffer { @@ -134,6 +134,6 @@ 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 f21cad0220ecb53f895eecd0c5c940252c54e00f..a8fb5b7fa97eb1021d305af46ff9316430b6d60a 100644 --- a/libc/src/stdio/putc.h +++ b/libc/src/stdio/putc.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int putc(int c, ::FILE *stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_PUTC_H diff --git a/libc/src/stdio/putchar.h b/libc/src/stdio/putchar.h index e6df8285e8b1f752c43d507330225b86c569aa24..99a7453efb11dce0657aa56b0e896a6cc60fbc34 100644 --- a/libc/src/stdio/putchar.h +++ b/libc/src/stdio/putchar.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int putchar(int c); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_PUTCHAR_H diff --git a/libc/src/stdio/puts.h b/libc/src/stdio/puts.h index fa5d6f77356aab94050f4775e474bba753270577..11fbd0be897cfafb5fa58aff29726a8def1e094d 100644 --- a/libc/src/stdio/puts.h +++ b/libc/src/stdio/puts.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int puts(const char *__restrict str); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_PUTS_H diff --git a/libc/src/stdio/remove.h b/libc/src/stdio/remove.h index 4862799bdc69b7c76a38429eed1f2de83b8615b3..8c52fe5eee8e870f34e0e89dbdf3556b409d6c0e 100644 --- a/libc/src/stdio/remove.h +++ b/libc/src/stdio/remove.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int remove(const char *path); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_REMOVE_H diff --git a/libc/src/stdio/scanf.cpp b/libc/src/stdio/scanf.cpp index 67c6e19a6ec5fd2410f005f35a34e877612eb6ca..3a9fafab38be3ac8faa732a2465c3d7dd9e745d2 100644 --- a/libc/src/stdio/scanf.cpp +++ b/libc/src/stdio/scanf.cpp @@ -16,12 +16,12 @@ #include #ifndef LIBC_COPT_STDIO_USE_SYSTEM_FILE -#define SCANF_STDIN __llvm_libc::stdin +#define SCANF_STDIN LIBC_NAMESPACE::stdin #else // LIBC_COPT_STDIO_USE_SYSTEM_FILE #define SCANF_STDIN ::stdin #endif // LIBC_COPT_STDIO_USE_SYSTEM_FILE -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, scanf, (const char *__restrict format, ...)) { va_list vlist; @@ -37,4 +37,4 @@ LLVM_LIBC_FUNCTION(int, scanf, (const char *__restrict format, ...)) { return (ret_val == -1) ? EOF : ret_val; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/scanf.h b/libc/src/stdio/scanf.h index 6b4ece12a37f53adaa2af9411fb9f2d140cfd0f3..58e42d1fac185a5bc34c198609dfd05de1c9fae0 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 5d7b7aaec3488f94b5011cd9f8fbb0ceedbd1aa6..5334af1be98e18bfc069878d2762bd31b0bd1ded 100644 --- a/libc/src/stdio/scanf_core/converter.cpp +++ b/libc/src/stdio/scanf_core/converter.cpp @@ -22,7 +22,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { int convert(Reader *reader, const FormatSection &to_conv) { @@ -99,4 +99,4 @@ int raw_match(Reader *reader, cpp::string_view raw_string) { } } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/scanf_core/converter.h b/libc/src/stdio/scanf_core/converter.h index cd91ff66a3aeddd94acab79c97c40ff8821d1a14..f741840da304e0bd73645b85aa094d1bc0eff6e8 100644 --- a/libc/src/stdio/scanf_core/converter.h +++ b/libc/src/stdio/scanf_core/converter.h @@ -15,7 +15,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { // convert will call a conversion function to convert the FormatSection into @@ -28,6 +28,6 @@ int convert(Reader *reader, const FormatSection &to_conv); int raw_match(Reader *reader, cpp::string_view raw_string); } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_CONVERTER_H diff --git a/libc/src/stdio/scanf_core/converter_utils.h b/libc/src/stdio/scanf_core/converter_utils.h index a2e36e6520bb12258b5468ca4b142c040ef3b530..a14f35796d27f2f1ba9124ba36382a01d9e414ce 100644 --- a/libc/src/stdio/scanf_core/converter_utils.h +++ b/libc/src/stdio/scanf_core/converter_utils.h @@ -17,7 +17,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { LIBC_INLINE constexpr char to_lower(char a) { return a | 32; } @@ -108,6 +108,6 @@ LIBC_INLINE void write_float_with_length(char *str, } } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_CONVERTER_UTILS_H diff --git a/libc/src/stdio/scanf_core/core_structs.h b/libc/src/stdio/scanf_core/core_structs.h index 4555595ab3bff6d956c32468b826d4d3fc00a6a6..246f770e0cabed796b82e8ba708b17fd82d4d9b8 100644 --- a/libc/src/stdio/scanf_core/core_structs.h +++ b/libc/src/stdio/scanf_core/core_structs.h @@ -16,7 +16,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { // These length modifiers match the length modifiers in the format string, which @@ -87,6 +87,6 @@ enum ErrorCodes : int { ALLOCATION_FAILURE = -4, }; } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_CORE_STRUCTS_H diff --git a/libc/src/stdio/scanf_core/current_pos_converter.h b/libc/src/stdio/scanf_core/current_pos_converter.h index be4b6553b89dc5cc266ef71addeb9279ce43d186..fd62383e394092a5606966a49a7845100d5f1829 100644 --- a/libc/src/stdio/scanf_core/current_pos_converter.h +++ b/libc/src/stdio/scanf_core/current_pos_converter.h @@ -16,7 +16,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { LIBC_INLINE int convert_current_pos(Reader *reader, @@ -26,6 +26,6 @@ LIBC_INLINE int convert_current_pos(Reader *reader, } } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_CURRENT_POS_CONVERTER_H diff --git a/libc/src/stdio/scanf_core/float_converter.cpp b/libc/src/stdio/scanf_core/float_converter.cpp index 5ffb9b09fcfc27c992a35da5c0dba3acab4bbcfb..47a43d58ba7c78a58c45a18604626ac316fde972 100644 --- a/libc/src/stdio/scanf_core/float_converter.cpp +++ b/libc/src/stdio/scanf_core/float_converter.cpp @@ -17,7 +17,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { // All of the floating point conversions are the same for scanf, every name will @@ -223,4 +223,4 @@ int convert_float(Reader *reader, const FormatSection &to_conv) { } } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/scanf_core/float_converter.h b/libc/src/stdio/scanf_core/float_converter.h index e8abe8d20bcea5f0268cc5681bdeb0a3233e97fd..a3ea1da86a3f48f009d50cd6111f769a9b8281c1 100644 --- a/libc/src/stdio/scanf_core/float_converter.h +++ b/libc/src/stdio/scanf_core/float_converter.h @@ -14,12 +14,12 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { int convert_float(Reader *reader, const FormatSection &to_conv); } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_FLOAT_CONVERTER_H diff --git a/libc/src/stdio/scanf_core/int_converter.cpp b/libc/src/stdio/scanf_core/int_converter.cpp index 6370c98e0f1603af1b8f8775c9c37212aa0b1d2e..05d6ed6e0fd352de4cd185224cc6bbee4003f2b0 100644 --- a/libc/src/stdio/scanf_core/int_converter.cpp +++ b/libc/src/stdio/scanf_core/int_converter.cpp @@ -16,7 +16,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { // This code is very similar to the code in __support/str_to_integer.h but is @@ -212,4 +212,4 @@ int convert_int(Reader *reader, const FormatSection &to_conv) { } } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/scanf_core/int_converter.h b/libc/src/stdio/scanf_core/int_converter.h index af5ab3e060a7bc0dfda526d680791950319a52b6..7c9d8b4fbae32370dd68077e582dfa9abf261e31 100644 --- a/libc/src/stdio/scanf_core/int_converter.h +++ b/libc/src/stdio/scanf_core/int_converter.h @@ -14,12 +14,12 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { int convert_int(Reader *reader, const FormatSection &to_conv); } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_INT_CONVERTER_H diff --git a/libc/src/stdio/scanf_core/parser.h b/libc/src/stdio/scanf_core/parser.h index f0cebc8de1c362dc4bc80978cf2d2fb5bf395a9b..7f3a53be3570088611ced4f154526d874aee5185 100644 --- a/libc/src/stdio/scanf_core/parser.h +++ b/libc/src/stdio/scanf_core/parser.h @@ -18,7 +18,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { #ifndef LIBC_COPT_SCANF_DISABLE_INDEX_MODE @@ -280,6 +280,6 @@ 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 31d6476a2da1ba5429932a8180a7da7d70c2c3d0..cc233c36562904217fbd498a3dcfef7bf19a31e5 100644 --- a/libc/src/stdio/scanf_core/ptr_converter.cpp +++ b/libc/src/stdio/scanf_core/ptr_converter.cpp @@ -15,7 +15,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { int convert_pointer(Reader *reader, const FormatSection &to_conv) { static const char nullptr_string[] = "(nullptr)"; @@ -40,4 +40,4 @@ int convert_pointer(Reader *reader, const FormatSection &to_conv) { return convert_int(reader, to_conv); } } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/scanf_core/ptr_converter.h b/libc/src/stdio/scanf_core/ptr_converter.h index 642898c1db18f2499a471977a9dfc62bb16d06e5..363d9aacde7be82fddffc91248f80f1d1be8ec70 100644 --- a/libc/src/stdio/scanf_core/ptr_converter.h +++ b/libc/src/stdio/scanf_core/ptr_converter.h @@ -14,12 +14,12 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { int convert_pointer(Reader *reader, const FormatSection &to_conv); } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_PTR_CONVERTER_H diff --git a/libc/src/stdio/scanf_core/reader.cpp b/libc/src/stdio/scanf_core/reader.cpp index 45241d8d86b01fe4f1f8ef289abb192ab999259e..eca0e3784dc8d1744419ea1f9ae4a259d7b943b6 100644 --- a/libc/src/stdio/scanf_core/reader.cpp +++ b/libc/src/stdio/scanf_core/reader.cpp @@ -9,7 +9,7 @@ #include "src/stdio/scanf_core/reader.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { void Reader::ungetc(char c) { @@ -25,4 +25,4 @@ void Reader::ungetc(char c) { stream_ungetc(static_cast(c), input_stream); } } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/scanf_core/reader.h b/libc/src/stdio/scanf_core/reader.h index 7e9cfc5c8ca2fb197578ba23e9e9b412667ef176..d8647fe2c4ec7b3fa24f20e8a7864b3c7ab4c565 100644 --- a/libc/src/stdio/scanf_core/reader.h +++ b/libc/src/stdio/scanf_core/reader.h @@ -12,7 +12,7 @@ #include "src/__support/macros/attributes.h" // For LIBC_INLINE #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { using StreamGetc = int (*)(void *); @@ -67,6 +67,6 @@ 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 ba6a92c41eea3ed8712b73303f1bb55ce8664625..dc7740d64b665b7de380e1f27dc12d0fda2f4d57 100644 --- a/libc/src/stdio/scanf_core/scanf_main.cpp +++ b/libc/src/stdio/scanf_core/scanf_main.cpp @@ -16,7 +16,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { int scanf_main(Reader *reader, const char *__restrict str, @@ -42,4 +42,4 @@ int scanf_main(Reader *reader, const char *__restrict str, } } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/scanf_core/scanf_main.h b/libc/src/stdio/scanf_core/scanf_main.h index d1db46b7c77dc148d9021278d356676754c8a818..f1688d648ccc88832d684a92a9d4df215021a9ec 100644 --- a/libc/src/stdio/scanf_core/scanf_main.h +++ b/libc/src/stdio/scanf_core/scanf_main.h @@ -14,13 +14,13 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { int scanf_main(Reader *reader, const char *__restrict str, internal::ArgList &args); } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_SCANF_MAIN_H diff --git a/libc/src/stdio/scanf_core/string_converter.cpp b/libc/src/stdio/scanf_core/string_converter.cpp index bdbb5c87f75e55914d1bcd6f72c3d0aa54c773f8..94a7fc4e5fe0d3d369311181c11e2c5d569084ad 100644 --- a/libc/src/stdio/scanf_core/string_converter.cpp +++ b/libc/src/stdio/scanf_core/string_converter.cpp @@ -15,7 +15,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { int convert_string(Reader *reader, const FormatSection &to_conv) { @@ -73,4 +73,4 @@ int convert_string(Reader *reader, const FormatSection &to_conv) { } } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/scanf_core/string_converter.h b/libc/src/stdio/scanf_core/string_converter.h index 4113f5cb9a3693287b0a01b0d41005ac02898962..165fc47e4bdf78eb8e3fb567d8ae59726d6faca1 100644 --- a/libc/src/stdio/scanf_core/string_converter.h +++ b/libc/src/stdio/scanf_core/string_converter.h @@ -14,12 +14,12 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace scanf_core { int convert_string(Reader *reader, const FormatSection &to_conv); } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_STRING_CONVERTER_H diff --git a/libc/src/stdio/scanf_core/vfscanf_internal.h b/libc/src/stdio/scanf_core/vfscanf_internal.h index 715d31ab13eb075b0cdc8b4902d2b32c0f260daf..8081136d471a20372b5ed60dd8a9d4ab5af8f6a0 100644 --- a/libc/src/stdio/scanf_core/vfscanf_internal.h +++ b/libc/src/stdio/scanf_core/vfscanf_internal.h @@ -16,23 +16,24 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { #ifndef LIBC_COPT_STDIO_USE_SYSTEM_FILE LIBC_INLINE void flockfile(FILE *f) { - reinterpret_cast<__llvm_libc::File *>(f)->lock(); + reinterpret_cast(f)->lock(); } LIBC_INLINE void funlockfile(FILE *f) { - reinterpret_cast<__llvm_libc::File *>(f)->unlock(); + reinterpret_cast(f)->unlock(); } LIBC_INLINE int getc(void *f) { unsigned char c; - auto result = reinterpret_cast<__llvm_libc::File *>(f)->read_unlocked(&c, 1); + auto result = + reinterpret_cast(f)->read_unlocked(&c, 1); size_t r = result.value; if (result.has_error() || r != 1) return '\0'; @@ -41,11 +42,11 @@ LIBC_INLINE int getc(void *f) { } LIBC_INLINE void ungetc(int c, void *f) { - reinterpret_cast<__llvm_libc::File *>(f)->ungetc_unlocked(c); + reinterpret_cast(f)->ungetc_unlocked(c); } LIBC_INLINE int ferror_unlocked(FILE *f) { - return reinterpret_cast<__llvm_libc::File *>(f)->error_unlocked(); + return reinterpret_cast(f)->error_unlocked(); } #else // defined(LIBC_COPT_STDIO_USE_SYSTEM_FILE) @@ -83,6 +84,6 @@ LIBC_INLINE int vfscanf_internal(::FILE *__restrict stream, return retval; } } // namespace scanf_core -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_SCANF_CORE_VFSCANF_INTERNAL_H diff --git a/libc/src/stdio/setbuf.cpp b/libc/src/stdio/setbuf.cpp index cb30fe3065f0a74ba5e492e2b14c806f13771070..8819901849a08f70f9a9a7dd60ffc3a6cef94f51 100644 --- a/libc/src/stdio/setbuf.cpp +++ b/libc/src/stdio/setbuf.cpp @@ -12,17 +12,17 @@ #include "src/errno/libc_errno.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, setbuf, (::FILE *__restrict stream, char *__restrict buf)) { int mode = _IOFBF; if (buf == nullptr) mode = _IONBF; - int err = reinterpret_cast<__llvm_libc::File *>(stream)->set_buffer( + int err = reinterpret_cast(stream)->set_buffer( buf, BUFSIZ, mode); if (err != 0) libc_errno = err; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/setbuf.h b/libc/src/stdio/setbuf.h index 7a158ac0f173e35e6788849cdb4b72a64e9e8fdf..9c7aab95d2c9e368ceafa8f0f9575462a77be7ed 100644 --- a/libc/src/stdio/setbuf.h +++ b/libc/src/stdio/setbuf.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void setbuf(::FILE *__restrict stream, char *__restrict buf); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_SETBUF_H diff --git a/libc/src/stdio/setvbuf.cpp b/libc/src/stdio/setvbuf.cpp index 9080c55cf9581c87dab4f8cbe90dacddd8a2fa22..5fdaebcdb75c2b380aa27722872aa0f76ee03ae9 100644 --- a/libc/src/stdio/setvbuf.cpp +++ b/libc/src/stdio/setvbuf.cpp @@ -12,16 +12,16 @@ #include "src/errno/libc_errno.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, setvbuf, (::FILE *__restrict stream, char *__restrict buf, int type, size_t size)) { - int err = reinterpret_cast<__llvm_libc::File *>(stream)->set_buffer(buf, size, - type); + int err = reinterpret_cast(stream)->set_buffer( + buf, size, type); if (err != 0) libc_errno = err; return err; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/setvbuf.h b/libc/src/stdio/setvbuf.h index bceedd8b44113a76c3d07c868b71b051e55252c7..21d9c9918ffa12c1225aad37ce91f7661c173ac3 100644 --- a/libc/src/stdio/setvbuf.h +++ b/libc/src/stdio/setvbuf.h @@ -11,11 +11,11 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int setvbuf(::FILE *__restrict stream, char *__restrict buf, int type, size_t size); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_SETVBUF_H diff --git a/libc/src/stdio/snprintf.cpp b/libc/src/stdio/snprintf.cpp index 4e1973fe9be3d10d65bca23adcca7824f90270e7..fbfc2b218032630550db1bd6322f5c055a99f65b 100644 --- a/libc/src/stdio/snprintf.cpp +++ b/libc/src/stdio/snprintf.cpp @@ -15,7 +15,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, snprintf, (char *__restrict buffer, size_t buffsz, @@ -35,4 +35,4 @@ LLVM_LIBC_FUNCTION(int, snprintf, return ret_val; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/snprintf.h b/libc/src/stdio/snprintf.h index ec223be0e7baa67176d6eb65f44e610a0a169d62..0e4e398abc391bd550ea1dc6c542a3afc9c4ce9c 100644 --- a/libc/src/stdio/snprintf.h +++ b/libc/src/stdio/snprintf.h @@ -11,11 +11,11 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int snprintf(char *__restrict buffer, size_t buffsz, const char *__restrict format, ...); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_SNPRINTF_H diff --git a/libc/src/stdio/sprintf.cpp b/libc/src/stdio/sprintf.cpp index 3e4206be0aa6980f0f4477d3fc524e0f05a172b5..11f2f1a8634ff20950c1b5e877ec19f32c2e8808 100644 --- a/libc/src/stdio/sprintf.cpp +++ b/libc/src/stdio/sprintf.cpp @@ -15,7 +15,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sprintf, (char *__restrict buffer, const char *__restrict format, @@ -35,4 +35,4 @@ LLVM_LIBC_FUNCTION(int, sprintf, return ret_val; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/sprintf.h b/libc/src/stdio/sprintf.h index 234de6e165223daf06dba844b0c9d05c9d93ba1a..14bb4fa121f42f8deaa36ac76a2794857f085b3e 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 1f3e5ba888cd8fadd91bd66b162b0ac74a0414e5..9bbd813514ffa0dcab40359cc5b0df63ff89caa3 100644 --- a/libc/src/stdio/sscanf.cpp +++ b/libc/src/stdio/sscanf.cpp @@ -16,7 +16,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, sscanf, (const char *__restrict buffer, @@ -36,4 +36,4 @@ LLVM_LIBC_FUNCTION(int, sscanf, return (ret_val == -1) ? EOF : ret_val; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/sscanf.h b/libc/src/stdio/sscanf.h index 7f63638e4c1d903667b4e6b626083956b6fcfa8d..9e4b28e0033cf99a45aa7df56aa1a1cc3bf35b7d 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 de6ce0ba0683d39ba32fbbab91426bc9a285617c..ccfbfb0121c86f3bb32771c9696ee65ef9ce4768 100644 --- a/libc/src/stdio/ungetc.cpp +++ b/libc/src/stdio/ungetc.cpp @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, ungetc, (int c, ::FILE *stream)) { - return reinterpret_cast<__llvm_libc::File *>(stream)->ungetc(c); + return reinterpret_cast(stream)->ungetc(c); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/ungetc.h b/libc/src/stdio/ungetc.h index b5b7acb5962c19b1701fa1dfb2b4ae6ad30f5d7b..c24d8e5600cadfed23ed3a4b3a08180b0f5c216c 100644 --- a/libc/src/stdio/ungetc.h +++ b/libc/src/stdio/ungetc.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int ungetc(int c, ::FILE *stream); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_UNGETC_H diff --git a/libc/src/stdio/vfprintf.cpp b/libc/src/stdio/vfprintf.cpp index aa56c26b46d6a2d2b680446dbb9bab524f4b1a52..2504ce8a20bac5ce65b0316cb52f708ae878b42d 100644 --- a/libc/src/stdio/vfprintf.cpp +++ b/libc/src/stdio/vfprintf.cpp @@ -15,7 +15,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, vfprintf, (::FILE *__restrict stream, const char *__restrict format, @@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(int, vfprintf, return ret_val; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/vfprintf.h b/libc/src/stdio/vfprintf.h index b4a2d5e24042c6c0920049253fdf90709381c739..01827c59d6ce15f24409e4fbd257d1a916603b6e 100644 --- a/libc/src/stdio/vfprintf.h +++ b/libc/src/stdio/vfprintf.h @@ -12,11 +12,11 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int vfprintf(::FILE *__restrict stream, const char *__restrict format, va_list vlist); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_VFPRINTF_H diff --git a/libc/src/stdio/vprintf.cpp b/libc/src/stdio/vprintf.cpp index 0789ee9cfc3c2943acbc6ac5ea7ff587da71cdc8..eff968d1e9134f17e0e96c9fcb066388d4ecde97 100644 --- a/libc/src/stdio/vprintf.cpp +++ b/libc/src/stdio/vprintf.cpp @@ -16,12 +16,12 @@ #include #ifndef LIBC_COPT_STDIO_USE_SYSTEM_FILE -#define PRINTF_STDOUT __llvm_libc::stdout +#define PRINTF_STDOUT LIBC_NAMESPACE::stdout #else // LIBC_COPT_STDIO_USE_SYSTEM_FILE #define PRINTF_STDOUT ::stdout #endif // LIBC_COPT_STDIO_USE_SYSTEM_FILE -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, vprintf, (const char *__restrict format, va_list vlist)) { @@ -33,4 +33,4 @@ LLVM_LIBC_FUNCTION(int, vprintf, return ret_val; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/vprintf.h b/libc/src/stdio/vprintf.h index ffc5d39eaede89735c1ef8306d4e2d807593a5e8..fe4252bd86203bd216e26a5cf461d12aa437971d 100644 --- a/libc/src/stdio/vprintf.h +++ b/libc/src/stdio/vprintf.h @@ -12,10 +12,10 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int vprintf(const char *__restrict format, va_list vlist); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_VPRINTF_H diff --git a/libc/src/stdio/vsnprintf.cpp b/libc/src/stdio/vsnprintf.cpp index 0dc34a83fd441d76363f9eb6bd3990b76083c08a..9446d3b223506bb9c5a95844a86dfad54a631201 100644 --- a/libc/src/stdio/vsnprintf.cpp +++ b/libc/src/stdio/vsnprintf.cpp @@ -15,7 +15,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, vsnprintf, (char *__restrict buffer, size_t buffsz, @@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(int, vsnprintf, return ret_val; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/vsnprintf.h b/libc/src/stdio/vsnprintf.h index caa381e8383ad179e5b724acb037503aa7348c04..6da25fc66f7920ed4f8b67eaf4cdd825f4496488 100644 --- a/libc/src/stdio/vsnprintf.h +++ b/libc/src/stdio/vsnprintf.h @@ -12,11 +12,11 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int vsnprintf(char *__restrict buffer, size_t buffsz, const char *__restrict format, va_list vlist); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_VSNPRINTF_H diff --git a/libc/src/stdio/vsprintf.cpp b/libc/src/stdio/vsprintf.cpp index cf86f92ced4c317c665a4415f7e2da56941d8c21..5ebdf9a2a539fec092b920c1a3e1c5f652d119cb 100644 --- a/libc/src/stdio/vsprintf.cpp +++ b/libc/src/stdio/vsprintf.cpp @@ -15,7 +15,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, vsprintf, (char *__restrict buffer, const char *__restrict format, @@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(int, vsprintf, return ret_val; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdio/vsprintf.h b/libc/src/stdio/vsprintf.h index a129a2a420c2b8c739a9f3379f43f79d98217407..fe8def5994214a168abd525a90ee897188d9731f 100644 --- a/libc/src/stdio/vsprintf.h +++ b/libc/src/stdio/vsprintf.h @@ -11,11 +11,11 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int vsprintf(char *__restrict buffer, const char *__restrict format, va_list vlist); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDIO_VSPRINTF_H diff --git a/libc/src/stdlib/_Exit.cpp b/libc/src/stdlib/_Exit.cpp index 5aec134b1c71c222e29a917d8a8dbc8ccaa65234..85684d1e90879ef52fe49b673b388ac429e18160 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 f4ae3266ff301948ea6ee8b36d02ea1c505db54f..bc05fafeb766b25813ea294b06760087c8821aa6 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 d1e4385b6c6e23e874ee7aa972f63e12c9d63295..d3bf1e9e477c2babe8bc5f9a7d2db1e519ff0183 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 eef7937067eb888e617ac52d2422485c48fe1400..6be63e0468f527aa42bfd82d1c62f472f90f5d7f 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 42ef7f885ed654af63efdbeff61d1f3483803ffb..19cef1446bd36df9d3f48fbc9def9ef385b3dcaf 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 118c46a72723c83debd60c409f9623e60ec5d292..10dff42b1be92546aa492e6a3b1ff827e92dac83 100644 --- a/libc/src/stdlib/atexit.cpp +++ b/libc/src/stdlib/atexit.cpp @@ -12,7 +12,7 @@ #include "src/__support/fixedvector.h" #include "src/__support/threads/mutex.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace { @@ -83,4 +83,4 @@ LLVM_LIBC_FUNCTION(int, atexit, (StdCAtExitCallback * callback)) { {&stdc_at_exit_func, reinterpret_cast(callback)}); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdlib/atexit.h b/libc/src/stdlib/atexit.h index 920d1eb9cf27733520ccddb3b53c9bb3eef6cbd5..7cf9d7c92191ddfa35df1092f5fc12937600f361 100644 --- a/libc/src/stdlib/atexit.h +++ b/libc/src/stdlib/atexit.h @@ -11,12 +11,12 @@ #include // For size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { constexpr size_t CALLBACK_LIST_SIZE_FOR_TESTS = 1024; int atexit(void (*function)()); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDLIB_ATEXIT_H diff --git a/libc/src/stdlib/atof.cpp b/libc/src/stdlib/atof.cpp index 2359ce7cc8e2a45ffc0b7a9e3babd67476f7f5ac..61eb7db0056f189f9367f4545fc8f4d4ee06fb6c 100644 --- a/libc/src/stdlib/atof.cpp +++ b/libc/src/stdlib/atof.cpp @@ -11,7 +11,7 @@ #include "src/__support/str_to_float.h" #include "src/errno/libc_errno.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(double, atof, (const char *str)) { auto result = internal::strtofloatingpoint(str); @@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(double, atof, (const char *str)) { return result.value; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdlib/atof.h b/libc/src/stdlib/atof.h index c897a7e410ae5de7cd0dfcb523bca1b09ee55e25..cc9ae5157d6a52a46bdabae3c5261d1e92fcd52a 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 eec15aa95671b39ea9f127b25f44630fc5e73c0c..d1dc3203d3c57026c4d05434aae5788f41645997 100644 --- a/libc/src/stdlib/atoi.cpp +++ b/libc/src/stdlib/atoi.cpp @@ -11,7 +11,7 @@ #include "src/__support/str_to_integer.h" #include "src/errno/libc_errno.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, atoi, (const char *str)) { // This is done because the standard specifies that atoi is identical to @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, atoi, (const char *str)) { return static_cast(result); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdlib/atoi.h b/libc/src/stdlib/atoi.h index bb6c978d42f327dc4c53e582243314fcd21b9c58..fb5de31860d02d291194f734c2d1e5def693eac7 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 78928e81fa20f677cb3a536f821b6e7e10c5d24f..5586db7838c6b43c8c7f7a4cfdcf5503e0ac3a6c 100644 --- a/libc/src/stdlib/atol.cpp +++ b/libc/src/stdlib/atol.cpp @@ -11,7 +11,7 @@ #include "src/__support/str_to_integer.h" #include "src/errno/libc_errno.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(long, atol, (const char *str)) { auto result = internal::strtointeger(str, 10); @@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(long, atol, (const char *str)) { return result; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdlib/atol.h b/libc/src/stdlib/atol.h index 8ba6337aa6ebafa16d9a34995adb0f17d8810c45..690731f8714d89f52fa868ccf3e765debe1aac56 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 50472261dca25dbb25ed7b7faa3ebd8276986a2b..921459ddc3ac3009d8344372d139b8d00ac3cad3 100644 --- a/libc/src/stdlib/atoll.cpp +++ b/libc/src/stdlib/atoll.cpp @@ -11,7 +11,7 @@ #include "src/__support/str_to_integer.h" #include "src/errno/libc_errno.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(long long, atoll, (const char *str)) { auto result = internal::strtointeger(str, 10); @@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(long long, atoll, (const char *str)) { return result; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdlib/atoll.h b/libc/src/stdlib/atoll.h index d99184fdd0591a06fb60bc070ed794cfd72798b7..4746eb1e5e30754e6162f03ee85d9510cbc48c54 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 f3164ce5f09fcc7207bea2a7f575c3562f018feb..4dd85367411e64f767fd49a2ef5db1f2954b1e80 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 a298e516ae701345a96517c8d0e4f62c78928d7f..4292d6b6fe0465bd704d973831362691143b8767 100644 --- a/libc/src/stdlib/bsearch.cpp +++ b/libc/src/stdlib/bsearch.cpp @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void *, bsearch, (const void *key, const void *array, size_t array_size, @@ -44,4 +44,4 @@ LLVM_LIBC_FUNCTION(void *, bsearch, return nullptr; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdlib/bsearch.h b/libc/src/stdlib/bsearch.h index aab86dcd71984a5fe77219951b197dc03f3581a1..1de7e051ff6c41abb73541e4fe73bbf08e4a3696 100644 --- a/libc/src/stdlib/bsearch.h +++ b/libc/src/stdlib/bsearch.h @@ -11,11 +11,11 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void *bsearch(const void *key, const void *array, size_t array_size, size_t elem_size, int (*compare)(const void *, const void *)); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif //LLVM_LIBC_SRC_STDLIB_BSEARCH_H diff --git a/libc/src/stdlib/div.cpp b/libc/src/stdlib/div.cpp index 44f1d9fd1bb9d7875fa83755894584448e9befe0..ee7c335bdb7fd2fb8facbc7552aa1dc5498755c7 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 46d59485bf517bdee318c7b03d7fd7e81109000b..3a6853f7c95f537eaac91b8147dfc9ed3d83cecc 100644 --- a/libc/src/stdlib/div.h +++ b/libc/src/stdlib/div.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { div_t div(int x, int y); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDLIB_DIV_H diff --git a/libc/src/stdlib/exit.cpp b/libc/src/stdlib/exit.cpp index 6e2f1042738cfdf4ee49e287d747249c80285b91..cc5ae6648d11f234acd318689e57d05cbb7c5940 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 cbd9f9720cd39da1671b71f50bba36d8609f0ec1..b13573547fbf89c9c627b793789dd6ae21776306 100644 --- a/libc/src/stdlib/exit.h +++ b/libc/src/stdlib/exit.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { [[noreturn]] void exit(int status); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDLIB_EXIT_H diff --git a/libc/src/stdlib/free.h b/libc/src/stdlib/free.h index 81299376f9735af28e06a6be2602dd8323cdb8a0..f802f1d192d810c3c30bf5b31479631a5079e43d 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 bb29e2c79969d3c7eb6539fef2a549c6a2b5300b..08397e0d805716181d71dab502dd45560070b8ac 100644 --- a/libc/src/stdlib/getenv.cpp +++ b/libc/src/stdlib/getenv.cpp @@ -13,19 +13,19 @@ #include // For size_t. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(char *, getenv, (const char *name)) { - char **env_ptr = reinterpret_cast(__llvm_libc::app.envPtr); + char **env_ptr = reinterpret_cast(LIBC_NAMESPACE::app.envPtr); if (name == nullptr || env_ptr == nullptr) return nullptr; - __llvm_libc::cpp::string_view env_var_name(name); + LIBC_NAMESPACE::cpp::string_view env_var_name(name); if (env_var_name.size() == 0) return nullptr; for (char **env = env_ptr; *env != nullptr; env++) { - __llvm_libc::cpp::string_view cur(*env); + LIBC_NAMESPACE::cpp::string_view cur(*env); if (!cur.starts_with(env_var_name)) continue; @@ -41,4 +41,4 @@ LLVM_LIBC_FUNCTION(char *, getenv, (const char *name)) { return nullptr; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdlib/getenv.h b/libc/src/stdlib/getenv.h index a7eac3172de84f2150a096fc1773e5ca8c7887d3..adb386b18ca81d155f93ced540b44c0a80271f5b 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 441e776efd2349ef9add5bc3c8e35135fe678f32..f3b052be6d24db867dca2a9ed09f047cd68af382 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 64b60384581f7946b2c4ad2e9f9459a35ac79c78..3a41e5febad0bba53c60bea3e635c9272b03ab4c 100644 --- a/libc/src/stdlib/gpu/free.cpp +++ b/libc/src/stdlib/gpu/free.cpp @@ -10,7 +10,7 @@ #include "src/__support/RPC/rpc_client.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, free, (void *ptr)) { rpc::Client::Port port = rpc::client.open(); @@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(void, free, (void *ptr)) { port.close(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdlib/gpu/malloc.cpp b/libc/src/stdlib/gpu/malloc.cpp index c63b8383f6b16313b83a83f8789909d7f0c05586..a219690783051339447284005d0d65cd546bd9c7 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 a32f3055c333253788e340933907980941d31b4e..d9237fad910c58e9a498a8eb3d18e68edf2bb7d3 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 0f0ea99dc22a7ccfcb5bbb29f33868c4dbacb923..b7af538cd52c0390b3d1d4baa836e9d03b90389d 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 b08dc65c7c7e23ddd9be6c380dfc4e30fdb0c4ca..57e2250063375b6b1607e40ca67fc2a2916ef012 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 ab2fe0961b32ebf5f21c19c2d145ef07860d3d0f..0f0fafa7498b5ea97a44088f8d3e7312d45905a7 100644 --- a/libc/src/stdlib/ldiv.h +++ b/libc/src/stdlib/ldiv.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { ldiv_t ldiv(long x, long y); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDLIB_LDIV_H diff --git a/libc/src/stdlib/linux/abort.cpp b/libc/src/stdlib/linux/abort.cpp index 1da81611273dea7c0f8770083493768e8cc5095e..59feec3e5a06df3aaf11a1ae8be8ae40856080cd 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 a72f3625567d84e9e8ef9728db79929bdf2138de..f42c2b8a993dd08269914f552b0cbc8f8591086d 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 f173431a14f15c9dc8b469ae43b9851f5b443dd3..953fe1709c1a70085a7653931541a8fcdbe9138c 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 ef3d037f1ded21eea2b89136529dc31b0f76e1ad..ff2fdf8eff33ddd37ee74623e8ad9aad45d6c1fc 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 b361e4e1aaa36305c6f1d7edb2b1599ca2224f86..ee7f4d37c7469327fd362c84fa2827b2fc7d123e 100644 --- a/libc/src/stdlib/lldiv.h +++ b/libc/src/stdlib/lldiv.h @@ -10,10 +10,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { lldiv_t lldiv(long long x, long long y); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDLIB_LLDIV_H diff --git a/libc/src/stdlib/malloc.h b/libc/src/stdlib/malloc.h index ecdf9c0145a9637db0951fb6ee548abf3e51c683..514e2b133c7b17a4df9e954a57c4ed14951411ce 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 73cf5f894aacd46e0f6a48e39b407297093827de..f040f375ea59e73afc770efada2fb58b0e674cbd 100644 --- a/libc/src/stdlib/qsort.cpp +++ b/libc/src/stdlib/qsort.cpp @@ -12,7 +12,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, qsort, (void *array, size_t array_size, size_t elem_size, @@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(void, qsort, array_size, elem_size, c)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdlib/qsort.h b/libc/src/stdlib/qsort.h index d716089e484df25f4efec22a731bbe55a6af0793..5c78481ad70131609251d934b8571c06e09d7f9f 100644 --- a/libc/src/stdlib/qsort.h +++ b/libc/src/stdlib/qsort.h @@ -11,11 +11,11 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void qsort(void *array, size_t array_size, size_t elem_size, int (*compare)(const void *, const void *)); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDLIB_QSORT_H diff --git a/libc/src/stdlib/qsort_r.cpp b/libc/src/stdlib/qsort_r.cpp index add030879655a36c5c9a964b36a2a9185d405101..758991848eff87615dd05bb0df470e986eb22d9c 100644 --- a/libc/src/stdlib/qsort_r.cpp +++ b/libc/src/stdlib/qsort_r.cpp @@ -12,7 +12,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, qsort_r, (void *array, size_t array_size, size_t elem_size, @@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(void, qsort_r, array_size, elem_size, c)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdlib/qsort_r.h b/libc/src/stdlib/qsort_r.h index a998b0533936017ef0aa0d33cb6d265e80e0d105..fab0576ed803f010e06a3ac74b2f09f54c4ecb7c 100644 --- a/libc/src/stdlib/qsort_r.h +++ b/libc/src/stdlib/qsort_r.h @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // This qsort_r uses the glibc argument ordering instead of the BSD argument // ordering (which puts arg before the function pointer). Putting arg after the @@ -21,6 +21,6 @@ namespace __llvm_libc { void qsort_r(void *array, size_t array_size, size_t elem_size, int (*compare)(const void *, const void *, void *), void *arg); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDLIB_QSORT_R_H diff --git a/libc/src/stdlib/qsort_util.h b/libc/src/stdlib/qsort_util.h index e9aefe448405f9655ed65f719f5ce9d74ee19fad..f4b8094d05a9a71c1d842f71d6c9830681a81c96 100644 --- a/libc/src/stdlib/qsort_util.h +++ b/libc/src/stdlib/qsort_util.h @@ -13,7 +13,7 @@ #include #include -namespace __llvm_libc::internal { +namespace LIBC_NAMESPACE::internal { // A simple quicksort implementation using the Hoare partition scheme. @@ -147,6 +147,6 @@ LIBC_INLINE void quicksort(const Array &array) { quicksort(array.make_array(split_index, array.size() - split_index)); } -} // namespace __llvm_libc::internal +} // namespace LIBC_NAMESPACE::internal #endif // LLVM_LIBC_SRC_STDLIB_QSORT_UTIL_H diff --git a/libc/src/stdlib/rand.cpp b/libc/src/stdlib/rand.cpp index 771944f8b336fb70008f398ecb259107c4cc9e2d..c5737a8b8454775ee662ecb682b76f23157cb113 100644 --- a/libc/src/stdlib/rand.cpp +++ b/libc/src/stdlib/rand.cpp @@ -10,7 +10,7 @@ #include "src/__support/common.h" #include "src/stdlib/rand_util.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // An implementation of the xorshift64star pseudo random number generator. This // is a good general purpose generator for most non-cryptographics applications. @@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(int, rand, (void)) { return static_cast((rand_next * 0x2545F4914F6CDD1Dul) >> 32) & RAND_MAX; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/stdlib/rand.h b/libc/src/stdlib/rand.h index b421161f6388ff180d6ccea492aa4c1a1681de3c..72bb147849851c3e10c920796a879706e905ac0c 100644 --- a/libc/src/stdlib/rand.h +++ b/libc/src/stdlib/rand.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int rand(void); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDLIB_RAND_H diff --git a/libc/src/stdlib/rand_util.cpp b/libc/src/stdlib/rand_util.cpp index dac8dca2804e1c24684a4c2f1e2654ada30fcd90..fc2cd304e77d297f575fd5328913ac0b37526ed4 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 4cbfa1478ef7bb29054cf6ce608f28a543732b61..55c36a45bbc6b943512bc4498444df568c00b317 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 d93d86712ecd10bff7e498b7d13d6a99b2402000..008c7a9e565e41b0fef9068f1b3be31346908774 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 ff2f138ea222235a201b3fd0a5433c9831781401..1bcf8de78c0a4f6aed550c872bb454dc24e6b604 100644 --- a/libc/src/stdlib/srand.h +++ b/libc/src/stdlib/srand.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void srand(unsigned int seed); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STDLIB_SRAND_H diff --git a/libc/src/stdlib/strtod.cpp b/libc/src/stdlib/strtod.cpp index eb3f290487c4ab517ba708bb48b1590b6dbb1f2d..db5e0edefb5b381fc3468ba1694d7119a689694a 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 1a8b9dcc95b9990df5c92be11cd2744a86054bed..5efad845fdee34bd51b42292d9a036cfe33e2591 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 f4b90e860c817bafaaf4a25684d4ef919ad895ac..2cc8829f63d34cc9dadd6388519fefbbea69ed67 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 3ebbd1112483b0ead5fcb181a6ec16754cbe93e2..d800b2233cf8e59067bc1550e6952e6ba474c22a 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 fb02353d093891871d45c69033a7e53a03320b8d..e9bedf2371668231b981428ca1e7512c66659395 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 741c4e802814869b623950d45fadc9673b9e026c..c46c650dc5b3ed9eae7f178b3dc9e9a4a801ec19 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 01cbb7fc21472170f93b094bfc73f43f04ad7107..7378963f21b24030a87ebab56bd76e1ad258242d 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 47e8732068d45fa704d928eb94aaffcad859b91d..6a0b5d450b58bdd3bee776402e52d18f6e8b7cad 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 f4f9754f40df5916f2e60756f51c188608b570cc..99e82056bcb5b7ac5c459a92af31014056bc5673 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 63d7335b88dbea354956054d764b8807781026e1..d699785bfd710452a70b704c760c3c52bd0045f5 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 c3b1b93c2fd5bcf23c4bdbb8b0677ee2ff7c1d26..f50ed7ea2dc36fd3818a4805150ed0c555b7c162 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 6aee32f48f6e19d02e6ae79cb1508f19eb0ea7a4..af839928d1b0c398ce35e78d5d93fb0a78833c2b 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 9bf3d0b78c112c7b9b4d1276fd4c2b3f05f0cd04..de3a0d04b2cb1c78fe752daa26d745dc0fe2a250 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 b64c7be1eb972addd2c84659257fad12b7bf5ccd..47ed1019834ce3535cca80879409437b3d23e33a 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 c373868deb42734d2ab8085c04c88eb43da3bb90..4112b7931d103bfb280ece99e964b33c7a18a412 100644 --- a/libc/src/string/allocating_string_utils.h +++ b/libc/src/string/allocating_string_utils.h @@ -17,7 +17,7 @@ #include // For size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { LIBC_INLINE cpp::optional strdup(const char *src) { @@ -33,6 +33,6 @@ LIBC_INLINE cpp::optional strdup(const char *src) { } } // namespace internal -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_ALLOCATING_STRING_UTILS_H diff --git a/libc/src/string/bcmp.cpp b/libc/src/string/bcmp.cpp index 26ae302b10b865dc9c1cf7575c4bb0b3e0d1060e..f18fa0c883eecddaff76f9ab104572ab08cac7c3 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 6503240319ed28718ec8852a0be34b38b10a9ddc..711aecf083501f4c3b217e444efca74ac540d1bf 100644 --- a/libc/src/string/bcmp.h +++ b/libc/src/string/bcmp.h @@ -11,10 +11,10 @@ #include // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int bcmp(const void *lhs, const void *rhs, size_t count); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_BCMP_H diff --git a/libc/src/string/bcopy.cpp b/libc/src/string/bcopy.cpp index 758f01ae2bf75e4c99e44383dcae9776c54919dc..9399d332dff7f4732bd55025a7911aca9528ffc0 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 12de749d4640dbbe20317044e3aac7974774ca87..ec4d8cde1c6cb976060e05228fd5d67720b8bd4a 100644 --- a/libc/src/string/bcopy.h +++ b/libc/src/string/bcopy.h @@ -11,10 +11,10 @@ #include // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void bcopy(const void *src, void *dest, size_t count); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_BCOPY_H diff --git a/libc/src/string/bzero.cpp b/libc/src/string/bzero.cpp index cb6da5628ec13c73c3fcb6dc94884664d68559b4..c833cd8c2116db0c534ec92ab8dc9d31989e02ad 100644 --- a/libc/src/string/bzero.cpp +++ b/libc/src/string/bzero.cpp @@ -10,10 +10,10 @@ #include "src/__support/common.h" #include "src/string/memory_utils/inline_bzero.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, bzero, (void *ptr, size_t count)) { inline_bzero(reinterpret_cast(ptr), count); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/bzero.h b/libc/src/string/bzero.h index 064800bad29b55ddb8c39a599179426fdcd0eea2..3f52fe2128052bc12cf4e44b6514c374fdac8f94 100644 --- a/libc/src/string/bzero.h +++ b/libc/src/string/bzero.h @@ -11,10 +11,10 @@ #include // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void bzero(void *ptr, size_t count); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_BZERO_H diff --git a/libc/src/string/index.cpp b/libc/src/string/index.cpp index 0ea2f752e30c5976bd93fdff39b06b4e6f8763dd..4b2a3527d0ad828d2b98a7671c3868cbe3fd05cf 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 7b246109d46f96fb767763a1ddbf64a6e8120365..993f060b6ac86b0f5df978f39ac0b19803ab3c3b 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 989a24d0852c6c8c1ebea5ab14f721d6e238436b..200384e9f61902789bab40d86fc73ad1beee1a33 100644 --- a/libc/src/string/memccpy.cpp +++ b/libc/src/string/memccpy.cpp @@ -11,7 +11,7 @@ #include "src/__support/common.h" #include // For size_t. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void *, memccpy, (void *__restrict dest, const void *__restrict src, int c, @@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(void *, memccpy, return nullptr; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/memccpy.h b/libc/src/string/memccpy.h index 38a80b1d6911567b646a5fd092a5aea3ac68b39d..ce12dfbddc28990e106d90610f575204e8b353d8 100644 --- a/libc/src/string/memccpy.h +++ b/libc/src/string/memccpy.h @@ -11,11 +11,11 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void *memccpy(void *__restrict dest, const void *__restrict src, int c, size_t count); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMCCPY_H diff --git a/libc/src/string/memchr.cpp b/libc/src/string/memchr.cpp index a2a537680920d8d9de138685e2675c1ec4fb1884..918bdd957b413319bc33d2905f16ee26f4a5c2fe 100644 --- a/libc/src/string/memchr.cpp +++ b/libc/src/string/memchr.cpp @@ -12,7 +12,7 @@ #include "src/__support/common.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO: Look at performance benefits of comparing words. LLVM_LIBC_FUNCTION(void *, memchr, (const void *src, int c, size_t n)) { @@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(void *, memchr, (const void *src, int c, size_t n)) { static_cast(c), n); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/memchr.h b/libc/src/string/memchr.h index 369475305236da475d5f6c465c0784091b38523e..b84c8317be55e45d0b73c73610d8e1f11a85c5f0 100644 --- a/libc/src/string/memchr.h +++ b/libc/src/string/memchr.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void *memchr(const void *src, int c, size_t n); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMCHR_H diff --git a/libc/src/string/memcmp.cpp b/libc/src/string/memcmp.cpp index dca2ee803bd9e56a34822083e0f7ff2c4051416d..adfbc1eca326a949d2f68f340d0080f9257e33d6 100644 --- a/libc/src/string/memcmp.cpp +++ b/libc/src/string/memcmp.cpp @@ -11,11 +11,11 @@ #include // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, memcmp, (const void *lhs, const void *rhs, size_t count)) { return inline_memcmp(lhs, rhs, count); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/memcmp.h b/libc/src/string/memcmp.h index 1d79df5d459185c47812bd91e3ab59d0917aca20..f2c1dd3541cb214b1e414788b2d1f17e36af7939 100644 --- a/libc/src/string/memcmp.h +++ b/libc/src/string/memcmp.h @@ -11,10 +11,10 @@ #include // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int memcmp(const void *lhs, const void *rhs, size_t count); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMCMP_H diff --git a/libc/src/string/memcpy.cpp b/libc/src/string/memcpy.cpp index 5ec6176f7f7fb7d0d73431a29c1a4760a77d4002..e6cf978dc3bc6e3dde812342fdb7df4562736ce7 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 f643f1de6294ef4f8cca58970d85ee6850cdc514..ea34a2d3d87548f4e724068df24bb1011ef97c43 100644 --- a/libc/src/string/memcpy.h +++ b/libc/src/string/memcpy.h @@ -11,10 +11,10 @@ #include // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void *memcpy(void *__restrict, const void *__restrict, size_t); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMCPY_H diff --git a/libc/src/string/memmem.cpp b/libc/src/string/memmem.cpp index af864985e1026cd12a908400fc61b69e178b50fe..067ea2ef9e7e51d2089fcb0c8d65be88141140f1 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 2809fd5c6cdf579b340b39fe725606aec315fb2c..b1f84c8cf323459e442f1d78a4b895fa4bb9ceb4 100644 --- a/libc/src/string/memmem.h +++ b/libc/src/string/memmem.h @@ -11,11 +11,11 @@ #include // For size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void *memmem(const void *haystack, size_t haystack_len, const void *needle, size_t needle_len); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMMEM_H diff --git a/libc/src/string/memmove.cpp b/libc/src/string/memmove.cpp index 9e75ef77eff240fa13742965dba0dfa40559b959..7d473afc0b42ee7cdfa49fcd137e186ed3aa3a5f 100644 --- a/libc/src/string/memmove.cpp +++ b/libc/src/string/memmove.cpp @@ -11,7 +11,7 @@ #include "src/string/memory_utils/inline_memmove.h" #include // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void *, memmove, (void *dst, const void *src, size_t count)) { @@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(void *, memmove, return dst; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/memmove.h b/libc/src/string/memmove.h index 2f03a127f5a94810655c9127ef1bf7e7a98e6646..4d78aadbd6620c707c04d3d0212338ca2cec8c1d 100644 --- a/libc/src/string/memmove.h +++ b/libc/src/string/memmove.h @@ -11,10 +11,10 @@ #include // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void *memmove(void *dst, const void *src, size_t count); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMMOVE_H diff --git a/libc/src/string/memory_utils/aarch64/inline_bcmp.h b/libc/src/string/memory_utils/aarch64/inline_bcmp.h index e2e8cb19f66353d4f8cc1cfba8ae84834eb84cd4..8e0827f1361fe406f389c0d4e46036c2d12bce7c 100644 --- a/libc/src/string/memory_utils/aarch64/inline_bcmp.h +++ b/libc/src/string/memory_utils/aarch64/inline_bcmp.h @@ -16,7 +16,7 @@ #include // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { [[maybe_unused]] LIBC_INLINE BcmpReturnType inline_bcmp_aarch64(CPtr p1, CPtr p2, @@ -65,6 +65,6 @@ namespace __llvm_libc { return aarch64::Bcmp<32>::loop_and_tail(p1, p2, count); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_INLINE_BCMP_H diff --git a/libc/src/string/memory_utils/aarch64/inline_memcmp.h b/libc/src/string/memory_utils/aarch64/inline_memcmp.h index 174e812c64878fa3bbfde971c560c4f4acfa0373..839c8ec13854f2538764ae54437887f207da7ec4 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 6ee2c2b20b732ede2259b6bf56b875e6148fa6a8..0a159f476cd61c25258a5b9d8e14f49431fd14e8 100644 --- a/libc/src/string/memory_utils/aarch64/inline_memcpy.h +++ b/libc/src/string/memory_utils/aarch64/inline_memcpy.h @@ -14,7 +14,7 @@ #include // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { [[maybe_unused]] LIBC_INLINE void inline_memcpy_aarch64(Ptr __restrict dst, CPtr __restrict src, size_t count) { @@ -43,6 +43,6 @@ inline_memcpy_aarch64(Ptr __restrict dst, CPtr __restrict src, size_t count) { return builtin::Memcpy<64>::loop_and_tail(dst, src, count); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_INLINE_MEMCPY_H diff --git a/libc/src/string/memory_utils/aarch64/inline_memmove.h b/libc/src/string/memory_utils/aarch64/inline_memmove.h index 7c9fa41c1db0dea09573aadd08eb4dbe0894d8ca..ca28655c916820c5911a68514149dda2caf974df 100644 --- a/libc/src/string/memory_utils/aarch64/inline_memmove.h +++ b/libc/src/string/memory_utils/aarch64/inline_memmove.h @@ -16,7 +16,7 @@ #include // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE void inline_memmove_aarch64(Ptr dst, CPtr src, size_t count) { static_assert(aarch64::kNeon, "aarch64 supports vector types"); @@ -48,6 +48,6 @@ LIBC_INLINE void inline_memmove_aarch64(Ptr dst, CPtr src, size_t count) { } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_INLINE_MEMMOVE_H diff --git a/libc/src/string/memory_utils/aarch64/inline_memset.h b/libc/src/string/memory_utils/aarch64/inline_memset.h index 6b73e5f4d617fddf233d5811293e9b63b74000d7..91512acce6fc078755f77666870f7dd71a673af7 100644 --- a/libc/src/string/memory_utils/aarch64/inline_memset.h +++ b/libc/src/string/memory_utils/aarch64/inline_memset.h @@ -15,7 +15,7 @@ #include // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { [[maybe_unused]] LIBC_INLINE static void inline_memset_aarch64(Ptr dst, uint8_t value, size_t count) { @@ -56,6 +56,6 @@ inline_memset_aarch64(Ptr dst, uint8_t value, size_t count) { } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_INLINE_MEMSET_H diff --git a/libc/src/string/memory_utils/generic/aligned_access.h b/libc/src/string/memory_utils/generic/aligned_access.h index 0a333d1fe866b809adcd8209e999b3ba3d0c256e..4238167e54d644d63c0e3af729995adcce9467f6 100644 --- a/libc/src/string/memory_utils/generic/aligned_access.h +++ b/libc/src/string/memory_utils/generic/aligned_access.h @@ -20,7 +20,7 @@ #include // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { [[maybe_unused]] LIBC_INLINE uint32_t load32_aligned(CPtr ptr, size_t offset, size_t alignment) { @@ -200,6 +200,6 @@ inline_memcmp_aligned_access_64bit(CPtr p1, CPtr p2, size_t count) { return inline_memcmp_byte_per_byte(p1, p2, count, offset); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_GENERIC_ALIGNED_ACCESS_H diff --git a/libc/src/string/memory_utils/generic/byte_per_byte.h b/libc/src/string/memory_utils/generic/byte_per_byte.h index 023291158464afe80e01d6c5c745409c266e7e93..a666c5da313604114b306e501dace222dba5ec88 100644 --- a/libc/src/string/memory_utils/generic/byte_per_byte.h +++ b/libc/src/string/memory_utils/generic/byte_per_byte.h @@ -18,7 +18,7 @@ #include // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { [[maybe_unused]] LIBC_INLINE void inline_memcpy_byte_per_byte(Ptr dst, CPtr src, size_t count, @@ -73,6 +73,6 @@ inline_memcmp_byte_per_byte(CPtr p1, CPtr p2, size_t count, size_t offset = 0) { return MemcmpReturnType::ZERO(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_GENERIC_BYTE_PER_BYTE_H diff --git a/libc/src/string/memory_utils/inline_bcmp.h b/libc/src/string/memory_utils/inline_bcmp.h index d931b4192133d44f23e604d6e1b4150157f62019..b1c981d859e022325ac62e00288d40ff894067df 100644 --- a/libc/src/string/memory_utils/inline_bcmp.h +++ b/libc/src/string/memory_utils/inline_bcmp.h @@ -30,14 +30,14 @@ #error "Unsupported architecture" #endif -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE int inline_bcmp(const void *p1, const void *p2, size_t count) { return static_cast(LIBC_SRC_STRING_MEMORY_UTILS_BCMP( reinterpret_cast(p1), reinterpret_cast(p2), count)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #undef LIBC_SRC_STRING_MEMORY_UTILS_BCMP diff --git a/libc/src/string/memory_utils/inline_bzero.h b/libc/src/string/memory_utils/inline_bzero.h index af90aede1dea58e115bb565c24827912dccf5a9c..ed83cab68b2fd11364923f1ad4da21a4946d437a 100644 --- a/libc/src/string/memory_utils/inline_bzero.h +++ b/libc/src/string/memory_utils/inline_bzero.h @@ -14,7 +14,7 @@ #include // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE static void inline_bzero(Ptr dst, size_t count) { inline_memset(dst, 0, count); @@ -24,6 +24,6 @@ LIBC_INLINE static void inline_bzero(void *dst, size_t count) { inline_bzero(reinterpret_cast(dst), count); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_BZERO_H diff --git a/libc/src/string/memory_utils/inline_memcmp.h b/libc/src/string/memory_utils/inline_memcmp.h index 4182fbbf72cff47d05781e33ed3845896bb991a3..d88d43691daee83cab436f0df093f1090bc6bca7 100644 --- a/libc/src/string/memory_utils/inline_memcmp.h +++ b/libc/src/string/memory_utils/inline_memcmp.h @@ -31,14 +31,14 @@ #error "Unsupported architecture" #endif -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE int inline_memcmp(const void *p1, const void *p2, size_t count) { return static_cast(LIBC_SRC_STRING_MEMORY_UTILS_MEMCMP( reinterpret_cast(p1), reinterpret_cast(p2), count)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #undef LIBC_SRC_STRING_MEMORY_UTILS_MEMCMP diff --git a/libc/src/string/memory_utils/inline_memcpy.h b/libc/src/string/memory_utils/inline_memcpy.h index 55f861a8047be01a0c84e580ae550d2da27d7205..0b8a7848da87b4a66a7ba506a93369d88ad9d5f5 100644 --- a/libc/src/string/memory_utils/inline_memcpy.h +++ b/libc/src/string/memory_utils/inline_memcpy.h @@ -35,7 +35,7 @@ #error "Unsupported architecture" #endif -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE void inline_memcpy(void *__restrict dst, const void *__restrict src, size_t count) { @@ -43,6 +43,6 @@ LIBC_INLINE void inline_memcpy(void *__restrict dst, const void *__restrict src, reinterpret_cast(src), count); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_MEMCPY_H diff --git a/libc/src/string/memory_utils/inline_memmem.h b/libc/src/string/memory_utils/inline_memmem.h index 9c09f945b65530b6e8beec997e71d951d3681cc0..eaddee57aef54f64ceb4d895dd7f298cb7960b35 100644 --- a/libc/src/string/memory_utils/inline_memmem.h +++ b/libc/src/string/memory_utils/inline_memmem.h @@ -13,7 +13,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { template LIBC_INLINE constexpr static void * @@ -39,6 +39,6 @@ inline_memmem(const void *haystack, size_t haystack_len, const void *needle, return nullptr; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_MEMMEM_H diff --git a/libc/src/string/memory_utils/inline_memmove.h b/libc/src/string/memory_utils/inline_memmove.h index c520b6f4de0cdff4295026b4b6221ee900315f08..0d31e10eaff28edc25a884d6a48f8eebeefc2cd5 100644 --- a/libc/src/string/memory_utils/inline_memmove.h +++ b/libc/src/string/memory_utils/inline_memmove.h @@ -27,13 +27,13 @@ #error "Unsupported architecture" #endif -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE void inline_memmove(void *dst, const void *src, size_t count) { LIBC_SRC_STRING_MEMORY_UTILS_MEMMOVE(reinterpret_cast(dst), reinterpret_cast(src), count); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif /* LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_MEMMOVE_H */ diff --git a/libc/src/string/memory_utils/inline_memset.h b/libc/src/string/memory_utils/inline_memset.h index 524224c110dd4b3196ef85c5cdc3e4cdab26b9ec..f20ae45fa753b44dc12c80c9e93c28f602937734 100644 --- a/libc/src/string/memory_utils/inline_memset.h +++ b/libc/src/string/memory_utils/inline_memset.h @@ -31,13 +31,13 @@ #error "Unsupported architecture" #endif -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE static void inline_memset(void *dst, uint8_t value, size_t count) { LIBC_SRC_STRING_MEMORY_UTILS_MEMSET(reinterpret_cast(dst), value, count); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #undef LIBC_SRC_STRING_MEMORY_UTILS_MEMSET diff --git a/libc/src/string/memory_utils/inline_strcmp.h b/libc/src/string/memory_utils/inline_strcmp.h index ccb315d744b15bd2e48f4e399eecebca7e928928..2bcd56ad3d6b0b1a6a47969709c752b2753d20cd 100644 --- a/libc/src/string/memory_utils/inline_strcmp.h +++ b/libc/src/string/memory_utils/inline_strcmp.h @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { template LIBC_INLINE constexpr int inline_strcmp(const char *left, const char *right, @@ -39,6 +39,6 @@ LIBC_INLINE constexpr int inline_strncmp(const char *left, const char *right, *reinterpret_cast(right)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_STRCMP_H diff --git a/libc/src/string/memory_utils/inline_strstr.h b/libc/src/string/memory_utils/inline_strstr.h index f9bc6b583ecdf42d768ffcd1a51aa71955eb7a04..f0f8e2bbf896a71c6e34b336efb293be3a549d49 100644 --- a/libc/src/string/memory_utils/inline_strstr.h +++ b/libc/src/string/memory_utils/inline_strstr.h @@ -13,7 +13,7 @@ #include "src/string/string_utils.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { template LIBC_INLINE constexpr char *inline_strstr(const char *haystack, @@ -24,6 +24,6 @@ LIBC_INLINE constexpr char *inline_strstr(const char *haystack, return static_cast(result); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_INLINE_STRSTR_H diff --git a/libc/src/string/memory_utils/op_aarch64.h b/libc/src/string/memory_utils/op_aarch64.h index 29d3b822a4e2a5f156a6d9234f93b4d37f0b69ce..10de5bcfce85ae229124447544b06067dc3bddcf 100644 --- a/libc/src/string/memory_utils/op_aarch64.h +++ b/libc/src/string/memory_utils/op_aarch64.h @@ -24,7 +24,7 @@ #include #endif //__ARM_NEON -namespace __llvm_libc::aarch64 { +namespace LIBC_NAMESPACE::aarch64 { LIBC_INLINE_VAR constexpr bool kNeon = LLVM_LIBC_IS_DEFINED(__ARM_NEON); @@ -169,9 +169,9 @@ template struct Bcmp { } }; -} // namespace __llvm_libc::aarch64 +} // namespace LIBC_NAMESPACE::aarch64 -namespace __llvm_libc::generic { +namespace LIBC_NAMESPACE::generic { /////////////////////////////////////////////////////////////////////////////// // Specializations for uint16_t @@ -263,7 +263,7 @@ LIBC_INLINE MemcmpReturnType cmp(CPtr p1, CPtr p2, } return MemcmpReturnType::ZERO(); } -} // namespace __llvm_libc::generic +} // namespace LIBC_NAMESPACE::generic #endif // LIBC_TARGET_ARCH_IS_AARCH64 diff --git a/libc/src/string/memory_utils/op_builtin.h b/libc/src/string/memory_utils/op_builtin.h index 210ba6019200183d588ca50a2a5a92adc8c8ba11..cfa58e43d74550d78fb89ac90f112dfb96643bbc 100644 --- a/libc/src/string/memory_utils/op_builtin.h +++ b/libc/src/string/memory_utils/op_builtin.h @@ -17,7 +17,7 @@ #include "src/string/memory_utils/utils.h" -namespace __llvm_libc::builtin { +namespace LIBC_NAMESPACE::builtin { /////////////////////////////////////////////////////////////////////////////// // Memcpy @@ -153,6 +153,6 @@ template struct Memcmp { } }; -} // namespace __llvm_libc::builtin +} // namespace LIBC_NAMESPACE::builtin #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_OP_BUILTIN_H diff --git a/libc/src/string/memory_utils/op_generic.h b/libc/src/string/memory_utils/op_generic.h index 999b7a6b5416783fc82883fd9adbb966f4b2c3d4..fd71ca30e24b936a9513059801f2b21ee2d5d541 100644 --- a/libc/src/string/memory_utils/op_generic.h +++ b/libc/src/string/memory_utils/op_generic.h @@ -41,14 +41,14 @@ static_assert((UINTPTR_MAX == 4294967295U) || #define LLVM_LIBC_HAS_UINT64 #endif -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Compiler types using the vector attributes. using generic_v128 = uint8_t __attribute__((__vector_size__(16))); using generic_v256 = uint8_t __attribute__((__vector_size__(32))); using generic_v512 = uint8_t __attribute__((__vector_size__(64))); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE -namespace __llvm_libc::generic { +namespace LIBC_NAMESPACE::generic { // We accept three types of values as elements for generic operations: // - scalar : unsigned integral types, @@ -92,7 +92,7 @@ template constexpr size_t array_size_v = array_size::value; template T load(CPtr src) { static_assert(is_element_type_v); if constexpr (is_scalar_v || is_vector_v) { - return ::__llvm_libc::load(src); + return ::LIBC_NAMESPACE::load(src); } else if constexpr (is_array_v) { using value_type = typename T::value_type; T Value; @@ -105,7 +105,7 @@ template T load(CPtr src) { template void store(Ptr dst, T value) { static_assert(is_element_type_v); if constexpr (is_scalar_v || is_vector_v) { - ::__llvm_libc::store(dst, value); + ::LIBC_NAMESPACE::store(dst, value); } else if constexpr (is_array_v) { using value_type = typename T::value_type; for (size_t I = 0; I < array_size_v; ++I) @@ -319,7 +319,7 @@ template struct Memmove { // Making the offset explicit hints the compiler to use relevant addressing mode // consistently. template LIBC_INLINE T load(CPtr ptr, size_t offset) { - return ::__llvm_libc::load(ptr + offset); + return ::LIBC_NAMESPACE::load(ptr + offset); } // Same as above but also makes sure the loaded value is in big endian format. @@ -564,6 +564,6 @@ LIBC_INLINE MemcmpReturnType cmp(CPtr p1, CPtr p2, size_t offset) { template <> LIBC_INLINE MemcmpReturnType cmp_neq(CPtr p1, CPtr p2, size_t offset); -} // namespace __llvm_libc::generic +} // namespace LIBC_NAMESPACE::generic #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_OP_GENERIC_H diff --git a/libc/src/string/memory_utils/op_riscv.h b/libc/src/string/memory_utils/op_riscv.h index e164dfa35c002f0aac2681300b0850e8eee243fc..313d55e644cb4b1d3d6e2ea20cfb1105c3d4ed31 100644 --- a/libc/src/string/memory_utils/op_riscv.h +++ b/libc/src/string/memory_utils/op_riscv.h @@ -19,7 +19,7 @@ #include "src/__support/common.h" #include "src/string/memory_utils/op_generic.h" -namespace __llvm_libc::generic { +namespace LIBC_NAMESPACE::generic { /////////////////////////////////////////////////////////////////////////////// // Specializations for uint16_t @@ -78,7 +78,7 @@ LIBC_INLINE MemcmpReturnType cmp_neq(CPtr p1, CPtr p2, return cmp_neq_uint64_t(a, b); } -} // namespace __llvm_libc::generic +} // namespace LIBC_NAMESPACE::generic #endif // LIBC_TARGET_ARCH_IS_ANY_RISCV #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_OP_RISCV_H diff --git a/libc/src/string/memory_utils/op_x86.h b/libc/src/string/memory_utils/op_x86.h index 4c526dabf42ac71b769eb8a17946493ccefdb612..1a20659c178cd1bd8c40dcfe19ed3245fbffea55 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 7d14b335ef43aa5bbbba5fb66724f332047002db..d66f0a7b225e688565641cbbd60f45dd8d0b619d 100644 --- a/libc/src/string/memory_utils/riscv/inline_bcmp.h +++ b/libc/src/string/memory_utils/riscv/inline_bcmp.h @@ -15,7 +15,7 @@ #include // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { [[maybe_unused]] LIBC_INLINE BcmpReturnType inline_bcmp_riscv(CPtr p1, CPtr p2, size_t count) { @@ -28,6 +28,6 @@ namespace __llvm_libc { #endif } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LIBC_SRC_STRING_MEMORY_UTILS_RISCV_INLINE_BCMP_H diff --git a/libc/src/string/memory_utils/riscv/inline_memcmp.h b/libc/src/string/memory_utils/riscv/inline_memcmp.h index 437a6b43bcf0c863b5dfedbda91e2038f79f1466..0b28ad92235c1b50e7c98a3e3dba526365af5ffa 100644 --- a/libc/src/string/memory_utils/riscv/inline_memcmp.h +++ b/libc/src/string/memory_utils/riscv/inline_memcmp.h @@ -15,7 +15,7 @@ #include // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { [[maybe_unused]] LIBC_INLINE MemcmpReturnType inline_memcmp_riscv(CPtr p1, CPtr p2, size_t count) { @@ -28,6 +28,6 @@ inline_memcmp_riscv(CPtr p1, CPtr p2, size_t count) { #endif } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LIBC_SRC_STRING_MEMORY_UTILS_RISCV_INLINE_MEMCMP_H diff --git a/libc/src/string/memory_utils/riscv/inline_memcpy.h b/libc/src/string/memory_utils/riscv/inline_memcpy.h index c80277acf40a77e102d6b3df58e84961c1e52143..05531c8b75972c32926a0bd5e20a683b23d3be31 100644 --- a/libc/src/string/memory_utils/riscv/inline_memcpy.h +++ b/libc/src/string/memory_utils/riscv/inline_memcpy.h @@ -15,7 +15,7 @@ #include // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { [[maybe_unused]] LIBC_INLINE void inline_memcpy_riscv(Ptr __restrict dst, CPtr __restrict src, size_t count) { @@ -28,6 +28,6 @@ inline_memcpy_riscv(Ptr __restrict dst, CPtr __restrict src, size_t count) { #endif } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LIBC_SRC_STRING_MEMORY_UTILS_RISCV_INLINE_MEMCPY_H diff --git a/libc/src/string/memory_utils/riscv/inline_memmove.h b/libc/src/string/memory_utils/riscv/inline_memmove.h index 9704157f4f99f05dc306c3389b4340546afc082a..1c26917a96d9d18a166729f7674db5e605b07e4e 100644 --- a/libc/src/string/memory_utils/riscv/inline_memmove.h +++ b/libc/src/string/memory_utils/riscv/inline_memmove.h @@ -15,13 +15,13 @@ #include // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { [[maybe_unused]] LIBC_INLINE void inline_memmove_riscv(Ptr __restrict dst, CPtr __restrict src, size_t count) { return inline_memmove_byte_per_byte(dst, src, count); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LIBC_SRC_STRING_MEMORY_UTILS_RISCV_INLINE_MEMMOVE_H diff --git a/libc/src/string/memory_utils/riscv/inline_memset.h b/libc/src/string/memory_utils/riscv/inline_memset.h index c64a70a99eb1519f611d2df76c9682d71c29552b..b9b8a188aff670f969e45e0c3d84d1cca25aea47 100644 --- a/libc/src/string/memory_utils/riscv/inline_memset.h +++ b/libc/src/string/memory_utils/riscv/inline_memset.h @@ -15,7 +15,7 @@ #include // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE static void inline_memset_riscv(Ptr dst, uint8_t value, size_t count) { @@ -28,6 +28,6 @@ LIBC_INLINE static void inline_memset_riscv(Ptr dst, uint8_t value, #endif } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LIBC_SRC_STRING_MEMORY_UTILS_RISCV_INLINE_MEMSET_H diff --git a/libc/src/string/memory_utils/utils.h b/libc/src/string/memory_utils/utils.h index 66749465ee2849b05cf66c52ebdf2188485b73b8..c467ae712b638a22b8bf6328be9832f83228dedb 100644 --- a/libc/src/string/memory_utils/utils.h +++ b/libc/src/string/memory_utils/utils.h @@ -20,7 +20,7 @@ #include // size_t #include // intptr_t / uintptr_t / INT32_MAX / INT32_MIN -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Allows compile time error reporting in `if constexpr` branches. template @@ -372,6 +372,6 @@ 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 96a22f7740a8c0ef6354db54c6cb2e174a786a88..31aff86e60598ec160128df430664804d3b8b19a 100644 --- a/libc/src/string/memory_utils/x86_64/inline_bcmp.h +++ b/libc/src/string/memory_utils/x86_64/inline_bcmp.h @@ -15,7 +15,7 @@ #include // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { [[maybe_unused]] LIBC_INLINE BcmpReturnType inline_bcmp_generic_gt16(CPtr p1, CPtr p2, size_t count) { @@ -88,6 +88,6 @@ inline_bcmp_x86_avx512bw_gt16(CPtr p1, CPtr p2, size_t count) { #endif } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_X86_64_INLINE_BCMP_H diff --git a/libc/src/string/memory_utils/x86_64/inline_memcmp.h b/libc/src/string/memory_utils/x86_64/inline_memcmp.h index 2569b4ddd63dd88895f2cf2a173272fa036f936d..d5fa77cdbbcdc04823353852f7aa03809af7fa47 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 7d70a552354f46345a18fbfd6e3047062b9c50da..f43230ffd8ad125a68c622be6eae1f19e17ea3b9 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 22a088823f9ce564ce25ac54d2a981b9eeb2a144..95ad07f7521958120833f73fbca63b23ad3b529b 100644 --- a/libc/src/string/memory_utils/x86_64/inline_memmove.h +++ b/libc/src/string/memory_utils/x86_64/inline_memmove.h @@ -16,7 +16,7 @@ #include // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE void inline_memmove_x86(Ptr dst, CPtr src, size_t count) { #if defined(__AVX512F__) @@ -61,6 +61,6 @@ LIBC_INLINE void inline_memmove_x86(Ptr dst, CPtr src, size_t count) { } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_X86_64_INLINE_MEMMOVE_H diff --git a/libc/src/string/memory_utils/x86_64/inline_memset.h b/libc/src/string/memory_utils/x86_64/inline_memset.h index 54ef33a0c3ade25071a8662fcbebd74817d73104..6436594856b0eaf61f9ab67b7422e774dbfe9c93 100644 --- a/libc/src/string/memory_utils/x86_64/inline_memset.h +++ b/libc/src/string/memory_utils/x86_64/inline_memset.h @@ -15,7 +15,7 @@ #include // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { [[maybe_unused]] LIBC_INLINE static void inline_memset_x86(Ptr dst, uint8_t value, size_t count) { @@ -60,6 +60,6 @@ inline_memset_x86(Ptr dst, uint8_t value, size_t count) { align_to_next_boundary<32>(dst, count); return generic::Memset::loop_and_tail(dst, value, count); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_X86_64_INLINE_MEMSET_H diff --git a/libc/src/string/mempcpy.cpp b/libc/src/string/mempcpy.cpp index 535e029305f43d2edbd008e76bc2a68d872e8239..47cc3d634d44cee270b2ade21fa33873665cbf79 100644 --- a/libc/src/string/mempcpy.cpp +++ b/libc/src/string/mempcpy.cpp @@ -12,7 +12,7 @@ #include "src/__support/common.h" #include // For size_t. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void *, mempcpy, (void *__restrict dst, const void *__restrict src, @@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(void *, mempcpy, return reinterpret_cast(dst) + count; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/mempcpy.h b/libc/src/string/mempcpy.h index 6000761e177a8adaef15115fb202e3e45c6c15a6..317e0fc1d1f307cf9231e61fd81ea20f8eadbf7f 100644 --- a/libc/src/string/mempcpy.h +++ b/libc/src/string/mempcpy.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void *mempcpy(void *__restrict dest, const void *__restrict src, size_t count); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMPCPY_H diff --git a/libc/src/string/memrchr.cpp b/libc/src/string/memrchr.cpp index 7efac04a63248cd76057ca5d27dcc63a53fa4905..fad086809635f0f94f65a3cf39c136aaaf407f59 100644 --- a/libc/src/string/memrchr.cpp +++ b/libc/src/string/memrchr.cpp @@ -10,7 +10,7 @@ #include "src/__support/common.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void *, memrchr, (const void *src, int c, size_t n)) { const unsigned char *str = reinterpret_cast(src); @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(void *, memrchr, (const void *src, int c, size_t n)) { return nullptr; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/memrchr.h b/libc/src/string/memrchr.h index 8f43577e331fe88debfa811a8f4b84e4912d1b0a..5c32d6a3ad5566b5bf1a44a5aa82fcbc1c3e2cf1 100644 --- a/libc/src/string/memrchr.h +++ b/libc/src/string/memrchr.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void *memrchr(const void *src, int c, size_t n); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMRCHR_H diff --git a/libc/src/string/memset.cpp b/libc/src/string/memset.cpp index 3a339eca661320e73661534331f990117d5c7a2d..a94e353421968be9b4ef19d17de45f6531ce3d8d 100644 --- a/libc/src/string/memset.cpp +++ b/libc/src/string/memset.cpp @@ -10,11 +10,11 @@ #include "src/__support/common.h" #include "src/string/memory_utils/inline_memset.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void *, memset, (void *dst, int value, size_t count)) { inline_memset(dst, static_cast(value), count); return dst; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/memset.h b/libc/src/string/memset.h index e38eb7d78a976b6b0761d2f459273d11bfd24d4f..4c1ef9d91c71aa87568825049aefecc4d21b7b0b 100644 --- a/libc/src/string/memset.h +++ b/libc/src/string/memset.h @@ -11,10 +11,10 @@ #include // size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void *memset(void *ptr, int value, size_t count); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_MEMSET_H diff --git a/libc/src/string/rindex.cpp b/libc/src/string/rindex.cpp index 520a4dbeda20f434648e00b3504da11b3f452a7f..2c7f8dc29ea8a733f137d95816a702d3391574ea 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 976d6bac93131c4ba0e03fb9f63ec35bb0a41d0d..a2aad85bed913d15cab0e189ae36a05ec5cfbddf 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 22de619ae2ae29a6d10adf648b5493e18b111af9..bdaa6899302c05077ce7996f5256190176faa2c5 100644 --- a/libc/src/string/stpcpy.cpp +++ b/libc/src/string/stpcpy.cpp @@ -12,17 +12,17 @@ #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(char *, stpcpy, (char *__restrict dest, const char *__restrict src)) { size_t size = internal::string_length(src) + 1; char *result = - reinterpret_cast(__llvm_libc::mempcpy(dest, src, size)); + reinterpret_cast(LIBC_NAMESPACE::mempcpy(dest, src, size)); if (result != nullptr) return result - 1; return nullptr; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/stpcpy.h b/libc/src/string/stpcpy.h index 84d5738f0e2ba6bc56d413430799b8e0bc946c94..4352f5b389a24c17028e61b756dd9b34b4f53acd 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 e03d560bf221ae8b7966b0e1c1c320a0734cb99d..436e131d068725ea2c2ca441f16368e5aa8990f2 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 6320a290b1dd26daff333b8690389a89427da365..5ecf65b027cab06daa76650d90e4daae19ff0225 100644 --- a/libc/src/string/stpncpy.h +++ b/libc/src/string/stpncpy.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { char *stpncpy(char *__restrict dest, const char *__restrict src, size_t n); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STPNCPY_H diff --git a/libc/src/string/strcasecmp.cpp b/libc/src/string/strcasecmp.cpp index ceb81ce2fdc26e3d97a5c3919f73a86809783593..87636ee369ebd3b2e504c159d4bfc96cd42ae9e1 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 ce0a4e5b613cca9a69d78a108f5e96b05eb03c72..97b1f930f322724e92061b96dc628a4a23421366 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 61aca70d1e018eb0ea3389d8ec3072045b3f22ba..3119ed49c56d48bb810674218b6b77ade893bdef 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 b69165471bfdc3ceb2a7c77cff1e085f507c00cc..9c8ad0fb82b2843a3e6f94c574f94f90ed6093f3 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 6af5e514c407dc3a4cdbc0bd73e3c89a061c28b9..6e1baa64e66ab20dc996b6fb3d65a9f2a0d6f196 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 20e966c675df1ceae37dcb05246280e9e1d2d829..3cf2e19e24fe900e675072be6630914358ab4429 100644 --- a/libc/src/string/strcat.h +++ b/libc/src/string/strcat.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { char *strcat(char *__restrict dest, const char *__restrict src); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRCAT_H diff --git a/libc/src/string/strchr.cpp b/libc/src/string/strchr.cpp index 3b804e94404ecc05077a4b62618eaac33e57cbff..553197b22b2ee21aa1f68ed494ad7318d6d4a10e 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 6f106afaf695c12f52b6214bf2ea9de24f24cebd..bb6a9c07b89e17449dbf493bed2b0b04d5531fa5 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 d8dce65dca5277f3d3bd6583eb4192157e3b24ff..9b492a634a8ff630c00534c287b1898966de1bba 100644 --- a/libc/src/string/strchrnul.cpp +++ b/libc/src/string/strchrnul.cpp @@ -11,10 +11,10 @@ #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(char *, strchrnul, (const char *src, int c)) { return internal::strchr_implementation(src, c); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strchrnul.h b/libc/src/string/strchrnul.h index 2ba07ac0f2a72e519ee991e35aa9d3a9b16cd4fa..b847b0bda103c90a52c9f2cfa3962406a81a2142 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 aca8874b00c6702bf7a66b3d6c1614570787b7d2..0b515b76fa85c55a184ad510b3aab345861f3025 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 a45f2d5ba8e5dc2419121784ceed8ffa7905139f..9fc6fdb9f27ba895fc0086afda040c2b62c45724 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 d60a7a5d5915ae8627ac526a273e9c92aabdb1e3..7280688bf3d9dc19bbe42754d1db4997a9d71c18 100644 --- a/libc/src/string/strcoll.cpp +++ b/libc/src/string/strcoll.cpp @@ -10,7 +10,7 @@ #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO: Add support for locales. LLVM_LIBC_FUNCTION(int, strcoll, (const char *left, const char *right)) { @@ -19,4 +19,4 @@ LLVM_LIBC_FUNCTION(int, strcoll, (const char *left, const char *right)) { return static_cast(*left) - static_cast(*right); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strcoll.h b/libc/src/string/strcoll.h index 5949ede61bd196fae41f1cf81655975114fc6b89..d69b48a6642c3124ccfa1b53715c0889d4ce0d67 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 cac4f6e63037e0b96355cdaa3386580ab9d4e54e..4fbd1a38f6873e5625735af4cdfb2d0f1c75cf4c 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 2d2af21c704495027ff97a206ce8ec24101e7dca..11a26a6fa6effad927c50e6181faeaf24ec84c14 100644 --- a/libc/src/string/strcpy.h +++ b/libc/src/string/strcpy.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { char *strcpy(char *__restrict dest, const char *__restrict src); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRCPY_H diff --git a/libc/src/string/strcspn.cpp b/libc/src/string/strcspn.cpp index d4929c56a9b3aabf45bb74a9702a0ea124258078..ed057c3796066fb64b5ad73700677bec38568cc7 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 9674f4b6359b06168638c678d93540a45a767945..21098feb288b8ac81cca399e1a6e4c4a73fd79e5 100644 --- a/libc/src/string/strcspn.h +++ b/libc/src/string/strcspn.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { size_t strcspn(const char *src, const char *segment); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRCSPN_H diff --git a/libc/src/string/strdup.cpp b/libc/src/string/strdup.cpp index cafa0cb69941326dec4c66b0ebc914de5bc41702..3530a708c131bcd6d32671f58af5b66d36be037b 100644 --- a/libc/src/string/strdup.cpp +++ b/libc/src/string/strdup.cpp @@ -15,7 +15,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(char *, strdup, (const char *src)) { auto dup = internal::strdup(src); @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(char *, strdup, (const char *src)) { return nullptr; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strdup.h b/libc/src/string/strdup.h index 8f83558db919f214f4ccebe3f8f926b3f81651f1..e33a24694bf17c7747c89c41430771b35e3e5ddb 100644 --- a/libc/src/string/strdup.h +++ b/libc/src/string/strdup.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { char *strdup(const char *src); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRDUP_H diff --git a/libc/src/string/strerror.cpp b/libc/src/string/strerror.cpp index 014a51a622fdea0242c971b26887fd8a04eb3f7d..01cbbeb4d18f20de08ae46963cabc865f2e6ead4 100644 --- a/libc/src/string/strerror.cpp +++ b/libc/src/string/strerror.cpp @@ -10,10 +10,10 @@ #include "src/__support/StringUtil/error_to_string.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(char *, strerror, (int err_num)) { return const_cast(get_error_string(err_num).data()); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strerror.h b/libc/src/string/strerror.h index ce3366db529d3dce89398bea728fac811f0d4534..36a1348a5c737ed64b5fa6dff60d6cc107fbca74 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 efdc8d3723c408486293fb63e17c37fd16d4586f..c514dbd740906f76b2e7b0ebdea272a53f7b6b79 100644 --- a/libc/src/string/strerror_r.cpp +++ b/libc/src/string/strerror_r.cpp @@ -12,7 +12,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // This is the gnu version of strerror_r. The XSI version may be added later. LLVM_LIBC_FUNCTION(char *, strerror_r, @@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(char *, strerror_r, return const_cast(get_error_string(err_num, {buf, buflen}).data()); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strerror_r.h b/libc/src/string/strerror_r.h index 18b361773be45026c8e629dc67cda2564c9d34b5..63f595866b3b63e27d7fb51c3561c0d889f519fa 100644 --- a/libc/src/string/strerror_r.h +++ b/libc/src/string/strerror_r.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { char *strerror_r(int err_num, char *buf, size_t buflen); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRERROR_R_H diff --git a/libc/src/string/string_utils.h b/libc/src/string/string_utils.h index e874e5f5f0a69ca060f3e51957e72da3f3a1caaf..17efc125ea63a798d01908aea8841d4437b3ec62 100644 --- a/libc/src/string/string_utils.h +++ b/libc/src/string/string_utils.h @@ -20,7 +20,7 @@ #include "src/string/memory_utils/inline_memcpy.h" #include // For size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { template LIBC_INLINE constexpr Word repeat_byte(Word byte) { @@ -246,6 +246,6 @@ LIBC_INLINE constexpr static char *strrchr_implementation(const char *src, } } // namespace internal -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRING_UTILS_H diff --git a/libc/src/string/strlcat.cpp b/libc/src/string/strlcat.cpp index a718de7698838efba36d663b7f19294447b0f179..2943f4f67b4f90a94e6761cff9ffe7b0ee8d6320 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 7b073c67068266ed4686ff18ff047334ecee205e..47f27e3ba5ac3edf68aa70f9b22d7abd6dce8260 100644 --- a/libc/src/string/strlcat.h +++ b/libc/src/string/strlcat.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { size_t strlcat(char *__restrict dst, const char *__restrict src, size_t size); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRLCAT_H diff --git a/libc/src/string/strlcpy.cpp b/libc/src/string/strlcpy.cpp index fa1f10290e8ec064daa41c76834ef231ccf2e299..9b296f2cdbb054a3fac3282182ebeb712d08e834 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 f1c8e917e9864afe39af00ca00adafb083fbd8f5..0c18d856e53f0aaea3c5b47dadd4ef9c9b333366 100644 --- a/libc/src/string/strlcpy.h +++ b/libc/src/string/strlcpy.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { size_t strlcpy(char *__restrict dst, const char *__restrict src, size_t size); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRLCPY_H diff --git a/libc/src/string/strlen.cpp b/libc/src/string/strlen.cpp index c7b192bff2504e93d79e5dba41719c38c21801bf..b903928f067f9509b4bad2321d986429961dfe40 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 b3ad03f612d0aa980c0b53b3b9ce685602247e0b..4dfaf8e98cdd2c080b21d0817540b75090d29587 100644 --- a/libc/src/string/strlen.h +++ b/libc/src/string/strlen.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { size_t strlen(const char *src); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRLEN_H diff --git a/libc/src/string/strncasecmp.cpp b/libc/src/string/strncasecmp.cpp index 48445ccd317ba6427d40309321dac19036454832..994fb258746a2f24a9835c7005911eb8f8dcaea0 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 c596a7afa6242cd1f7781f949b54c253ab828123..eb1155070c6baaf95c18466f44e98d0194c1c4d7 100644 --- a/libc/src/string/strncasecmp.h +++ b/libc/src/string/strncasecmp.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int strncasecmp(const char *left, const char *right, size_t n); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRNCASECMP_H diff --git a/libc/src/string/strncat.cpp b/libc/src/string/strncat.cpp index 06e69eacd355b0a15466ebea28b887bc329386ab..ca86d9c0a2e41159909154eb5a5124a1ee5461ab 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 9b2c70fca5788ab1d3e94ecb8342cb58d7a47757..f3d9706dc23e92286cc5838d1322e51f94d1d733 100644 --- a/libc/src/string/strncat.h +++ b/libc/src/string/strncat.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { char *strncat(char *__restrict dest, const char *__restrict src, size_t count); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRNCAT_H diff --git a/libc/src/string/strncmp.cpp b/libc/src/string/strncmp.cpp index 098f9e121568fbe9544a98494d56907ce38f36e7..0d2a66879704c06d03e786eeda1e02f6eebc3001 100644 --- a/libc/src/string/strncmp.cpp +++ b/libc/src/string/strncmp.cpp @@ -13,7 +13,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, strncmp, (const char *left, const char *right, size_t n)) { @@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(int, strncmp, return inline_strncmp(left, right, n, comp); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strncmp.h b/libc/src/string/strncmp.h index 056fe78e6c85c9e729186c25850d51cb05ed5da6..adb270f5cd40c3eba7bb8c7cb605b8a4939a6478 100644 --- a/libc/src/string/strncmp.h +++ b/libc/src/string/strncmp.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int strncmp(const char *left, const char *right, size_t n); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRNCMP_H diff --git a/libc/src/string/strncpy.cpp b/libc/src/string/strncpy.cpp index 274950230f515150cbe0da75b7de6229f1b9839e..1408e7f0902d442ddb5c98386dcbe137bd618cea 100644 --- a/libc/src/string/strncpy.cpp +++ b/libc/src/string/strncpy.cpp @@ -11,7 +11,7 @@ #include "src/__support/common.h" #include // For size_t. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(char *, strncpy, (char *__restrict dest, const char *__restrict src, @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(char *, strncpy, return dest; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strncpy.h b/libc/src/string/strncpy.h index c419df990cd78103798be5975c269a3bb443cd31..3152fef0758c72196f1604cc88b5a0422508c6a2 100644 --- a/libc/src/string/strncpy.h +++ b/libc/src/string/strncpy.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { char *strncpy(char *__restrict dest, const char *__restrict src, size_t n); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRNCPY_H diff --git a/libc/src/string/strndup.cpp b/libc/src/string/strndup.cpp index ca1c6ec406b3743f4059e490b61cfca3c1e4de35..6648e22ab50e000fb73083da7a95af414ece0712 100644 --- a/libc/src/string/strndup.cpp +++ b/libc/src/string/strndup.cpp @@ -15,7 +15,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(char *, strndup, (const char *src, size_t size)) { if (src == nullptr) @@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(char *, strndup, (const char *src, size_t size)) { return dest; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strndup.h b/libc/src/string/strndup.h index 0a593a709aa972d754045010040dd2cbe54a911f..3e5c951f6c87a57afdec79005c2394caab786545 100644 --- a/libc/src/string/strndup.h +++ b/libc/src/string/strndup.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { char *strndup(const char *src, size_t size); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRNDUP_H diff --git a/libc/src/string/strnlen.cpp b/libc/src/string/strnlen.cpp index dc208b0ac66b550f9e9eff9c2ee1447714e056ba..8849fa0fdd9fad630ae94fc196086497015fcf2b 100644 --- a/libc/src/string/strnlen.cpp +++ b/libc/src/string/strnlen.cpp @@ -12,7 +12,7 @@ #include "src/__support/common.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(size_t, strnlen, (const char *src, size_t n)) { const void *temp = internal::find_first_character( @@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(size_t, strnlen, (const char *src, size_t n)) { return temp ? reinterpret_cast(temp) - src : n; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strnlen.h b/libc/src/string/strnlen.h index 2d2ee9703d83da565dc43e1d16a84c687a9cf090..e18d21779d94c7d66f546e413474600b3897481c 100644 --- a/libc/src/string/strnlen.h +++ b/libc/src/string/strnlen.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { size_t strnlen(const char *src, size_t n); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRNLEN_H diff --git a/libc/src/string/strpbrk.cpp b/libc/src/string/strpbrk.cpp index fc2cadc275237ae08d81efb48959b93bae9463fe..8bccda02418bc7bbda628ebe3ffa18b845b45a0f 100644 --- a/libc/src/string/strpbrk.cpp +++ b/libc/src/string/strpbrk.cpp @@ -11,11 +11,11 @@ #include "src/__support/common.h" #include "src/string/string_utils.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(char *, strpbrk, (const char *src, const char *breakset)) { src += internal::complementary_span(src, breakset); return *src ? const_cast(src) : nullptr; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strpbrk.h b/libc/src/string/strpbrk.h index 823cd35e9e30e94449f6ef8bc40a7b2d802156f0..c744d09365ff4a3be5c91dd7b6d79cbaa02b1855 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 d821327a998d3c06cb26f0ca47b6bd412dd925ad..d51808b6dd835512565c88b45121a889518c1e7c 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 7b85929b290b7efd2b754df9b9983373b7f4b038..d4280d85ae9b8fa4f51d270aec36735286160a5b 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 5e6aef7ac008e0d6a2f34e741cf38e917c7e23c6..edd2cf07e20a450c15445ff63fccfcc1356550d7 100644 --- a/libc/src/string/strsep.cpp +++ b/libc/src/string/strsep.cpp @@ -10,7 +10,7 @@ #include "src/string/string_utils.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(char *, strsep, (char **stringp, const char *delim)) { if (!*stringp) @@ -18,4 +18,4 @@ LLVM_LIBC_FUNCTION(char *, strsep, (char **stringp, const char *delim)) { return internal::string_token(*stringp, delim, stringp); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strsep.h b/libc/src/string/strsep.h index 1b1f28ff9c87c38002b04129fab1995898b449fd..48f55a899d7f336fa48ddd50645150b282cc62fd 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 bad69b6f5415e082d997331633c7eb6d469e6260..f6ca0bcdad8d2ba8eb9becb1ed8a71e50e6b8d92 100644 --- a/libc/src/string/strsignal.cpp +++ b/libc/src/string/strsignal.cpp @@ -11,10 +11,10 @@ #include "src/__support/StringUtil/signal_to_string.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(char *, strsignal, (int sig_num)) { return const_cast(get_signal_string(sig_num).data()); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strsignal.h b/libc/src/string/strsignal.h index 346f3960d3aa31db01e67313c385587900c18075..bd3f87a201734cc257b07fd2bb4222571c4d6c61 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 9580d1bc403e8dff97fda552cff34cec5bc3d706..b957f8ed7f1bda5bd1a05a9baf034e3e58855ce8 100644 --- a/libc/src/string/strspn.cpp +++ b/libc/src/string/strspn.cpp @@ -12,7 +12,7 @@ #include "src/__support/common.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(size_t, strspn, (const char *src, const char *segment)) { const char *initial = src; @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(size_t, strspn, (const char *src, const char *segment)) { return src - initial; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/string/strspn.h b/libc/src/string/strspn.h index 92321d10df93e6dfe21390cd0fda2288375803bc..ddb6f388e95a22ff6136dd8dc22b78ea4e26d7f1 100644 --- a/libc/src/string/strspn.h +++ b/libc/src/string/strspn.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { size_t strspn(const char *src, const char *segment); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRSPN_H diff --git a/libc/src/string/strstr.cpp b/libc/src/string/strstr.cpp index 3a826784524433135205e68dd7d4e148a2dd4740..bfda75b2e591293cf14e8bad29382147d438f615 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 463ffb7494c9e5ea8aa15d685d48422331cbcd0d..2501b005cf9faa321255b65b6a845ec8d8788cf1 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 281197e07971d51966093a6c8fbece8c7b898abb..e7d30349d3a9c9a43f168bf61df4d424d2d025f3 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 33ac68184a3317a3474756fa2506b75567e1c54b..8788f333c13065167a16669b194b0ecadf6bed88 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 d1cc675ead32b3fd7f8419bc60574f3b71d4a71f..e8847b617330e097fc52bcf668817784b12fd009 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 f1aff3e3176a083b016ed901833911c67761eba1..b3c7b3dec162a9e05d8c1881a01d7f88dff58c8b 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 a37c220b3603848bc75efdb48b5ee73481938311..b5eb76457f8586eb276e43077a993801e22832d1 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 1ca1e731e9df1877bd4e9e7a56b66eb3537c9cf2..8178931f42dc92520025ac702cd7c13df69b7199 100644 --- a/libc/src/string/strxfrm.h +++ b/libc/src/string/strxfrm.h @@ -10,10 +10,10 @@ #define LLVM_LIBC_SRC_STRING_STRXFRM_H #include // For size_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { size_t strxfrm(char *__restrict dest, const char *__restrict src, size_t n); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_STRING_STRXFRM_H diff --git a/libc/src/sys/mman/linux/madvise.cpp b/libc/src/sys/mman/linux/madvise.cpp index af98e0bc86bf65276fa6693c079ccf16e50eb83e..ff461c1d4cb48bbca042762e912278419c5bebe2 100644 --- a/libc/src/sys/mman/linux/madvise.cpp +++ b/libc/src/sys/mman/linux/madvise.cpp @@ -14,12 +14,12 @@ #include "src/errno/libc_errno.h" #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // This function is currently linux only. It has to be refactored suitably if // madvise is to be supported on non-linux operating systems also. LLVM_LIBC_FUNCTION(int, madvise, (void *addr, size_t size, int advice)) { - int ret = __llvm_libc::syscall_impl( + int ret = LIBC_NAMESPACE::syscall_impl( SYS_madvise, reinterpret_cast(addr), size, advice); // A negative return value indicates an error with the magnitude of the @@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(int, madvise, (void *addr, size_t size, int advice)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/mman/linux/mmap.cpp b/libc/src/sys/mman/linux/mmap.cpp index dde11055ccbbe883fac6068a2104ed68e19531a1..16111c66859f5e748ba06b7143dae10886b2c3e4 100644 --- a/libc/src/sys/mman/linux/mmap.cpp +++ b/libc/src/sys/mman/linux/mmap.cpp @@ -15,7 +15,7 @@ #include // For EXEC_PAGESIZE. #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // This function is currently linux only. It has to be refactored suitably if // mmap is to be supported on non-linux operating systems also. @@ -40,8 +40,8 @@ LLVM_LIBC_FUNCTION(void *, mmap, #endif long ret = - __llvm_libc::syscall_impl(syscall_number, reinterpret_cast(addr), - size, prot, flags, fd, offset); + LIBC_NAMESPACE::syscall_impl(syscall_number, reinterpret_cast(addr), + size, prot, flags, fd, offset); // The mmap/mmap2 syscalls return negative values on error. These negative // values are actually the negative values of the error codes. So, fix them @@ -60,4 +60,4 @@ LLVM_LIBC_FUNCTION(void *, mmap, return reinterpret_cast(ret); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/mman/linux/mprotect.cpp b/libc/src/sys/mman/linux/mprotect.cpp index 360c19337b0e8933de9a9b3d2cfea282cf8d281c..2e6f2a369c1d89cb352843a12f1255d9a58c1c86 100644 --- a/libc/src/sys/mman/linux/mprotect.cpp +++ b/libc/src/sys/mman/linux/mprotect.cpp @@ -14,12 +14,12 @@ #include "src/errno/libc_errno.h" #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // This function is currently linux only. It has to be refactored suitably if // mprotect is to be supported on non-linux operating systems also. LLVM_LIBC_FUNCTION(int, mprotect, (void *addr, size_t size, int prot)) { - int ret = __llvm_libc::syscall_impl( + int ret = LIBC_NAMESPACE::syscall_impl( SYS_mprotect, reinterpret_cast(addr), size, prot); // A negative return value indicates an error with the magnitude of the @@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(int, mprotect, (void *addr, size_t size, int prot)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/mman/linux/munmap.cpp b/libc/src/sys/mman/linux/munmap.cpp index cbc48688a5038cdbe9730f969a8c9d90d6a64985..6412b4136c49e8cc0bc231f647c49c73c681be4f 100644 --- a/libc/src/sys/mman/linux/munmap.cpp +++ b/libc/src/sys/mman/linux/munmap.cpp @@ -14,13 +14,13 @@ #include "src/errno/libc_errno.h" #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // This function is currently linux only. It has to be refactored suitably if // mmap is to be supported on non-linux operating systems also. LLVM_LIBC_FUNCTION(int, munmap, (void *addr, size_t size)) { - int ret = __llvm_libc::syscall_impl(SYS_munmap, - reinterpret_cast(addr), size); + int ret = LIBC_NAMESPACE::syscall_impl( + SYS_munmap, reinterpret_cast(addr), size); // A negative return value indicates an error with the magnitude of the // value being the error code. @@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(int, munmap, (void *addr, size_t size)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/mman/linux/posix_madvise.cpp b/libc/src/sys/mman/linux/posix_madvise.cpp index 2f6a555779ed4a2421ea00c695502a7692228a46..b7b4d352c1f8a33905ba296c84a6570e67fe3660 100644 --- a/libc/src/sys/mman/linux/posix_madvise.cpp +++ b/libc/src/sys/mman/linux/posix_madvise.cpp @@ -13,7 +13,7 @@ #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // This function is currently linux only. It has to be refactored suitably if // posix_madvise is to be supported on non-linux operating systems also. @@ -23,9 +23,9 @@ LLVM_LIBC_FUNCTION(int, posix_madvise, (void *addr, size_t size, int advice)) { if (advice == POSIX_MADV_DONTNEED) { return 0; } - int ret = __llvm_libc::syscall_impl( + int ret = LIBC_NAMESPACE::syscall_impl( SYS_madvise, reinterpret_cast(addr), size, advice); return ret < 0 ? -ret : 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/mman/madvise.h b/libc/src/sys/mman/madvise.h index 01470c53ee3ba26d767b176bd7977c2048438ab8..59a03af79b5873b2edb070c37632f4ca83123c2c 100644 --- a/libc/src/sys/mman/madvise.h +++ b/libc/src/sys/mman/madvise.h @@ -11,10 +11,10 @@ #include // For size_t and off_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int madvise(void *addr, size_t size, int advice); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_MMAN_MADVISE_H diff --git a/libc/src/sys/mman/mmap.h b/libc/src/sys/mman/mmap.h index 9f7fd8b9196b44736f5d8c3c1eb9c895ac10d032..4425019c4ee1a10f5c01daaec7e01540335c3824 100644 --- a/libc/src/sys/mman/mmap.h +++ b/libc/src/sys/mman/mmap.h @@ -11,10 +11,10 @@ #include // For size_t and off_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void *mmap(void *addr, size_t size, int prot, int flags, int fd, off_t offset); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_MMAN_MMAP_H diff --git a/libc/src/sys/mman/mprotect.h b/libc/src/sys/mman/mprotect.h index a8bca8433ca919a5079d96f237a8a29697ae325e..2e59c7526b750b0b7113bc8211e619151b8327aa 100644 --- a/libc/src/sys/mman/mprotect.h +++ b/libc/src/sys/mman/mprotect.h @@ -11,10 +11,10 @@ #include // For size_t and off_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int mprotect(void *addr, size_t size, int prot); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_MMAN_MPROTECT_H diff --git a/libc/src/sys/mman/munmap.h b/libc/src/sys/mman/munmap.h index fa11d67823f620e2347238a81f26592912593c48..5d7c569043d1ad06b77f5c16feaa162c5b8fb4e4 100644 --- a/libc/src/sys/mman/munmap.h +++ b/libc/src/sys/mman/munmap.h @@ -11,10 +11,10 @@ #include // For size_t. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int munmap(void *addr, size_t size); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_MMAN_MUNMAP_H diff --git a/libc/src/sys/mman/posix_madvise.h b/libc/src/sys/mman/posix_madvise.h index c13937be16907ace48f1f6f258407535c0ac887e..b8a423bfa91914e30f381a36e7ac4e64aae877df 100644 --- a/libc/src/sys/mman/posix_madvise.h +++ b/libc/src/sys/mman/posix_madvise.h @@ -11,10 +11,10 @@ #include // For size_t and off_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int posix_madvise(void *addr, size_t size, int advice); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_MMAN_POSIX_MADVISE_H diff --git a/libc/src/sys/random/getrandom.h b/libc/src/sys/random/getrandom.h index 32a2a64d6e510da7b277f634ba84a9bb9c6ff934..e1577d9bf1eaafa48c8dae00785b70aec253e2a0 100644 --- a/libc/src/sys/random/getrandom.h +++ b/libc/src/sys/random/getrandom.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { ssize_t getrandom(void *buf, size_t buflen, unsigned int flags); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_RANDOM_GETRANDOM_H diff --git a/libc/src/sys/random/linux/getrandom.cpp b/libc/src/sys/random/linux/getrandom.cpp index 54fbc2880a5c41c4983fb0b8ddc26dfb1fec02b0..63038ad628a1044148bc4569a89dbd5fef10605c 100644 --- a/libc/src/sys/random/linux/getrandom.cpp +++ b/libc/src/sys/random/linux/getrandom.cpp @@ -14,12 +14,12 @@ #include "src/errno/libc_errno.h" #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(ssize_t, getrandom, (void *buf, size_t buflen, unsigned int flags)) { ssize_t ret = - __llvm_libc::syscall_impl(SYS_getrandom, buf, buflen, flags); + LIBC_NAMESPACE::syscall_impl(SYS_getrandom, buf, buflen, flags); if (ret < 0) { libc_errno = static_cast(-ret); return -1; @@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(ssize_t, getrandom, return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/resource/getrlimit.h b/libc/src/sys/resource/getrlimit.h index 84c056efe46729704d0b976c754dc8410948e83a..f473e82f933be57004a3913c11829a48a54af955 100644 --- a/libc/src/sys/resource/getrlimit.h +++ b/libc/src/sys/resource/getrlimit.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int getrlimit(int resource, struct rlimit *lim); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_RESOURCE_GETRLIMIT_H diff --git a/libc/src/sys/resource/linux/getrlimit.cpp b/libc/src/sys/resource/linux/getrlimit.cpp index 62b154b18e8d7927e273c68122b7a4dc0e1b19c7..4067beba6cd3039f4cf60269c096b08d58ad8fc4 100644 --- a/libc/src/sys/resource/linux/getrlimit.cpp +++ b/libc/src/sys/resource/linux/getrlimit.cpp @@ -15,11 +15,11 @@ #include // For struct rlimit #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, getrlimit, (int res, struct rlimit *limits)) { int ret = - __llvm_libc::syscall_impl(SYS_prlimit64, 0, res, nullptr, limits); + LIBC_NAMESPACE::syscall_impl(SYS_prlimit64, 0, res, nullptr, limits); if (ret < 0) { libc_errno = -ret; return -1; @@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(int, getrlimit, (int res, struct rlimit *limits)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/resource/linux/setrlimit.cpp b/libc/src/sys/resource/linux/setrlimit.cpp index 6bbe50a49b3dd88a34943ca8a42d960b20bc49a7..0692763862342869808bb60a9118fcee2ea49892 100644 --- a/libc/src/sys/resource/linux/setrlimit.cpp +++ b/libc/src/sys/resource/linux/setrlimit.cpp @@ -15,11 +15,11 @@ #include // For struct rlimit #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, setrlimit, (int res, const struct rlimit *limits)) { int ret = - __llvm_libc::syscall_impl(SYS_prlimit64, 0, res, limits, nullptr); + LIBC_NAMESPACE::syscall_impl(SYS_prlimit64, 0, res, limits, nullptr); if (ret < 0) { libc_errno = -ret; return -1; @@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(int, setrlimit, (int res, const struct rlimit *limits)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/resource/setrlimit.h b/libc/src/sys/resource/setrlimit.h index e6dc00e35714b55a46f9d3202c62e69be6cd39e9..d881b599833d21c7df1df155bbdf0b68693452c5 100644 --- a/libc/src/sys/resource/setrlimit.h +++ b/libc/src/sys/resource/setrlimit.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int setrlimit(int resource, const struct rlimit *lim); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_RESOURCE_SETRLIMIT_H diff --git a/libc/src/sys/select/linux/select.cpp b/libc/src/sys/select/linux/select.cpp index 5850c9418d822a028046dfa28c36837ea669576b..3f387c14ec5601e351e6729c41aa3835c0827c41 100644 --- a/libc/src/sys/select/linux/select.cpp +++ b/libc/src/sys/select/linux/select.cpp @@ -18,7 +18,7 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { struct pselect6_sigset_t { sigset_t *ss; @@ -54,11 +54,11 @@ LLVM_LIBC_FUNCTION(int, select, } pselect6_sigset_t pss{nullptr, sizeof(sigset_t)}; #if SYS_pselect6 - int ret = __llvm_libc::syscall_impl(SYS_pselect6, nfds, read_set, - write_set, error_set, &ts, &pss); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_pselect6, nfds, read_set, + write_set, error_set, &ts, &pss); #elif defined(SYS_pselect6_time64) - int ret = __llvm_libc::syscall_impl(SYS_pselect6_time64, nfds, read_set, - write_set, error_set, &ts, &pss); + int ret = LIBC_NAMESPACE::syscall_impl( + SYS_pselect6_time64, nfds, read_set, write_set, error_set, &ts, &pss); #else #error "SYS_pselect6 and SYS_pselect6_time64 syscalls not available." #endif @@ -69,4 +69,4 @@ LLVM_LIBC_FUNCTION(int, select, return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/select/select.h b/libc/src/sys/select/select.h index ca81c0bbd5d74657e4c91b28e017889418c6febe..65cd15cd365c42c04afaeee46d8b3b2a5b9b9aef 100644 --- a/libc/src/sys/select/select.h +++ b/libc/src/sys/select/select.h @@ -11,11 +11,11 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int select(int nfds, fd_set *__restrict read_set, fd_set *__restrict write_set, fd_set *__restrict error_set, struct timeval *__restrict timeout); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_SELECT_SELECT_H diff --git a/libc/src/sys/sendfile/linux/sendfile.cpp b/libc/src/sys/sendfile/linux/sendfile.cpp index 43ddf813e157feef486e55433ccf5c1400f031cf..5a7c012fe997d8b05a2d7ecc5efdc5b0433038a7 100644 --- a/libc/src/sys/sendfile/linux/sendfile.cpp +++ b/libc/src/sys/sendfile/linux/sendfile.cpp @@ -15,18 +15,18 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(ssize_t, sendfile, (int out_fd, int in_fd, off_t *offset, size_t count)) { #ifdef SYS_sendfile - ssize_t ret = __llvm_libc::syscall_impl(SYS_sendfile, in_fd, out_fd, - offset, count); + ssize_t ret = LIBC_NAMESPACE::syscall_impl(SYS_sendfile, in_fd, + out_fd, offset, count); #elif defined(SYS_sendfile64) // Same as sendfile but can handle large offsets static_assert(sizeof(off_t) == 8); - ssize_t ret = __llvm_libc::syscall_impl(SYS_sendfile64, in_fd, - out_fd, offset, count); + ssize_t ret = LIBC_NAMESPACE::syscall_impl(SYS_sendfile64, in_fd, + out_fd, offset, count); #else #error "sendfile and sendfile64 syscalls not available." #endif @@ -37,4 +37,4 @@ LLVM_LIBC_FUNCTION(ssize_t, sendfile, return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/sendfile/sendfile.h b/libc/src/sys/sendfile/sendfile.h index ba9bf97e3af0a295d74d98f48f2df2473c5cba3b..14673bba3fbdfa9ce07c38f57ae2ec09ddd9796d 100644 --- a/libc/src/sys/sendfile/sendfile.h +++ b/libc/src/sys/sendfile/sendfile.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { ssize_t sendfile(int, int, off_t *, size_t); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_SENDFILE_SENDFILE_H diff --git a/libc/src/sys/socket/linux/socket.cpp b/libc/src/sys/socket/linux/socket.cpp index 7f87450f152fc712be3888463336d3d8f798cafd..6429fd12013ea04397ff1f89b8e525e7a70fd9a5 100644 --- a/libc/src/sys/socket/linux/socket.cpp +++ b/libc/src/sys/socket/linux/socket.cpp @@ -16,15 +16,16 @@ #include // For SYS_SOCKET socketcall number. #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, socket, (int domain, int type, int protocol)) { #ifdef SYS_socket - int ret = __llvm_libc::syscall_impl(SYS_socket, domain, type, protocol); + int ret = + LIBC_NAMESPACE::syscall_impl(SYS_socket, domain, type, protocol); #elif defined(SYS_socketcall) unsigned long sockcall_args[3] = {domain, type, protocol}; - int ret = - __llvm_libc::syscall_impl(SYS_socketcall, SYS_SOCKET, sockcall_args); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_socketcall, SYS_SOCKET, + sockcall_args); #else #error "socket and socketcall syscalls unavailable for this platform." #endif @@ -35,4 +36,4 @@ LLVM_LIBC_FUNCTION(int, socket, (int domain, int type, int protocol)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/socket/socket.h b/libc/src/sys/socket/socket.h index b18aa7f388d83f3fc9a240e596a15d9833ea93ba..a6578989d2af8d2047111fe8845cf45498764217 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 bfeaa9dbd721eb8f6102a76f7a0c2c8a67324345..decb44222177b0bcc17c427622016c5204e2b3af 100644 --- a/libc/src/sys/stat/chmod.h +++ b/libc/src/sys/stat/chmod.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int chmod(const char *path, mode_t mode); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_STAT_CHMOD_H diff --git a/libc/src/sys/stat/fchmod.h b/libc/src/sys/stat/fchmod.h index 34c167067c08a973089835245fb3ff215d063c67..611bba16fad6cc8e8877e66a0266979c11909aaf 100644 --- a/libc/src/sys/stat/fchmod.h +++ b/libc/src/sys/stat/fchmod.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fchmod(int fd, mode_t mode); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_STAT_FCHMOD_H diff --git a/libc/src/sys/stat/fchmodat.h b/libc/src/sys/stat/fchmodat.h index 3ad9af1b185adb1fae1f2429a046abd1e7fb1507..e7b12693558d438fbc67776c57ce10fc63b1ebdd 100644 --- a/libc/src/sys/stat/fchmodat.h +++ b/libc/src/sys/stat/fchmodat.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fchmodat(int dirfd, const char *path, mode_t mode, int flags); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_STAT_FCHMODAT_H diff --git a/libc/src/sys/stat/fstat.h b/libc/src/sys/stat/fstat.h index ec559a6bf225bd2893cd721705396ae8533288ba..7633ee60a374e3be1c8e4de8b8a66be2d4617005 100644 --- a/libc/src/sys/stat/fstat.h +++ b/libc/src/sys/stat/fstat.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int fstat(int fd, struct stat *statbuf); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_STAT_FSTAT_H diff --git a/libc/src/sys/stat/linux/chmod.cpp b/libc/src/sys/stat/linux/chmod.cpp index 9123ea549a8e339734d45546b4e63f5390cc7d2b..085b91691d89f47992235e3585b6a990c3550d8d 100644 --- a/libc/src/sys/stat/linux/chmod.cpp +++ b/libc/src/sys/stat/linux/chmod.cpp @@ -16,13 +16,14 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, chmod, (const char *path, mode_t mode)) { #ifdef SYS_chmod - int ret = __llvm_libc::syscall_impl(SYS_chmod, path, mode); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_chmod, path, mode); #elif defined(SYS_fchmodat) - int ret = __llvm_libc::syscall_impl(SYS_fchmodat, AT_FDCWD, path, mode); + int ret = + LIBC_NAMESPACE::syscall_impl(SYS_fchmodat, AT_FDCWD, path, mode); #else #error "chmod and fchmodat syscalls not available." #endif @@ -34,4 +35,4 @@ LLVM_LIBC_FUNCTION(int, chmod, (const char *path, mode_t mode)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/stat/linux/fchmod.cpp b/libc/src/sys/stat/linux/fchmod.cpp index fa9d857c4e00ee4acecc16148bef6bfa24bd977f..cdc9cbf37ba5449788ed5b82e223f07e684f2a0c 100644 --- a/libc/src/sys/stat/linux/fchmod.cpp +++ b/libc/src/sys/stat/linux/fchmod.cpp @@ -16,10 +16,10 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fchmod, (int fd, mode_t mode)) { - int ret = __llvm_libc::syscall_impl(SYS_fchmod, fd, mode); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_fchmod, fd, mode); if (ret < 0) { libc_errno = -ret; return -1; @@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(int, fchmod, (int fd, mode_t mode)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/stat/linux/fchmodat.cpp b/libc/src/sys/stat/linux/fchmodat.cpp index 9abb3de14a96255346c84e1d937548ba0a407099..43b4cf00111bab1011af877da28319ca6d693032 100644 --- a/libc/src/sys/stat/linux/fchmodat.cpp +++ b/libc/src/sys/stat/linux/fchmodat.cpp @@ -15,12 +15,12 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fchmodat, (int dirfd, const char *path, mode_t mode, int flags)) { int ret = - __llvm_libc::syscall_impl(SYS_fchmodat, dirfd, path, mode, flags); + LIBC_NAMESPACE::syscall_impl(SYS_fchmodat, dirfd, path, mode, flags); if (ret < 0) { libc_errno = -ret; return -1; @@ -28,4 +28,4 @@ LLVM_LIBC_FUNCTION(int, fchmodat, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/stat/linux/fstat.cpp b/libc/src/sys/stat/linux/fstat.cpp index e187e5cd48eb67ee0de7d54225981353cf0a0bda..516417858569c450bc2cfe61010f170958ad101f 100644 --- a/libc/src/sys/stat/linux/fstat.cpp +++ b/libc/src/sys/stat/linux/fstat.cpp @@ -15,7 +15,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fstat, (int fd, struct stat *statbuf)) { int err = statx(fd, "", AT_EMPTY_PATH, statbuf); @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, fstat, (int fd, struct stat *statbuf)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/stat/linux/kernel_statx.h b/libc/src/sys/stat/linux/kernel_statx.h index 48b23065d800feaf6c4d39e03d32ab023a3df81b..60969160b9ba4f8390615a9cc5f6777b991361ac 100644 --- a/libc/src/sys/stat/linux/kernel_statx.h +++ b/libc/src/sys/stat/linux/kernel_statx.h @@ -67,14 +67,14 @@ constexpr unsigned int STATX_BASIC_STATS_MASK = 0x7FF; } // Anonymous namespace -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LIBC_INLINE int statx(int dirfd, const char *__restrict path, int flags, struct stat *__restrict statbuf) { // We make a statx syscall and copy out the result into the |statbuf|. ::statx_buf xbuf; - int ret = __llvm_libc::syscall_impl(SYS_statx, dirfd, path, flags, - ::STATX_BASIC_STATS_MASK, &xbuf); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_statx, dirfd, path, flags, + ::STATX_BASIC_STATS_MASK, &xbuf); if (ret < 0) return -ret; @@ -98,6 +98,6 @@ LIBC_INLINE int statx(int dirfd, const char *__restrict path, int flags, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_STAT_LINUX_KERNEL_STATX_H diff --git a/libc/src/sys/stat/linux/lstat.cpp b/libc/src/sys/stat/linux/lstat.cpp index 15a721ba784bc6a416fc1e9bc94af1dc48e52c8c..b2698148973a5f96a1e110f116f7d392121cc25a 100644 --- a/libc/src/sys/stat/linux/lstat.cpp +++ b/libc/src/sys/stat/linux/lstat.cpp @@ -16,7 +16,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, lstat, (const char *__restrict path, @@ -29,4 +29,4 @@ LLVM_LIBC_FUNCTION(int, lstat, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/stat/linux/mkdir.cpp b/libc/src/sys/stat/linux/mkdir.cpp index 1f5974c23c58c0e612eb2ed202f3927ed24c3eee..63b64ac091a876b82615c92c567be9002dd4d16c 100644 --- a/libc/src/sys/stat/linux/mkdir.cpp +++ b/libc/src/sys/stat/linux/mkdir.cpp @@ -16,13 +16,14 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, mkdir, (const char *path, mode_t mode)) { #ifdef SYS_mkdir - int ret = __llvm_libc::syscall_impl(SYS_mkdir, path, mode); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_mkdir, path, mode); #elif defined(SYS_mkdirat) - int ret = __llvm_libc::syscall_impl(SYS_mkdirat, AT_FDCWD, path, mode); + int ret = + LIBC_NAMESPACE::syscall_impl(SYS_mkdirat, AT_FDCWD, path, mode); #else #error "mkdir and mkdirat syscalls not available." #endif @@ -34,4 +35,4 @@ LLVM_LIBC_FUNCTION(int, mkdir, (const char *path, mode_t mode)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/stat/linux/mkdirat.cpp b/libc/src/sys/stat/linux/mkdirat.cpp index ff266b18182cc60ed66de7dc4771f9c3a3cf0e92..0128d7c081cfd2a5b3e4ae05f460f0a470e034a3 100644 --- a/libc/src/sys/stat/linux/mkdirat.cpp +++ b/libc/src/sys/stat/linux/mkdirat.cpp @@ -15,11 +15,11 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, mkdirat, (int dfd, const char *path, mode_t mode)) { #ifdef SYS_mkdirat - int ret = __llvm_libc::syscall_impl(SYS_mkdirat, dfd, path, mode); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_mkdirat, dfd, path, mode); #else #error "mkdirat syscall not available." #endif @@ -31,4 +31,4 @@ LLVM_LIBC_FUNCTION(int, mkdirat, (int dfd, const char *path, mode_t mode)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/stat/linux/stat.cpp b/libc/src/sys/stat/linux/stat.cpp index 9c3b56bff47466d4d4217634666eb9847aec16c4..c30c8b65da1e8ae8cfb7aff4fcc0b018bd8f9d31 100644 --- a/libc/src/sys/stat/linux/stat.cpp +++ b/libc/src/sys/stat/linux/stat.cpp @@ -15,7 +15,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, stat, (const char *__restrict path, @@ -28,4 +28,4 @@ LLVM_LIBC_FUNCTION(int, stat, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/stat/lstat.h b/libc/src/sys/stat/lstat.h index 7d5ffa23eece6d7630738beb6086351d01a0208e..42bd8e932da755ac360c88d82a1bf3aae52eeee4 100644 --- a/libc/src/sys/stat/lstat.h +++ b/libc/src/sys/stat/lstat.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int lstat(const char *__restrict path, struct stat *__restrict statbuf); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_STAT_LSTAT_H diff --git a/libc/src/sys/stat/mkdir.h b/libc/src/sys/stat/mkdir.h index 535423acff78825bef9a952d22fa89a1b858c148..9f2991d850cbc975efd73c48bb3e7b691ceb198e 100644 --- a/libc/src/sys/stat/mkdir.h +++ b/libc/src/sys/stat/mkdir.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int mkdir(const char *path, mode_t mode); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_STAT_MKDIR_H diff --git a/libc/src/sys/stat/mkdirat.h b/libc/src/sys/stat/mkdirat.h index 883709cb2158554a745dd53b3e6d500250105f86..322209754fc0b767704169fc4a760a43ab5c3b7c 100644 --- a/libc/src/sys/stat/mkdirat.h +++ b/libc/src/sys/stat/mkdirat.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int mkdirat(int dfd, const char *path, mode_t mode); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_STAT_MKDIRAT_H diff --git a/libc/src/sys/stat/stat.h b/libc/src/sys/stat/stat.h index a272aa422439fa2959c6c254d60901e8e3e2eaf2..5d2eba5bd74c44824ac8667c3cd0c6e5a48bdd0b 100644 --- a/libc/src/sys/stat/stat.h +++ b/libc/src/sys/stat/stat.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int stat(const char *__restrict path, struct stat *__restrict statbuf); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_STAT_STAT_H diff --git a/libc/src/sys/utsname/linux/uname.cpp b/libc/src/sys/utsname/linux/uname.cpp index a73e477e0bff2586c55643b01b933929dcd4514d..f0796b63f62e95b41bfb95d09aa1cd0465591ca0 100644 --- a/libc/src/sys/utsname/linux/uname.cpp +++ b/libc/src/sys/utsname/linux/uname.cpp @@ -15,10 +15,10 @@ #include // For syscall numbers. #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, uname, (struct utsname * name)) { - int ret = __llvm_libc::syscall_impl(SYS_uname, name); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_uname, name); if (ret >= 0) return 1; @@ -26,4 +26,4 @@ LLVM_LIBC_FUNCTION(int, uname, (struct utsname * name)) { return -1; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/sys/utsname/uname.h b/libc/src/sys/utsname/uname.h index 80c748aefe5c076cc0ff38d1567db1e7c6e87677..b347cf00f33b9f5b983b68b90f05c8c21bdaeda7 100644 --- a/libc/src/sys/utsname/uname.h +++ b/libc/src/sys/utsname/uname.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int uname(struct utsname *name); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_UTSNAME_UNAME_H diff --git a/libc/src/sys/wait/linux/wait.cpp b/libc/src/sys/wait/linux/wait.cpp index 855d45242741cc75513bd4a34d8db7fd3adf6663..02e6a34c1e8b13ad09d512bcdd25d3734fe4bbd4 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 f73f57be7b18e7ded18a841b74afabba333c3658..84036caf0a7b3f1a6963f35e230ebf4fa46cfe73 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 0ad83ae0d72ea71332b67dbf4a18be5c46c92038..b2e8229a525832d251b278223d355e2604932521 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 d49fb21d9b728fd476308811eb4caf34bee0287d..abe5249b83c819f2ee974db27c19ff400efa84ba 100644 --- a/libc/src/sys/wait/wait.h +++ b/libc/src/sys/wait/wait.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { pid_t wait(int *waitstatus); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_WAIT_WAIT_H diff --git a/libc/src/sys/wait/wait4.h b/libc/src/sys/wait/wait4.h index 91c01747ecbb5b726db2722829786a7c0eb5ee13..3205b28e968ef09e81ecdb8737d28cd635a010aa 100644 --- a/libc/src/sys/wait/wait4.h +++ b/libc/src/sys/wait/wait4.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { pid_t wait4(pid_t pid, int *waitstatus, int options, struct rusage *usage); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_WAIT_WAIT4_H diff --git a/libc/src/sys/wait/wait4Impl.h b/libc/src/sys/wait/wait4Impl.h index 059b2cae43047243389554ac27c73f5302ffaad4..956ad0f8c9c411353c55cc7ef8ef48be737873d5 100644 --- a/libc/src/sys/wait/wait4Impl.h +++ b/libc/src/sys/wait/wait4Impl.h @@ -18,7 +18,7 @@ #include // For syscall numbers. #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { // The implementation of wait here is very minimal. We will add more @@ -27,8 +27,8 @@ namespace internal { LIBC_INLINE ErrorOr wait4impl(pid_t pid, int *wait_status, int options, struct rusage *usage) { #if SYS_wait4 - pid = __llvm_libc::syscall_impl(SYS_wait4, pid, wait_status, options, - usage); + pid = LIBC_NAMESPACE::syscall_impl(SYS_wait4, pid, wait_status, + options, usage); #elif defined(SYS_waitid) int idtype = P_PID; if (pid == -1) { @@ -43,8 +43,8 @@ LIBC_INLINE ErrorOr wait4impl(pid_t pid, int *wait_status, int options, options |= WEXITED; siginfo_t info; - pid = __llvm_libc::syscall_impl(SYS_waitid, idtype, pid, &info, - options, usage); + pid = LIBC_NAMESPACE::syscall_impl(SYS_waitid, idtype, pid, &info, + options, usage); if (pid >= 0) pid = info.si_pid; @@ -80,6 +80,6 @@ LIBC_INLINE ErrorOr wait4impl(pid_t pid, int *wait_status, int options, } } // namespace internal -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_WAIT_WAIT4IMPL_H diff --git a/libc/src/sys/wait/waitpid.h b/libc/src/sys/wait/waitpid.h index 1407c7f9b0ed549f6bb9126eb73396004f1bd6df..37ebf289ff072a19538e0d22120e32902903aa70 100644 --- a/libc/src/sys/wait/waitpid.h +++ b/libc/src/sys/wait/waitpid.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { pid_t waitpid(pid_t pid, int *waitstatus, int options); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_SYS_WAIT_WAITPID_H diff --git a/libc/src/termios/cfgetispeed.h b/libc/src/termios/cfgetispeed.h index 9cd3a4bac88f892803d5e5dabfc830d174259dbc..7ea280f69da44464fb324b5ee7281b1887acc4ee 100644 --- a/libc/src/termios/cfgetispeed.h +++ b/libc/src/termios/cfgetispeed.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { speed_t cfgetispeed(const struct termios *t); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TERMIOS_CFGETISPEED_H diff --git a/libc/src/termios/cfgetospeed.h b/libc/src/termios/cfgetospeed.h index 14ff9d018bcb4a740bc889c984ce0bf1f8d790aa..95e3edb51b382e7e33a7c1a1466aec9becdef06a 100644 --- a/libc/src/termios/cfgetospeed.h +++ b/libc/src/termios/cfgetospeed.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { speed_t cfgetospeed(const struct termios *t); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TERMIOS_CFGETOSPEED_H diff --git a/libc/src/termios/cfsetispeed.h b/libc/src/termios/cfsetispeed.h index 8d1648f10cd32c01759809ed8fcedb76e7a7378e..e03a2d1ef0cf55e9b953a072b1cdb9e2b0775990 100644 --- a/libc/src/termios/cfsetispeed.h +++ b/libc/src/termios/cfsetispeed.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int cfsetispeed(struct termios *t, speed_t speed); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TERMIOS_CFSETISPEED_H diff --git a/libc/src/termios/cfsetospeed.h b/libc/src/termios/cfsetospeed.h index e7bb21b38a88061a4b5a4364b1cd1bcbd8e3a5fa..74d41abc5326df3a90cd86e06b841815c3cb4564 100644 --- a/libc/src/termios/cfsetospeed.h +++ b/libc/src/termios/cfsetospeed.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int cfsetospeed(struct termios *t, speed_t speed); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TERMIOS_CFSETOSPEED_H diff --git a/libc/src/termios/linux/cfgetispeed.cpp b/libc/src/termios/linux/cfgetispeed.cpp index d4877e8cbc6bf05702fd2657d563cbba8050e162..18e34b2dcb07c9e61a2f82bd0ae9b252426b24d5 100644 --- a/libc/src/termios/linux/cfgetispeed.cpp +++ b/libc/src/termios/linux/cfgetispeed.cpp @@ -12,10 +12,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(speed_t, cfgetispeed, (const struct termios *t)) { return t->c_cflag & CBAUD; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/termios/linux/cfgetospeed.cpp b/libc/src/termios/linux/cfgetospeed.cpp index 5fbe73de29e3693a38254efe5a29b0fd66a5e71d..1989b3feabe975b4e455ec32a9037c5627a27f50 100644 --- a/libc/src/termios/linux/cfgetospeed.cpp +++ b/libc/src/termios/linux/cfgetospeed.cpp @@ -12,10 +12,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(speed_t, cfgetospeed, (const struct termios *t)) { return t->c_cflag & CBAUD; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/termios/linux/cfsetispeed.cpp b/libc/src/termios/linux/cfsetispeed.cpp index 7beb1171b8ee4b328ddbf97effb463404e98eb35..0e8ac55fe700e5337af4100b671cd814716d397a 100644 --- a/libc/src/termios/linux/cfsetispeed.cpp +++ b/libc/src/termios/linux/cfsetispeed.cpp @@ -13,7 +13,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, cfsetispeed, (struct termios * t, speed_t speed)) { constexpr speed_t NOT_SPEED_MASK = ~speed_t(CBAUD); @@ -28,4 +28,4 @@ LLVM_LIBC_FUNCTION(int, cfsetispeed, (struct termios * t, speed_t speed)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/termios/linux/cfsetospeed.cpp b/libc/src/termios/linux/cfsetospeed.cpp index 327cc56428f3ccdcb08dc9c69b8f071a4b85d36e..d21f629cb74b6eb31d9e3e0bdca127d309c0ddb5 100644 --- a/libc/src/termios/linux/cfsetospeed.cpp +++ b/libc/src/termios/linux/cfsetospeed.cpp @@ -13,7 +13,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, cfsetospeed, (struct termios * t, speed_t speed)) { constexpr speed_t NOT_SPEED_MASK = ~speed_t(CBAUD); @@ -28,4 +28,4 @@ LLVM_LIBC_FUNCTION(int, cfsetospeed, (struct termios * t, speed_t speed)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/termios/linux/kernel_termios.h b/libc/src/termios/linux/kernel_termios.h index 252f63db3aa6a8ee71ff8dad9120ae092b66a4c7..d96de72029f761d69ccdca73524eb3fed5aba6d6 100644 --- a/libc/src/termios/linux/kernel_termios.h +++ b/libc/src/termios/linux/kernel_termios.h @@ -12,7 +12,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // The kernel's struct termios is different from the libc's struct termios. The // kernel's syscalls expect the size and layout of its definition of struct @@ -36,6 +36,6 @@ struct kernel_termios { cc_t c_cc[KERNEL_NCCS]; }; -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TERMIOS_LINUX_KERNEL_TERMIOS_H diff --git a/libc/src/termios/linux/tcdrain.cpp b/libc/src/termios/linux/tcdrain.cpp index a45a00a8909ddad75375fcdc02bf2bb274b21503..c3826ff9a101c204417234b58e70ee62b17071b3 100644 --- a/libc/src/termios/linux/tcdrain.cpp +++ b/libc/src/termios/linux/tcdrain.cpp @@ -16,10 +16,10 @@ #include // For syscall numbers #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, tcdrain, (int fd)) { - int ret = __llvm_libc::syscall_impl(SYS_ioctl, fd, TCSBRK, 1); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_ioctl, fd, TCSBRK, 1); if (ret < 0) { libc_errno = -ret; return -1; @@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(int, tcdrain, (int fd)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/termios/linux/tcflow.cpp b/libc/src/termios/linux/tcflow.cpp index a959cf7e9f7bf266a9a1afbab5d3442b9c7758f6..9753ef767e927903a059addb1854d19de1c61a2d 100644 --- a/libc/src/termios/linux/tcflow.cpp +++ b/libc/src/termios/linux/tcflow.cpp @@ -16,10 +16,10 @@ #include // For syscall numbers #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, tcflow, (int fd, int action)) { - int ret = __llvm_libc::syscall_impl(SYS_ioctl, fd, TCXONC, action); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_ioctl, fd, TCXONC, action); if (ret < 0) { libc_errno = -ret; return -1; @@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(int, tcflow, (int fd, int action)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/termios/linux/tcflush.cpp b/libc/src/termios/linux/tcflush.cpp index 26183293142a63e1bbea30dd36b138fba6aeb729..9c7e8f02431e8878beb68786a41aaf914bb7a7d2 100644 --- a/libc/src/termios/linux/tcflush.cpp +++ b/libc/src/termios/linux/tcflush.cpp @@ -16,11 +16,11 @@ #include // For syscall numbers #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, tcflush, (int fd, int queue_selector)) { int ret = - __llvm_libc::syscall_impl(SYS_ioctl, fd, TCFLSH, queue_selector); + LIBC_NAMESPACE::syscall_impl(SYS_ioctl, fd, TCFLSH, queue_selector); if (ret < 0) { libc_errno = -ret; return -1; @@ -28,4 +28,4 @@ LLVM_LIBC_FUNCTION(int, tcflush, (int fd, int queue_selector)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/termios/linux/tcgetattr.cpp b/libc/src/termios/linux/tcgetattr.cpp index 931591c73b2b7bfbb262c94f1bf9e9b2057620ee..254c48521bb908c7ecf14c740a5f8f26f20b27e9 100644 --- a/libc/src/termios/linux/tcgetattr.cpp +++ b/libc/src/termios/linux/tcgetattr.cpp @@ -17,11 +17,11 @@ #include // For syscall numbers #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, tcgetattr, (int fd, struct termios *t)) { - __llvm_libc::kernel_termios kt; - int ret = __llvm_libc::syscall_impl(SYS_ioctl, fd, TCGETS, &kt); + LIBC_NAMESPACE::kernel_termios kt; + int ret = LIBC_NAMESPACE::syscall_impl(SYS_ioctl, fd, TCGETS, &kt); if (ret < 0) { libc_errno = -ret; return -1; @@ -43,4 +43,4 @@ LLVM_LIBC_FUNCTION(int, tcgetattr, (int fd, struct termios *t)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/termios/linux/tcgetsid.cpp b/libc/src/termios/linux/tcgetsid.cpp index 9afbc91ad38d5827efe2b384f43cef5425e797ff..7b2abf8f4cf08ce82dc48583739e8ac66186f4d8 100644 --- a/libc/src/termios/linux/tcgetsid.cpp +++ b/libc/src/termios/linux/tcgetsid.cpp @@ -16,11 +16,11 @@ #include // For syscall numbers #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(pid_t, tcgetsid, (int fd)) { pid_t sid; - int ret = __llvm_libc::syscall_impl(SYS_ioctl, fd, TIOCGSID, &sid); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_ioctl, fd, TIOCGSID, &sid); if (ret < 0) { libc_errno = -ret; return -1; @@ -28,4 +28,4 @@ LLVM_LIBC_FUNCTION(pid_t, tcgetsid, (int fd)) { return sid; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/termios/linux/tcsendbreak.cpp b/libc/src/termios/linux/tcsendbreak.cpp index a2467f06c1486580107d553f1499b9f2c984c317..fdd3f8adf7d8d3afd287b4985a4a2479f5402afc 100644 --- a/libc/src/termios/linux/tcsendbreak.cpp +++ b/libc/src/termios/linux/tcsendbreak.cpp @@ -16,13 +16,13 @@ #include // For syscall numbers #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(pid_t, tcsendbreak, (int fd, int /* unused duration */)) { // POSIX leaves the behavior for non-zero duration implementation dependent. // Which means that the behavior can be the same as it is when duration is // zero. So, we just pass zero to the syscall. - int ret = __llvm_libc::syscall_impl(SYS_ioctl, fd, TCSBRK, 0); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_ioctl, fd, TCSBRK, 0); if (ret < 0) { libc_errno = -ret; return -1; @@ -30,4 +30,4 @@ LLVM_LIBC_FUNCTION(pid_t, tcsendbreak, (int fd, int /* unused duration */)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/termios/linux/tcsetattr.cpp b/libc/src/termios/linux/tcsetattr.cpp index d3872b1138816d4d452b4ced3b879a283de733b8..ba500a00210d9980bef07af30998159940769e2b 100644 --- a/libc/src/termios/linux/tcsetattr.cpp +++ b/libc/src/termios/linux/tcsetattr.cpp @@ -17,7 +17,7 @@ #include // For syscall numbers #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, tcsetattr, (int fd, int actions, const struct termios *t)) { @@ -51,7 +51,7 @@ LLVM_LIBC_FUNCTION(int, tcsetattr, kt.c_cc[i] = 0; } - int ret = __llvm_libc::syscall_impl(SYS_ioctl, fd, cmd, &kt); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_ioctl, fd, cmd, &kt); if (ret < 0) { libc_errno = -ret; return -1; @@ -59,4 +59,4 @@ LLVM_LIBC_FUNCTION(int, tcsetattr, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/termios/tcdrain.h b/libc/src/termios/tcdrain.h index 1bde86d890b0feb72bb2ff7a354428c0b4511dbe..52042063108cc5d6612a6ee019f53aa48dfd1a87 100644 --- a/libc/src/termios/tcdrain.h +++ b/libc/src/termios/tcdrain.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int tcdrain(int fd); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TERMIOS_TCDRAIN_H diff --git a/libc/src/termios/tcflow.h b/libc/src/termios/tcflow.h index 4040c2724d56cee115c90ba7cf67ba58334c88c4..267d3f682d7b2ed3a5af12108e2289917c42d278 100644 --- a/libc/src/termios/tcflow.h +++ b/libc/src/termios/tcflow.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int tcflow(int fd, int action); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TERMIOS_TCFLOW_H diff --git a/libc/src/termios/tcflush.h b/libc/src/termios/tcflush.h index 61fec9baae1a89dc3b2bcb70ed1ff33e9c9d7883..d631ca21379e90381febeb64cc8b571109c8ccad 100644 --- a/libc/src/termios/tcflush.h +++ b/libc/src/termios/tcflush.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int tcflush(int fd, int queue_selector); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TERMIOS_TCFLUSH_H diff --git a/libc/src/termios/tcgetattr.h b/libc/src/termios/tcgetattr.h index 61fdcdbdfd8b927031ae5cec5a6237a4cc153783..c39aa4135256d1c0aaa4bd22ed48d72538b8bc14 100644 --- a/libc/src/termios/tcgetattr.h +++ b/libc/src/termios/tcgetattr.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int tcgetattr(int fd, struct termios *t); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TERMIOS_TCGETATTR_H diff --git a/libc/src/termios/tcgetsid.h b/libc/src/termios/tcgetsid.h index 1d8934764a7af3bd1577211a6f42c5440aab1f7a..07dbb22b1677566a2292f086afe0718a785cb054 100644 --- a/libc/src/termios/tcgetsid.h +++ b/libc/src/termios/tcgetsid.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { pid_t tcgetsid(int fd); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TERMIOS_TCGETSID_H diff --git a/libc/src/termios/tcsendbreak.h b/libc/src/termios/tcsendbreak.h index 52d72435ab129f8938828706bf124d1cb5147819..487fdad5048042f6ba366bb5e64999dfed2a9d9f 100644 --- a/libc/src/termios/tcsendbreak.h +++ b/libc/src/termios/tcsendbreak.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int tcsendbreak(int fd, int duration); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TERMIOS_TCSENDBREAK_H diff --git a/libc/src/termios/tcsetattr.h b/libc/src/termios/tcsetattr.h index a7fdfd7d57625fb9e5147163f99f6e0f81c97fa2..d514ac71210bb3bb2c57551df8abd8ef95abb28b 100644 --- a/libc/src/termios/tcsetattr.h +++ b/libc/src/termios/tcsetattr.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int tcsetattr(int fd, int actions, const struct termios *t); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TERMIOS_TCSETATTR_H diff --git a/libc/src/threads/call_once.cpp b/libc/src/threads/call_once.cpp index 67ab34509a4c945db129405aeb2b3ac9eb6a8fa1..2d91094b12091893dd7781ce41f41e5d80db44e7 100644 --- a/libc/src/threads/call_once.cpp +++ b/libc/src/threads/call_once.cpp @@ -12,7 +12,7 @@ #include // For once_flag and __call_once_func_t definitions. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, call_once, (once_flag * flag, __call_once_func_t func)) { @@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(void, call_once, reinterpret_cast(func)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/call_once.h b/libc/src/threads/call_once.h index c1e1a71da2d5c5c838b1ff7143c51f8e23169520..186d63cecdbdd2d10602cc260bec41cf3ed34138 100644 --- a/libc/src/threads/call_once.h +++ b/libc/src/threads/call_once.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void call_once(once_flag *flag, __call_once_func_t func); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_CALL_ONCE_H diff --git a/libc/src/threads/cnd_broadcast.h b/libc/src/threads/cnd_broadcast.h index fd021956b7f66454cb68f3edd6aebcb70a67bd3e..4e996f22748f3fc4f0f123f5756c66b9fbdcd180 100644 --- a/libc/src/threads/cnd_broadcast.h +++ b/libc/src/threads/cnd_broadcast.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int cnd_broadcast(cnd_t *cond); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_CND_BROADCAST_H diff --git a/libc/src/threads/cnd_destroy.h b/libc/src/threads/cnd_destroy.h index 3400257529e38e3c8b06ee887588a5477ee113bb..d102e7b83e7bca3ac119ba1e7356011a90957db5 100644 --- a/libc/src/threads/cnd_destroy.h +++ b/libc/src/threads/cnd_destroy.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void cnd_destroy(cnd_t *cond); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_CND_DESTROY_H diff --git a/libc/src/threads/cnd_init.h b/libc/src/threads/cnd_init.h index 826564b0498634ae286a46cc7626c6384d2af6d4..c4fc02f5f9e7ef2ecfab2226f39b82bc1e9b5969 100644 --- a/libc/src/threads/cnd_init.h +++ b/libc/src/threads/cnd_init.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int cnd_init(cnd_t *cond); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_CND_INIT_H diff --git a/libc/src/threads/cnd_signal.h b/libc/src/threads/cnd_signal.h index ec2a97721997702654ab526ac03e76006d660103..4c60a9295299cf7994aebc6fa548423a445ef12c 100644 --- a/libc/src/threads/cnd_signal.h +++ b/libc/src/threads/cnd_signal.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int cnd_signal(cnd_t *cond); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_CND_SIGNAL_H diff --git a/libc/src/threads/cnd_wait.h b/libc/src/threads/cnd_wait.h index 812e70425060f7c9a8ce225fb600fbf5b845fcbe..5d2cdbb68c78f0d201a8419d31df6f42c64e5f5e 100644 --- a/libc/src/threads/cnd_wait.h +++ b/libc/src/threads/cnd_wait.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int cnd_wait(cnd_t *cond, mtx_t *mutex); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_CND_WAIT_H diff --git a/libc/src/threads/linux/CndVar.h b/libc/src/threads/linux/CndVar.h index 535f7299fcc04ca36f984b0dc084972e9aa115ac..b4afdef9f9eba7a973b8a37f83cd97854019204c 100644 --- a/libc/src/threads/linux/CndVar.h +++ b/libc/src/threads/linux/CndVar.h @@ -19,7 +19,7 @@ #include // For syscall numbers. #include // For values like thrd_success etc. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { struct CndVar { enum CndWaiterStatus : uint32_t { @@ -84,8 +84,8 @@ struct CndVar { } } - __llvm_libc::syscall_impl(FUTEX_SYSCALL_ID, &waiter.futex_word.val, - FUTEX_WAIT, WS_Waiting, 0, 0, 0); + LIBC_NAMESPACE::syscall_impl(FUTEX_SYSCALL_ID, &waiter.futex_word.val, + FUTEX_WAIT, WS_Waiting, 0, 0, 0); // At this point, if locking |m| fails, we can simply return as the // queued up waiter would have been removed from the queue. @@ -109,7 +109,7 @@ struct CndVar { qmtx.futex_word = FutexWordType(Mutex::LockState::Free); - __llvm_libc::syscall_impl( + LIBC_NAMESPACE::syscall_impl( FUTEX_SYSCALL_ID, &qmtx.futex_word.val, FUTEX_WAKE_OP, 1, 1, &first->futex_word.val, FUTEX_OP(FUTEX_OP_SET, WS_Signalled, FUTEX_OP_CMP_EQ, WS_Waiting)); @@ -126,7 +126,7 @@ struct CndVar { // atomically update the waiter status to WS_Signalled before waking // up the waiter. A dummy location is used for the other futex of // FUTEX_WAKE_OP. - __llvm_libc::syscall_impl( + LIBC_NAMESPACE::syscall_impl( FUTEX_SYSCALL_ID, &dummy_futex_word, FUTEX_WAKE_OP, 1, 1, &waiter->futex_word.val, FUTEX_OP(FUTEX_OP_SET, WS_Signalled, FUTEX_OP_CMP_EQ, WS_Waiting)); @@ -141,6 +141,6 @@ static_assert(sizeof(CndVar) == sizeof(cnd_t), "internal representation of condition variable and the public " "cnd_t type."); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_LINUX_CNDVAR_H diff --git a/libc/src/threads/linux/Futex.h b/libc/src/threads/linux/Futex.h index 53e2858d574722e590caa76a18bf9cde208dd2d9..4b426ac51ad17abc67e8bc92b706f48bdeed21f8 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 a3c0131ff78f184a63c2f3f73ba39cc915026fda..5cdd8ebfd190ea18e933fab5b1e40b75b38efd45 100644 --- a/libc/src/threads/linux/call_once.cpp +++ b/libc/src/threads/linux/call_once.cpp @@ -19,7 +19,7 @@ #include // For syscall numbers. #include // For call_once related type definition. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { static constexpr FutexWordType START = 0x11; static constexpr FutexWordType WAITING = 0x22; @@ -46,10 +46,10 @@ LLVM_LIBC_FUNCTION(void, call_once, func(); auto status = futex_word->exchange(FINISH); if (status == WAITING) { - __llvm_libc::syscall_impl(FUTEX_SYSCALL_ID, &futex_word->val, - FUTEX_WAKE_PRIVATE, - INT_MAX, // Wake all waiters. - 0, 0, 0); + LIBC_NAMESPACE::syscall_impl(FUTEX_SYSCALL_ID, &futex_word->val, + FUTEX_WAKE_PRIVATE, + INT_MAX, // Wake all waiters. + 0, 0, 0); } return; } @@ -57,11 +57,11 @@ LLVM_LIBC_FUNCTION(void, call_once, FutexWordType status = START; if (futex_word->compare_exchange_strong(status, WAITING) || status == WAITING) { - __llvm_libc::syscall_impl( + LIBC_NAMESPACE::syscall_impl( FUTEX_SYSCALL_ID, &futex_word->val, FUTEX_WAIT_PRIVATE, WAITING, // Block only if status is still |WAITING|. 0, 0, 0); } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/linux/cnd_broadcast.cpp b/libc/src/threads/linux/cnd_broadcast.cpp index 7b7c8f3b1cfd9cb7c71b9dafac0ba642377ca417..180ac6d68ee8641172dd075c8404998ea16f080f 100644 --- a/libc/src/threads/linux/cnd_broadcast.cpp +++ b/libc/src/threads/linux/cnd_broadcast.cpp @@ -11,11 +11,11 @@ #include "src/threads/cnd_broadcast.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, cnd_broadcast, (cnd_t * cond)) { CndVar *cndvar = reinterpret_cast(cond); return cndvar->broadcast(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/linux/cnd_destroy.cpp b/libc/src/threads/linux/cnd_destroy.cpp index 947c5be0bcd8ca45ee466ee62664a0a219024d7b..08eb3a1057b112e92fc39b52b1c36c148a9971d2 100644 --- a/libc/src/threads/linux/cnd_destroy.cpp +++ b/libc/src/threads/linux/cnd_destroy.cpp @@ -11,11 +11,11 @@ #include "src/threads/cnd_destroy.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, cnd_destroy, (cnd_t * cond)) { CndVar *cndvar = reinterpret_cast(cond); CndVar::destroy(cndvar); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/linux/cnd_init.cpp b/libc/src/threads/linux/cnd_init.cpp index 5e3156de93708def239989f9d0a677a1a7c69dfc..5e3f360b1d2b99949921e855327faf1a004118b0 100644 --- a/libc/src/threads/linux/cnd_init.cpp +++ b/libc/src/threads/linux/cnd_init.cpp @@ -11,11 +11,11 @@ #include "src/threads/cnd_init.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, cnd_init, (cnd_t * cond)) { CndVar *cndvar = reinterpret_cast(cond); return CndVar::init(cndvar); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/linux/cnd_signal.cpp b/libc/src/threads/linux/cnd_signal.cpp index 6099b13ed987f11eae3f066bf15d9567cc9c23cb..dba01abdefbc9428844706647953480d3080922c 100644 --- a/libc/src/threads/linux/cnd_signal.cpp +++ b/libc/src/threads/linux/cnd_signal.cpp @@ -11,11 +11,11 @@ #include "src/threads/cnd_signal.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, cnd_signal, (cnd_t * cond)) { CndVar *cndvar = reinterpret_cast(cond); return cndvar->notify_one(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/linux/cnd_wait.cpp b/libc/src/threads/linux/cnd_wait.cpp index 5c0aed7be76da038a1d9e10f86b90ab9229678d6..db3d7f1436eb76c8f60acf0a038a5e78f64c8714 100644 --- a/libc/src/threads/linux/cnd_wait.cpp +++ b/libc/src/threads/linux/cnd_wait.cpp @@ -12,7 +12,7 @@ #include "src/__support/threads/mutex.h" #include "src/threads/cnd_wait.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, cnd_wait, (cnd_t * cond, mtx_t *mtx)) { CndVar *cndvar = reinterpret_cast(cond); @@ -20,4 +20,4 @@ LLVM_LIBC_FUNCTION(int, cnd_wait, (cnd_t * cond, mtx_t *mtx)) { return cndvar->wait(mutex); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/mtx_destroy.cpp b/libc/src/threads/mtx_destroy.cpp index 64327003bfc585cca611b5313a1736807511cc54..5ee4777f5b2c2eb0da85d1f481eb4f1ac07b8b33 100644 --- a/libc/src/threads/mtx_destroy.cpp +++ b/libc/src/threads/mtx_destroy.cpp @@ -12,8 +12,8 @@ #include // For mtx_t definition. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, mtx_destroy, (mtx_t *)) {} -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/mtx_destroy.h b/libc/src/threads/mtx_destroy.h index 353bc27453bacb942f885a5468c873122810ea3b..1abf5d572f5dc95bb8dd7f2ca680db40632887d4 100644 --- a/libc/src/threads/mtx_destroy.h +++ b/libc/src/threads/mtx_destroy.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void mtx_destroy(mtx_t *mutex); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_MTX_DESTROY_H diff --git a/libc/src/threads/mtx_init.cpp b/libc/src/threads/mtx_init.cpp index 188209c9d3718428c8035c7fb10a9bb869d6dce7..74d08d33b116b9517a142bbfcc7ae9e747b1b5c9 100644 --- a/libc/src/threads/mtx_init.cpp +++ b/libc/src/threads/mtx_init.cpp @@ -12,7 +12,7 @@ #include // For mtx_t definition. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { static_assert(sizeof(Mutex) <= sizeof(mtx_t), "The public mtx_t type cannot accommodate the internal mutex " @@ -24,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, mtx_init, (mtx_t * m, int type)) { return err == MutexError::NONE ? thrd_success : thrd_error; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/mtx_init.h b/libc/src/threads/mtx_init.h index 8fcaa42a2307d165949733c498bba0ca36dc5158..69294d796666385228de72f6c43091288f489b5e 100644 --- a/libc/src/threads/mtx_init.h +++ b/libc/src/threads/mtx_init.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int mtx_init(mtx_t *mutex, int type); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_MTX_INIT_H diff --git a/libc/src/threads/mtx_lock.cpp b/libc/src/threads/mtx_lock.cpp index 58379f6f9d0fd984228a0345a45d55a224fb9abe..013a88a8e02b7a259c103f69c336f6c846b99ce2 100644 --- a/libc/src/threads/mtx_lock.cpp +++ b/libc/src/threads/mtx_lock.cpp @@ -12,7 +12,7 @@ #include // For mtx_t definition. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // The implementation currently handles only plain mutexes. LLVM_LIBC_FUNCTION(int, mtx_lock, (mtx_t * mutex)) { @@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(int, mtx_lock, (mtx_t * mutex)) { return err == MutexError::NONE ? thrd_success : thrd_error; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/mtx_lock.h b/libc/src/threads/mtx_lock.h index df3ec0dccbdb72aebc9951dcef89ff208403ef85..15c9e1a12545fbd9bc59c2c833bb313d87f6aa71 100644 --- a/libc/src/threads/mtx_lock.h +++ b/libc/src/threads/mtx_lock.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int mtx_lock(mtx_t *mutex); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_MTX_LOCK_H diff --git a/libc/src/threads/mtx_unlock.cpp b/libc/src/threads/mtx_unlock.cpp index f5c6a136d9dba1c20327d2cc570062142dcfa4e1..a72ee4427c5a9ed4a9083f7cf4b8e84247666e80 100644 --- a/libc/src/threads/mtx_unlock.cpp +++ b/libc/src/threads/mtx_unlock.cpp @@ -12,7 +12,7 @@ #include // For mtx_t definition. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // The implementation currently handles only plain mutexes. LLVM_LIBC_FUNCTION(int, mtx_unlock, (mtx_t * mutex)) { @@ -21,4 +21,4 @@ LLVM_LIBC_FUNCTION(int, mtx_unlock, (mtx_t * mutex)) { return err == MutexError::NONE ? thrd_success : thrd_error; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/mtx_unlock.h b/libc/src/threads/mtx_unlock.h index b58df6392265e4c8c164200c69de209e43b73a72..54fb034a04a21e3f6ac1a34e9c52c6c0722581bb 100644 --- a/libc/src/threads/mtx_unlock.h +++ b/libc/src/threads/mtx_unlock.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int mtx_unlock(mtx_t *mutex); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_MTX_UNLOCK_H diff --git a/libc/src/threads/thrd_create.cpp b/libc/src/threads/thrd_create.cpp index 8ec3cf1c3fcd9e089c9e574b37c6022e4f489c8b..06cba84eb8646a6890cd319959204ed00fae44cd 100644 --- a/libc/src/threads/thrd_create.cpp +++ b/libc/src/threads/thrd_create.cpp @@ -13,14 +13,14 @@ #include #include // For thrd_* type definitions. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -static_assert(sizeof(thrd_t) == sizeof(__llvm_libc::Thread), +static_assert(sizeof(thrd_t) == sizeof(LIBC_NAMESPACE::Thread), "Mismatch between thrd_t and internal Thread."); LLVM_LIBC_FUNCTION(int, thrd_create, (thrd_t * th, thrd_start_t func, void *arg)) { - auto *thread = reinterpret_cast<__llvm_libc::Thread *>(th); + auto *thread = reinterpret_cast(th); int result = thread->run(func, arg); if (result == 0) return thrd_success; @@ -30,4 +30,4 @@ LLVM_LIBC_FUNCTION(int, thrd_create, return thrd_error; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/thrd_create.h b/libc/src/threads/thrd_create.h index 9ed19c48c0a4e13f4501ed2675e955385bf4b662..0efa6f58c47eaf4a0cb09898a7542b022a329e01 100644 --- a/libc/src/threads/thrd_create.h +++ b/libc/src/threads/thrd_create.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int thrd_create(thrd_t *thread, thrd_start_t func, void *arg); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_THRD_CREATE_H diff --git a/libc/src/threads/thrd_current.cpp b/libc/src/threads/thrd_current.cpp index e8afd7bf6c49ab7855928130e2d75fc2f69fdcb0..b5ea0432aa52314d68aa6e6fb3ce599e8cd4f51f 100644 --- a/libc/src/threads/thrd_current.cpp +++ b/libc/src/threads/thrd_current.cpp @@ -12,9 +12,9 @@ #include // For thrd_* type definitions. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -static_assert(sizeof(thrd_t) == sizeof(__llvm_libc::Thread), +static_assert(sizeof(thrd_t) == sizeof(LIBC_NAMESPACE::Thread), "Mismatch between thrd_t and internal Thread."); LLVM_LIBC_FUNCTION(thrd_t, thrd_current, ()) { @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(thrd_t, thrd_current, ()) { return th; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/thrd_current.h b/libc/src/threads/thrd_current.h index 338a16dc56e9d4b870133882e027cbbfd4784b1d..2125729ccffebfa6aa8ad586025ab0dce20dff4e 100644 --- a/libc/src/threads/thrd_current.h +++ b/libc/src/threads/thrd_current.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { thrd_t thrd_current(); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_THRD_CURRENT_H diff --git a/libc/src/threads/thrd_detach.cpp b/libc/src/threads/thrd_detach.cpp index 20c6540faa17c91377d7902b7dec399719a328bc..17731c638bd5288e732d591764fd82915185e7f2 100644 --- a/libc/src/threads/thrd_detach.cpp +++ b/libc/src/threads/thrd_detach.cpp @@ -12,9 +12,9 @@ #include // For thrd_* type definitions. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -static_assert(sizeof(thrd_t) == sizeof(__llvm_libc::Thread), +static_assert(sizeof(thrd_t) == sizeof(LIBC_NAMESPACE::Thread), "Mismatch between thrd_t and internal Thread."); LLVM_LIBC_FUNCTION(int, thrd_detach, (thrd_t th)) { @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, thrd_detach, (thrd_t th)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/thrd_detach.h b/libc/src/threads/thrd_detach.h index 58d36e86380adf65e237bfdfa25980cfd0e697cc..64f2094acd65dbde5a7fb9e74d613691e7b8d4c0 100644 --- a/libc/src/threads/thrd_detach.h +++ b/libc/src/threads/thrd_detach.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int thrd_detach(thrd_t thread); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_THRD_DETACH_H diff --git a/libc/src/threads/thrd_equal.cpp b/libc/src/threads/thrd_equal.cpp index aac220ec9adb401e9bc68768305a5bfddc1f18f8..b9717cf121b04b70e8d49756819aec347804f1ef 100644 --- a/libc/src/threads/thrd_equal.cpp +++ b/libc/src/threads/thrd_equal.cpp @@ -12,9 +12,9 @@ #include // For thrd_* type definitions. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -static_assert(sizeof(thrd_t) == sizeof(__llvm_libc::Thread), +static_assert(sizeof(thrd_t) == sizeof(LIBC_NAMESPACE::Thread), "Mismatch between thrd_t and internal Thread."); LLVM_LIBC_FUNCTION(int, thrd_equal, (thrd_t lhs, thrd_t rhs)) { @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, thrd_equal, (thrd_t lhs, thrd_t rhs)) { return *lhs_internal == *rhs_internal; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/thrd_equal.h b/libc/src/threads/thrd_equal.h index 9e1bebc0afe5e6d8653a911ebe16245ccbecccb1..5878ea458ba41242f53ff222c1fb0349fda3a83b 100644 --- a/libc/src/threads/thrd_equal.h +++ b/libc/src/threads/thrd_equal.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int thrd_equal(thrd_t lhs, thrd_t rhs); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_THRD_EQUAL_H diff --git a/libc/src/threads/thrd_exit.cpp b/libc/src/threads/thrd_exit.cpp index 9935c23bba1ebab1cf5813634839252a14872ec5..67a7a419cf99a7df0883e37f674d0855429567ee 100644 --- a/libc/src/threads/thrd_exit.cpp +++ b/libc/src/threads/thrd_exit.cpp @@ -12,13 +12,13 @@ #include // For thrd_* type definitions. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -static_assert(sizeof(thrd_t) == sizeof(__llvm_libc::Thread), +static_assert(sizeof(thrd_t) == sizeof(LIBC_NAMESPACE::Thread), "Mismatch between thrd_t and internal Thread."); LLVM_LIBC_FUNCTION(void, thrd_exit, (int retval)) { thread_exit(ThreadReturnValue(retval), ThreadStyle::STDC); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/thrd_exit.h b/libc/src/threads/thrd_exit.h index 4cc835118a8523d20e6c0f01f0be01960d2f05e6..19eb027d0357ac83d78f01c9036291e8962b1826 100644 --- a/libc/src/threads/thrd_exit.h +++ b/libc/src/threads/thrd_exit.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void thrd_exit(int retval); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_THRD_EXIT_H diff --git a/libc/src/threads/thrd_join.cpp b/libc/src/threads/thrd_join.cpp index e4cf5522db92f7d01356143caaa1a64a7537ba55..cc8ba4b97a3a598a37d7b7abfc5429c1b652ac0c 100644 --- a/libc/src/threads/thrd_join.cpp +++ b/libc/src/threads/thrd_join.cpp @@ -12,9 +12,9 @@ #include // For thrd_* type definitions. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -static_assert(sizeof(thrd_t) == sizeof(__llvm_libc::Thread), +static_assert(sizeof(thrd_t) == sizeof(LIBC_NAMESPACE::Thread), "Mismatch between thrd_t and internal Thread."); LLVM_LIBC_FUNCTION(int, thrd_join, (thrd_t th, int *retval)) { @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, thrd_join, (thrd_t th, int *retval)) { return result == 0 ? thrd_success : thrd_error; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/thrd_join.h b/libc/src/threads/thrd_join.h index d86529c8cb9759d8bb15fba7e970030ac61edc60..21a398c6e8352b108d0f4e40a6d9f926f3227c84 100644 --- a/libc/src/threads/thrd_join.h +++ b/libc/src/threads/thrd_join.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int thrd_join(thrd_t thread, int *retval); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_THRD_JOIN_H diff --git a/libc/src/threads/tss_create.cpp b/libc/src/threads/tss_create.cpp index f384565fbb9d16b30ab1f7997fa71147beb3fd70..ddea44dce301ddc94edeafad86d360fcf2ea43fc 100644 --- a/libc/src/threads/tss_create.cpp +++ b/libc/src/threads/tss_create.cpp @@ -13,14 +13,14 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, tss_create, (tss_t * key, tss_dtor_t dtor)) { - auto k = __llvm_libc::new_tss_key(dtor); + auto k = LIBC_NAMESPACE::new_tss_key(dtor); if (!k) return thrd_error; *key = *k; return thrd_success; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/tss_create.h b/libc/src/threads/tss_create.h index 967bdca10c4fe18f9e0ff8842b3da4c41047e061..def903e29e06e456f64f751892244d3d00feaf8f 100644 --- a/libc/src/threads/tss_create.h +++ b/libc/src/threads/tss_create.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int tss_create(tss_t *key, tss_dtor_t dtor); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_TSS_CREATE_H diff --git a/libc/src/threads/tss_delete.cpp b/libc/src/threads/tss_delete.cpp index 6bdd4aa91867e860a213d039123906199a99854a..a2a4e9aa349bab21404a44823a0cd1531ef60b23 100644 --- a/libc/src/threads/tss_delete.cpp +++ b/libc/src/threads/tss_delete.cpp @@ -13,10 +13,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void, tss_delete, (tss_t key)) { - __llvm_libc::tss_key_delete(key); + LIBC_NAMESPACE::tss_key_delete(key); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/tss_delete.h b/libc/src/threads/tss_delete.h index 1f55d3ba69f59563f206a301acc47496902d4a62..3efc0d745dd14f011983708caff0a7ea05ca96e8 100644 --- a/libc/src/threads/tss_delete.h +++ b/libc/src/threads/tss_delete.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void tss_delete(tss_t key); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_TSS_DELETE_H diff --git a/libc/src/threads/tss_get.cpp b/libc/src/threads/tss_get.cpp index 4596a9337ffcce1d625ebdcc1013dd225f62fa2b..9b8c94fbeba284667921060dd42a3b08f4f80b2d 100644 --- a/libc/src/threads/tss_get.cpp +++ b/libc/src/threads/tss_get.cpp @@ -13,8 +13,8 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(void *, tss_get, (tss_t key)) { return get_tss_value(key); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/tss_get.h b/libc/src/threads/tss_get.h index 4cedce988333fd0b6752ac5f708cee1e66e9a486..dfdb79cf122b6d767d09c562e7cb7a8d447b383f 100644 --- a/libc/src/threads/tss_get.h +++ b/libc/src/threads/tss_get.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void *tss_get(tss_t); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_TSS_GET_H diff --git a/libc/src/threads/tss_set.cpp b/libc/src/threads/tss_set.cpp index 977168a2a98cfd2a80ab515c1e2e2874ec73cff7..640896d14e1c7bae6595e814b79dbdd9792cb100 100644 --- a/libc/src/threads/tss_set.cpp +++ b/libc/src/threads/tss_set.cpp @@ -13,7 +13,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, tss_set, (tss_t key, void *data)) { if (set_tss_value(key, data)) @@ -22,4 +22,4 @@ LLVM_LIBC_FUNCTION(int, tss_set, (tss_t key, void *data)) { return thrd_error; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/threads/tss_set.h b/libc/src/threads/tss_set.h index 49d69efa62ade334b61f2f26cd5fbbf215fb9133..249607fdc700eba440b0337e6e94c77e349ad275 100644 --- a/libc/src/threads/tss_set.h +++ b/libc/src/threads/tss_set.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int tss_set(tss_t, void *); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_THREADS_TSS_SET_H diff --git a/libc/src/time/asctime.cpp b/libc/src/time/asctime.cpp index 3ccfb042e14498fef4130147f40b99b7c743e5f6..9958903d043cf6438efbba5f7c99c90dcbd1bd36 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 f053ad23eb4e3a27531c758dbf2991affff2f8a6..941cd70250e362b8419770adb9fbd96190973938 100644 --- a/libc/src/time/asctime.h +++ b/libc/src/time/asctime.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { char *asctime(const struct tm *timeptr); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TIME_ASCTIME_H diff --git a/libc/src/time/asctime_r.cpp b/libc/src/time/asctime_r.cpp index f957dac3668364b9d1024837964fbe6e346447ba..19a21241829ffde44dd455c443a513fe5f861a12 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 21bba7ebaa3f54de160fee8d706444670f6faeaf..04d3c01ddd2b76845d057dd73e86e1961f8171cb 100644 --- a/libc/src/time/asctime_r.h +++ b/libc/src/time/asctime_r.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { char *asctime_r(const struct tm *timeptr, char *buffer); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TIME_ASCTIME_R_H diff --git a/libc/src/time/clock.h b/libc/src/time/clock.h index 7a259e6f4b89558ed95149516292afd217100f53..d4af7656644a016d0ba146885b79400c49e70dca 100644 --- a/libc/src/time/clock.h +++ b/libc/src/time/clock.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { clock_t clock(); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TIME_CLOCK_H diff --git a/libc/src/time/clock_gettime.h b/libc/src/time/clock_gettime.h index a131251bac973ce48207ea11002547e0b4b8ab52..72e2e1949feb69f2661f8fc327f875e5f7ceb4f2 100644 --- a/libc/src/time/clock_gettime.h +++ b/libc/src/time/clock_gettime.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int clock_gettime(clockid_t clockid, struct timespec *tp); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TIME_CLOCK_GETTIME_H diff --git a/libc/src/time/difftime.cpp b/libc/src/time/difftime.cpp index 7b4526783f70709e0a598ac9a6ffc474a52769fa..95aa1be7abee11c1205f53d0fbb639b98d557051 100644 --- a/libc/src/time/difftime.cpp +++ b/libc/src/time/difftime.cpp @@ -9,10 +9,10 @@ #include "src/time/difftime.h" #include "src/__support/common.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(double, difftime, (time_t end, time_t beginning)) { return static_cast(end - beginning); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/time/difftime.h b/libc/src/time/difftime.h index 249dfed4fe819fb86aa81b195a0597f9602c4313..6498b8b943c22fa7636648ea673fc008af859f18 100644 --- a/libc/src/time/difftime.h +++ b/libc/src/time/difftime.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { double difftime(time_t end, time_t beginning); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TIME_DIFFTIME_H diff --git a/libc/src/time/gettimeofday.h b/libc/src/time/gettimeofday.h index ee08efba8381bbb27af27debf117d40076fab444..880b94cee7311b8da10db947202f9f8c449b9089 100644 --- a/libc/src/time/gettimeofday.h +++ b/libc/src/time/gettimeofday.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int gettimeofday(struct timeval *tv, void *tz); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TIME_GETTIMEOFDAY_H diff --git a/libc/src/time/gmtime.cpp b/libc/src/time/gmtime.cpp index 75ce85941b184f40388ddb8f49bcd7cf84744ca8..8597f2201c4ec9347c16b163c0a8426f581bd4f9 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 950ba4f5673ab57f27aa72f660d66cfa9b4c3f93..d361eb27febfa044d4791918b54e4b41934446ac 100644 --- a/libc/src/time/gmtime.h +++ b/libc/src/time/gmtime.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { struct tm *gmtime(const time_t *timer); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TIME_GMTIME_H diff --git a/libc/src/time/gmtime_r.cpp b/libc/src/time/gmtime_r.cpp index 67bf12696e2eeb8fb0ec4d7462745f1f659565e9..15a0c0687158f3be82ccca8cb14c1169d54a9368 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 619af603c98dbf2c156f3e23d8d1993d04cf971d..f7aac287ecc36a7add5a29f09489d3f3e2bc70e0 100644 --- a/libc/src/time/gmtime_r.h +++ b/libc/src/time/gmtime_r.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { struct tm *gmtime_r(const time_t *timer, struct tm *result); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TIME_GMTIME_R_H diff --git a/libc/src/time/gpu/clock.cpp b/libc/src/time/gpu/clock.cpp index 146addd24a7fc882eb1a264e3c97ea8620c33af2..86cc97e2a3bfb005efae2191b89f5f2d63af86d3 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 52cfecbab9be8dc7084f3c2434f8eef9472416b1..a0c735502ff58924bb20ab433fd666637c311b12 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 ef5e72f208116bbf0edecfc31dcb0d9df607e09e..935a5394e5fdbe0e293338a60a5cb32ed86be343 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 da9cd3eebe7ebb9c70076ea29595ac53d8e886af..075fcb61768ec7e818855353a41fe2f6740bbe1f 100644 --- a/libc/src/time/gpu/time_utils.h +++ b/libc/src/time/gpu/time_utils.h @@ -11,7 +11,7 @@ #include "src/__support/GPU/utils.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { #if defined(LIBC_TARGET_ARCH_IS_AMDGPU) // AMDGPU does not have a single set frequency. Different architectures and @@ -39,8 +39,8 @@ constexpr uint64_t clock_freq = 0; // We provide an externally visible symbol such that the runtime can set this to // the correct value. If it is not set we try to default to the known values. extern "C" [[gnu::visibility("protected")]] uint64_t - [[clang::address_space(4)]] __llvm_libc_clock_freq; -#define GPU_CLOCKS_PER_SEC static_cast(__llvm_libc_clock_freq) + [[clang::address_space(4)]] LIBC_NAMESPACE_clock_freq; +#define GPU_CLOCKS_PER_SEC static_cast(LIBC_NAMESPACE_clock_freq) #elif defined(LIBC_TARGET_ARCH_IS_NVPTX) // NPVTX uses a single 1 GHz fixed frequency clock for all target architectures. @@ -49,6 +49,6 @@ extern "C" [[gnu::visibility("protected")]] uint64_t #error "Unsupported target" #endif -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TIME_GPU_TIME_UTILS_H diff --git a/libc/src/time/linux/clock.cpp b/libc/src/time/linux/clock.cpp index cf27f5c2995712a97b08c9da47b1bbc939aba620..1e95f0526bc9c4a49da2096ece1be5bb97ef7c47 100644 --- a/libc/src/time/linux/clock.cpp +++ b/libc/src/time/linux/clock.cpp @@ -17,7 +17,7 @@ #include // For syscall numbers. #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(clock_t, clock, ()) { struct timespec ts; @@ -45,4 +45,4 @@ LLVM_LIBC_FUNCTION(clock_t, clock, ()) { ts.tv_nsec / (1000000000 / CLOCKS_PER_SEC)); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/time/linux/clockGetTimeImpl.h b/libc/src/time/linux/clockGetTimeImpl.h index e519ebcdddbdb9eae4a5583c1925fda850a95ef7..8c8c9fcf845cc7eed09c259f55fd7ec158baf0df 100644 --- a/libc/src/time/linux/clockGetTimeImpl.h +++ b/libc/src/time/linux/clockGetTimeImpl.h @@ -18,22 +18,22 @@ #include // For syscall numbers. #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace internal { LIBC_INLINE ErrorOr clock_gettimeimpl(clockid_t clockid, struct timespec *ts) { #if SYS_clock_gettime - int ret = __llvm_libc::syscall_impl(SYS_clock_gettime, - static_cast(clockid), - reinterpret_cast(ts)); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_clock_gettime, + static_cast(clockid), + reinterpret_cast(ts)); #elif defined(SYS_clock_gettime64) static_assert( sizeof(time_t) == sizeof(int64_t), "SYS_clock_gettime64 requires struct timespec with 64-bit members."); - int ret = __llvm_libc::syscall_impl(SYS_clock_gettime64, - static_cast(clockid), - reinterpret_cast(ts)); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_clock_gettime64, + static_cast(clockid), + reinterpret_cast(ts)); #else #error "SYS_clock_gettime and SYS_clock_gettime64 syscalls not available." #endif @@ -43,6 +43,6 @@ LIBC_INLINE ErrorOr clock_gettimeimpl(clockid_t clockid, } } // namespace internal -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TIME_LINUX_CLOCKGETTIMEIMPL_H diff --git a/libc/src/time/linux/clock_gettime.cpp b/libc/src/time/linux/clock_gettime.cpp index 33ec04eb352743ed8d41bd11fdce7c6273423343..47e974a866c832287340069f0124eb96b358eb9e 100644 --- a/libc/src/time/linux/clock_gettime.cpp +++ b/libc/src/time/linux/clock_gettime.cpp @@ -16,7 +16,7 @@ #include // For syscall numbers. #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO(michaelrj): Move this into time/linux with the other syscalls. LLVM_LIBC_FUNCTION(int, clock_gettime, @@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(int, clock_gettime, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/time/linux/gettimeofday.cpp b/libc/src/time/linux/gettimeofday.cpp index 2df6429974164a91ae89601001fe5c1afc8aa28b..07ab4d579176eddf04579bc26b489a3be7903021 100644 --- a/libc/src/time/linux/gettimeofday.cpp +++ b/libc/src/time/linux/gettimeofday.cpp @@ -15,7 +15,7 @@ #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // TODO(michaelrj): Move this into time/linux with the other syscalls. LLVM_LIBC_FUNCTION(int, gettimeofday, @@ -38,4 +38,4 @@ LLVM_LIBC_FUNCTION(int, gettimeofday, return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/time/linux/nanosleep.cpp b/libc/src/time/linux/nanosleep.cpp index 8c76dac75a176ad52d5e1ec3e4b44688f06e8fc9..bcfe567191f25f3ff25b9670ea393fd579dd2094 100644 --- a/libc/src/time/linux/nanosleep.cpp +++ b/libc/src/time/linux/nanosleep.cpp @@ -15,18 +15,18 @@ #include // For int64_t. #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, nanosleep, (const struct timespec *req, struct timespec *rem)) { #if SYS_nanosleep - int ret = __llvm_libc::syscall_impl(SYS_nanosleep, req, rem); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_nanosleep, req, rem); #elif defined(SYS_clock_nanosleep_time64) static_assert( sizeof(time_t) == sizeof(int64_t), "SYS_clock_gettime64 requires struct timespec with 64-bit members."); - int ret = __llvm_libc::syscall_impl(SYS_clock_nanosleep_time64, - CLOCK_REALTIME, 0, req, rem); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_clock_nanosleep_time64, + CLOCK_REALTIME, 0, req, rem); #else #error "SYS_nanosleep and SYS_clock_nanosleep_time64 syscalls not available." #endif @@ -38,4 +38,4 @@ LLVM_LIBC_FUNCTION(int, nanosleep, return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/time/linux/time.cpp b/libc/src/time/linux/time.cpp index 4dbcabc8963510ac2e48cd2b257c801e676f38e7..e286fae095b2aeef1606ccb284590dac847111db 100644 --- a/libc/src/time/linux/time.cpp +++ b/libc/src/time/linux/time.cpp @@ -16,7 +16,7 @@ #include // For syscall numbers. #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(time_t, time, (time_t * tp)) { // TODO: Use the Linux VDSO to fetch the time and avoid the syscall. @@ -32,4 +32,4 @@ LLVM_LIBC_FUNCTION(time_t, time, (time_t * tp)) { return time_t(ts.tv_sec); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/time/mktime.cpp b/libc/src/time/mktime.cpp index 3b3ea339f850f96849936c1625d9baa0df716a06..e57565f0d1fe016c15f1f96b217d9e8399ec3031 100644 --- a/libc/src/time/mktime.cpp +++ b/libc/src/time/mktime.cpp @@ -12,9 +12,9 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -using __llvm_libc::time_utils::TimeConstants; +using LIBC_NAMESPACE::time_utils::TimeConstants; static constexpr int NON_LEAP_YEAR_DAYS_IN_MONTH[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; @@ -114,4 +114,4 @@ LLVM_LIBC_FUNCTION(time_t, mktime, (struct tm * tm_out)) { return static_cast(seconds); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/time/mktime.h b/libc/src/time/mktime.h index efe9cf44565a4c1b63661aa85dabee8cbf4215d2..a50e97c52321b345c6ad3e8799cee9474e715ee0 100644 --- a/libc/src/time/mktime.h +++ b/libc/src/time/mktime.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { time_t mktime(struct tm *t1); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TIME_MKTIME_H diff --git a/libc/src/time/nanosleep.h b/libc/src/time/nanosleep.h index d8ecfb758f93c72ee78573e997b258cc46211a6e..757394232c079050fdcf3ed9fe05a8600c3e72bc 100644 --- a/libc/src/time/nanosleep.h +++ b/libc/src/time/nanosleep.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int nanosleep(const struct timespec *req, struct timespec *rem); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TIME_NANOSLEEP_H diff --git a/libc/src/time/time_func.h b/libc/src/time/time_func.h index a24834c50b62502eff5bf6780e8e28175afa00b2..beb02020b5759599991b9ec5827597bf24b79f5b 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 fadd26f97dfc2282c0e22297c77728d153435621..199a74cb168a2c3bdbbc728005d91f2b638d7077 100644 --- a/libc/src/time/time_utils.cpp +++ b/libc/src/time/time_utils.cpp @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace time_utils { -using __llvm_libc::time_utils::TimeConstants; +using LIBC_NAMESPACE::time_utils::TimeConstants; static int64_t computeRemainingYears(int64_t daysPerYears, int64_t quotientYears, @@ -151,4 +151,4 @@ int64_t update_from_seconds(int64_t total_seconds, struct tm *tm) { } } // namespace time_utils -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/time/time_utils.h b/libc/src/time/time_utils.h index 424e7521504d917e12d3d523f302eb752befbdb6..a5da3ad74f34339246974779edb5ddeea24b1b93 100644 --- a/libc/src/time/time_utils.h +++ b/libc/src/time/time_utils.h @@ -17,7 +17,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace time_utils { enum Month : int { @@ -151,6 +151,6 @@ LIBC_INLINE struct tm *gmtime_internal(const time_t *timer, struct tm *result) { } } // namespace time_utils -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_TIME_TIME_UTILS_H diff --git a/libc/src/unistd/access.h b/libc/src/unistd/access.h index 2454e805731f97d1ced70dc9c1b8b0f61779ba3c..7623c853091fd0549f7d4196ed1be25471e5c3df 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 228b78fc799249b2faea59e521fe03cdaff2fc83..ca1dd356b7cfe21fe085aa90c35cb07644c6f90f 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 56fce1172a16581a80d6540ed8614385b73e1207..02e01c24120a0b91ecd64c6d0bc0e5af31abdd70 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 21b358251ea918f4d6cdb4dfa068d0115c3768a3..d6daa5a9ad74d5907ead68848b7f1b1052470874 100644 --- a/libc/src/unistd/dup.h +++ b/libc/src/unistd/dup.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int dup(int fd); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_DUP_H diff --git a/libc/src/unistd/dup2.h b/libc/src/unistd/dup2.h index 39e4da8c19fbbe1e62ff950c242dcbd17b37f36f..ba8c5f4b16010369cc45198c3034dd5f98558f5c 100644 --- a/libc/src/unistd/dup2.h +++ b/libc/src/unistd/dup2.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int dup2(int oldfd, int newfd); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_DUP2_H diff --git a/libc/src/unistd/dup3.h b/libc/src/unistd/dup3.h index c7e107071b7dac98dcb6916373cab68170776706..2b1082403daff78c27e60aa6e60f37b6bfa2d24e 100644 --- a/libc/src/unistd/dup3.h +++ b/libc/src/unistd/dup3.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int dup3(int oldfd, int newfd, int flags); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_DUP3_H diff --git a/libc/src/unistd/environ.cpp b/libc/src/unistd/environ.cpp index 2a554fd9fcb4c7107bdd0b66744a690d2209b59a..2266c7203273dba3afa643d67ce166eefb482c78 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 eb808411ac1875fd660e3ace158abdcf008adedb..c09a04f99f883004a1d4a574ba5da9f7ca59e92a 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 f26a5831781c46519040cfe46c66700becab9175..7ff366464b4c8d1594711689422a82b7197462c6 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 48ac78d9b575dbd10296baac6e6aebafb5d509b9..0054a47d4ddd703c2f50f0e8078d4857f55e8170 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 3d402e62f40665e77b6c65e78753a6628319504d..267785c919f55590a8a3026fb2ae1a206bbf45a1 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 8d591dd8667c5c90b28bf49fae56fb846142a7cc..6b1b72a7dfc089351849c77398ea410ddd7132ff 100644 --- a/libc/src/unistd/fork.h +++ b/libc/src/unistd/fork.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { pid_t fork(); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_FORK_H diff --git a/libc/src/unistd/fsync.h b/libc/src/unistd/fsync.h index 12e5d740b1885b469265782b0d044d8a437e6334..b5742de359d94d86ac60df724bedc2bb36011fda 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 1971dc53af2d73ef5d6046ae6264ce1bc5a1eba7..5508ef0718e94233d524695c8e15dd31ae6968b6 100644 --- a/libc/src/unistd/ftruncate.h +++ b/libc/src/unistd/ftruncate.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int ftruncate(int, off_t); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_FTRUNCATE_H diff --git a/libc/src/unistd/getcwd.h b/libc/src/unistd/getcwd.h index 8a6947f09a12465e1cf7a2804d78679b722bae89..ab7038e453276c8b25f62b5d326ff7973db809d6 100644 --- a/libc/src/unistd/getcwd.h +++ b/libc/src/unistd/getcwd.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { char *getcwd(char *buf, size_t size); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_GETCWD_H diff --git a/libc/src/unistd/geteuid.h b/libc/src/unistd/geteuid.h index 0df98fbee955330144411f0aba95c8accaf7b15d..f19cbaefd5792a67500629a72da478ca32742121 100644 --- a/libc/src/unistd/geteuid.h +++ b/libc/src/unistd/geteuid.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { uid_t geteuid(); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_GETEUID_H diff --git a/libc/src/unistd/getopt.cpp b/libc/src/unistd/getopt.cpp index d063a43202136a8a2c5c6216992e99abbb02a9e0..ccdfdc6c64666f73e688001a1b1e80bb984bd028 100644 --- a/libc/src/unistd/getopt.cpp +++ b/libc/src/unistd/getopt.cpp @@ -19,7 +19,7 @@ // just the re-ordering of argv elements such that unknown arguments can be // easily iterated over. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { template struct RefWrapper { RefWrapper() = delete; @@ -45,8 +45,9 @@ struct GetoptContext { template void report_error(const char *fmt, Ts... ts) { if (opterr) - __llvm_libc::fprintf( - errstream ? errstream : reinterpret_cast(__llvm_libc::stderr), + LIBC_NAMESPACE::fprintf( + errstream ? errstream + : reinterpret_cast(LIBC_NAMESPACE::stderr), fmt, ts...); } }; @@ -201,4 +202,4 @@ LLVM_LIBC_FUNCTION(int, getopt, return getopt_r(argc, argv, optstring, impl::ctx); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/getopt.h b/libc/src/unistd/getopt.h index 0bc7ed6a1b1934fd71dd1cc0ef39afd64a0482f4..ae27958756f44ac85eca2da0d1346795d4cc5608 100644 --- a/libc/src/unistd/getopt.h +++ b/libc/src/unistd/getopt.h @@ -12,7 +12,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace impl { void set_getopt_state(char **, int *, int *, unsigned *, int *, FILE *); @@ -20,6 +20,6 @@ void set_getopt_state(char **, int *, int *, unsigned *, int *, FILE *); int getopt(int argc, char *const argv[], const char *optstring); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_GETOPT_H diff --git a/libc/src/unistd/getpid.h b/libc/src/unistd/getpid.h index 7b6b9b1600ccd7c52edcd7d926680500b70523c8..5890dbf63681a9e381ea6fb5da7e133ba95a3b5a 100644 --- a/libc/src/unistd/getpid.h +++ b/libc/src/unistd/getpid.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { pid_t getpid(); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_GETPID_H diff --git a/libc/src/unistd/getppid.h b/libc/src/unistd/getppid.h index c5744778b5f9787a2ee9567f1369d0a897b9bb4e..a09c7ca2241872ad4cf76324f1e62da4b002f935 100644 --- a/libc/src/unistd/getppid.h +++ b/libc/src/unistd/getppid.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { pid_t getppid(); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_GETPPID_H diff --git a/libc/src/unistd/getuid.h b/libc/src/unistd/getuid.h index e3501ca04bf99417d6fc85768be61bb980c02bd5..35163783518c7da3aa97f6c8e9b733994ac8cbbb 100644 --- a/libc/src/unistd/getuid.h +++ b/libc/src/unistd/getuid.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { uid_t getuid(); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_GETUID_H diff --git a/libc/src/unistd/isatty.h b/libc/src/unistd/isatty.h index cffee57e0f2eca4b91d5f5e127966c1ceb831cd5..90a169730fe0425e8e66b13955644a8832253856 100644 --- a/libc/src/unistd/isatty.h +++ b/libc/src/unistd/isatty.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int isatty(int fd); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_ISATTY_H diff --git a/libc/src/unistd/link.h b/libc/src/unistd/link.h index 492274286e0449fb51f662999315ab1318f1a017..a95111f3a7f96971b955a9047f9788ba98984b7f 100644 --- a/libc/src/unistd/link.h +++ b/libc/src/unistd/link.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int link(const char *, const char *); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_LINK_H diff --git a/libc/src/unistd/linkat.h b/libc/src/unistd/linkat.h index 7bc161952a8663a598649ec23c13c28d9c8b0f00..c53b87e5d11947b29a2f1350316bfc0633526453 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 195a1c2c78d531d5cd4d44c2293dea7f9a30c3e5..f062ad43e75ff2d4e8dc9030c8dd33e15d6d5e80 100644 --- a/libc/src/unistd/linux/access.cpp +++ b/libc/src/unistd/linux/access.cpp @@ -15,14 +15,14 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, access, (const char *path, int mode)) { #ifdef SYS_access - int ret = __llvm_libc::syscall_impl(SYS_access, path, mode); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_access, path, mode); #elif defined(SYS_faccessat) int ret = - __llvm_libc::syscall_impl(SYS_faccessat, AT_FDCWD, path, mode, 0); + LIBC_NAMESPACE::syscall_impl(SYS_faccessat, AT_FDCWD, path, mode, 0); #else #error "access and faccessat syscalls not available." #endif @@ -34,4 +34,4 @@ LLVM_LIBC_FUNCTION(int, access, (const char *path, int mode)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/chdir.cpp b/libc/src/unistd/linux/chdir.cpp index b3078d1e9d2fd2cb24934cb33a3167693ba7d1ac..61d44ff1c8088e3836d07dbc50b299bec0fcaa9b 100644 --- a/libc/src/unistd/linux/chdir.cpp +++ b/libc/src/unistd/linux/chdir.cpp @@ -14,10 +14,10 @@ #include "src/errno/libc_errno.h" #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, chdir, (const char *path)) { - int ret = __llvm_libc::syscall_impl(SYS_chdir, path); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_chdir, path); if (ret < 0) { libc_errno = -ret; return -1; @@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, chdir, (const char *path)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/close.cpp b/libc/src/unistd/linux/close.cpp index 49cac104db48fd7663c1dcf8ce6c42cffe3cac08..084334861abdc7f354261a0826de40725e2b0872 100644 --- a/libc/src/unistd/linux/close.cpp +++ b/libc/src/unistd/linux/close.cpp @@ -14,10 +14,10 @@ #include "src/errno/libc_errno.h" #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, close, (int fd)) { - int ret = __llvm_libc::syscall_impl(SYS_close, fd); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_close, fd); if (ret < 0) { libc_errno = -ret; return -1; @@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, close, (int fd)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/dup.cpp b/libc/src/unistd/linux/dup.cpp index 423d1db5a35e8bdb9cce9da82ca5db837c88958e..a2e7d3fdec4295b1e4461fbb1a2b52ee6fcba9f6 100644 --- a/libc/src/unistd/linux/dup.cpp +++ b/libc/src/unistd/linux/dup.cpp @@ -14,10 +14,10 @@ #include "src/errno/libc_errno.h" #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, dup, (int fd)) { - int ret = __llvm_libc::syscall_impl(SYS_dup, fd); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_dup, fd); if (ret < 0) { libc_errno = -ret; return -1; @@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, dup, (int fd)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/dup2.cpp b/libc/src/unistd/linux/dup2.cpp index 4a537feef2cb929c1d0b4cb14c972256b1564f2d..f6804e2deca5c4f25760727f255c8c9919bf8d70 100644 --- a/libc/src/unistd/linux/dup2.cpp +++ b/libc/src/unistd/linux/dup2.cpp @@ -15,12 +15,12 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, dup2, (int oldfd, int newfd)) { #ifdef SYS_dup2 // If dup2 syscall is available, we make use of directly. - int ret = __llvm_libc::syscall_impl(SYS_dup2, oldfd, newfd); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_dup2, oldfd, newfd); #elif defined(SYS_dup3) // If dup2 syscall is not available, we try using the dup3 syscall. However, // dup3 fails if oldfd is the same as newfd. So, we handle that case @@ -28,11 +28,11 @@ LLVM_LIBC_FUNCTION(int, dup2, (int oldfd, int newfd)) { if (oldfd == newfd) { // Check if oldfd is actually a valid file descriptor. #if SYS_fcntl - int ret = __llvm_libc::syscall_impl(SYS_fcntl, oldfd, F_GETFD); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_fcntl, oldfd, F_GETFD); #elif defined(SYS_fcntl64) // Same as fcntl but can handle large offsets static_assert(sizeof(off_t) == 8); - int ret = __llvm_libc::syscall_impl(SYS_fcntl64, oldfd, F_GETFD); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_fcntl64, oldfd, F_GETFD); #else #error "SYS_fcntl and SYS_fcntl64 syscalls not available." #endif @@ -41,7 +41,7 @@ LLVM_LIBC_FUNCTION(int, dup2, (int oldfd, int newfd)) { libc_errno = -ret; return -1; } - int ret = __llvm_libc::syscall_impl(SYS_dup3, oldfd, newfd, 0); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_dup3, oldfd, newfd, 0); #else #error "dup2 and dup3 syscalls not available." #endif @@ -52,4 +52,4 @@ LLVM_LIBC_FUNCTION(int, dup2, (int oldfd, int newfd)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/dup3.cpp b/libc/src/unistd/linux/dup3.cpp index bb0d18c499fae84d6d8440f339229ca2173fc86e..bf2c25728ca6a9ad3dbeeba0a12ffcc0269a32e6 100644 --- a/libc/src/unistd/linux/dup3.cpp +++ b/libc/src/unistd/linux/dup3.cpp @@ -14,15 +14,15 @@ #include "src/errno/libc_errno.h" #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, dup3, (int oldfd, int newfd, int flags)) { // If dup2 syscall is available, we make use of directly. - int ret = __llvm_libc::syscall_impl(SYS_dup3, oldfd, newfd, flags); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_dup3, oldfd, newfd, flags); if (ret >= 0) return ret; libc_errno = -ret; return -1; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/execv.cpp b/libc/src/unistd/linux/execv.cpp index c57ee8ef49f057b0276c6326f7d91bd5852fa574..bd134ca523c774fe2e822ffb71a372741ecd3adc 100644 --- a/libc/src/unistd/linux/execv.cpp +++ b/libc/src/unistd/linux/execv.cpp @@ -15,11 +15,11 @@ #include "src/errno/libc_errno.h" #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, execv, (const char *path, char *const argv[])) { - int ret = __llvm_libc::syscall_impl(SYS_execve, path, argv, - __llvm_libc::environ); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_execve, path, argv, + LIBC_NAMESPACE::environ); if (ret < 0) { libc_errno = -ret; return -1; @@ -30,4 +30,4 @@ LLVM_LIBC_FUNCTION(int, execv, (const char *path, char *const argv[])) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/execve.cpp b/libc/src/unistd/linux/execve.cpp index 5eb875d7019642cef224223bbb95c3d090cfcabb..b6de0a400c4401ada82a7b6dc8096bcfa41cdca1 100644 --- a/libc/src/unistd/linux/execve.cpp +++ b/libc/src/unistd/linux/execve.cpp @@ -15,11 +15,11 @@ #include "src/errno/libc_errno.h" #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, execve, (const char *path, char *const argv[], char *const envp[])) { - int ret = __llvm_libc::syscall_impl(SYS_execve, path, argv, envp); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_execve, path, argv, envp); if (ret < 0) { libc_errno = -ret; return -1; @@ -30,4 +30,4 @@ LLVM_LIBC_FUNCTION(int, execve, return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/fchdir.cpp b/libc/src/unistd/linux/fchdir.cpp index 4bfca8df58eff3a5a7de3a4c50a0985fd6abc237..d24b9badfe44816e464eb5f450ee1d4e0d5c1580 100644 --- a/libc/src/unistd/linux/fchdir.cpp +++ b/libc/src/unistd/linux/fchdir.cpp @@ -14,10 +14,10 @@ #include "src/errno/libc_errno.h" #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fchdir, (int fd)) { - int ret = __llvm_libc::syscall_impl(SYS_fchdir, fd); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_fchdir, fd); if (ret < 0) { libc_errno = -ret; return -1; @@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, fchdir, (int fd)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/fork.cpp b/libc/src/unistd/linux/fork.cpp index 0cc37e7aaaf848e35bf3304ae6120100956b8a12..6fa2b990b19a93d9c4c08620d19767c63703f078 100644 --- a/libc/src/unistd/linux/fork.cpp +++ b/libc/src/unistd/linux/fork.cpp @@ -17,7 +17,7 @@ #include // For SIGCHLD #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // The implementation of fork here is very minimal. We will add more // functionality and standard compliance in future. @@ -25,9 +25,9 @@ namespace __llvm_libc { LLVM_LIBC_FUNCTION(pid_t, fork, (void)) { invoke_prepare_callbacks(); #ifdef SYS_fork - pid_t ret = __llvm_libc::syscall_impl(SYS_fork); + pid_t ret = LIBC_NAMESPACE::syscall_impl(SYS_fork); #elif defined(SYS_clone) - pid_t ret = __llvm_libc::syscall_impl(SYS_clone, SIGCHLD, 0); + pid_t ret = LIBC_NAMESPACE::syscall_impl(SYS_clone, SIGCHLD, 0); #else #error "fork and clone syscalls not available." #endif @@ -36,7 +36,7 @@ LLVM_LIBC_FUNCTION(pid_t, fork, (void)) { // The child is created with a single thread whose self object will be a // copy of parent process' thread which called fork. So, we have to fix up // the child process' self object with the new process' tid. - self.attrib->tid = __llvm_libc::syscall_impl(SYS_gettid); + self.attrib->tid = LIBC_NAMESPACE::syscall_impl(SYS_gettid); invoke_child_callbacks(); return 0; } @@ -51,4 +51,4 @@ LLVM_LIBC_FUNCTION(pid_t, fork, (void)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/fsync.cpp b/libc/src/unistd/linux/fsync.cpp index 199378f82184b899c294615dbc4ad09ee16bd91b..44d504ec459e3cc548618494ef7b75adb3ca9e4d 100644 --- a/libc/src/unistd/linux/fsync.cpp +++ b/libc/src/unistd/linux/fsync.cpp @@ -14,10 +14,10 @@ #include "src/errno/libc_errno.h" #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, fsync, (int fd)) { - int ret = __llvm_libc::syscall_impl(SYS_fsync, fd); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_fsync, fd); if (ret < 0) { libc_errno = -ret; return -1; @@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(int, fsync, (int fd)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/ftruncate.cpp b/libc/src/unistd/linux/ftruncate.cpp index aebdfb60ffe4907826f1bf3806ad8dda0ffca6e7..795bb98ceae0cc8337a6e8f8f5ca86208843c3ba 100644 --- a/libc/src/unistd/linux/ftruncate.cpp +++ b/libc/src/unistd/linux/ftruncate.cpp @@ -16,16 +16,16 @@ #include // For syscall numbers. #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, ftruncate, (int fd, off_t len)) { #ifdef SYS_ftruncate - int ret = __llvm_libc::syscall_impl(SYS_ftruncate, fd, len); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_ftruncate, fd, len); #elif defined(SYS_ftruncate64) // Same as ftruncate but can handle large offsets static_assert(sizeof(off_t) == 8); - int ret = __llvm_libc::syscall_impl(SYS_ftruncate64, fd, (long)len, - (long)(((uint64_t)(len)) >> 32)); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_ftruncate64, fd, (long)len, + (long)(((uint64_t)(len)) >> 32)); #else #error "ftruncate and ftruncate64 syscalls not available." #endif @@ -37,4 +37,4 @@ LLVM_LIBC_FUNCTION(int, ftruncate, (int fd, off_t len)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/getcwd.cpp b/libc/src/unistd/linux/getcwd.cpp index 3a25ea990150fb1ac8831f95910c956e108bb8d3..11c58f1585564d912b8043e3b4ec3cd588542bb8 100644 --- a/libc/src/unistd/linux/getcwd.cpp +++ b/libc/src/unistd/linux/getcwd.cpp @@ -17,12 +17,12 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace { bool getcwd_syscall(char *buf, size_t size) { - int ret = __llvm_libc::syscall_impl(SYS_getcwd, buf, size); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_getcwd, buf, size); if (ret < 0) { libc_errno = -ret; return false; @@ -63,4 +63,4 @@ LLVM_LIBC_FUNCTION(char *, getcwd, (char *buf, size_t size)) { return buf; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/geteuid.cpp b/libc/src/unistd/linux/geteuid.cpp index ac1d07b9b8d46fa358b796a5b9414e2daf3082e2..2a7f163fb8cd473e47204f943fb81ca76e19ea07 100644 --- a/libc/src/unistd/linux/geteuid.cpp +++ b/libc/src/unistd/linux/geteuid.cpp @@ -13,10 +13,10 @@ #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(uid_t, geteuid, ()) { - return __llvm_libc::syscall_impl(SYS_geteuid); + return LIBC_NAMESPACE::syscall_impl(SYS_geteuid); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/getpid.cpp b/libc/src/unistd/linux/getpid.cpp index ae763d821e15188192a1c36fce8a5908ef648f6a..85730738ca2ef6343727e7f0b4a7bbfdb7fd8c25 100644 --- a/libc/src/unistd/linux/getpid.cpp +++ b/libc/src/unistd/linux/getpid.cpp @@ -13,10 +13,10 @@ #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(pid_t, getpid, ()) { - return __llvm_libc::syscall_impl(SYS_getpid); + return LIBC_NAMESPACE::syscall_impl(SYS_getpid); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/getppid.cpp b/libc/src/unistd/linux/getppid.cpp index e722c36a17c36ad5cf2c329645c006c0540542c3..7ee11f32fd0083842f42018c4c4f864b59d849a4 100644 --- a/libc/src/unistd/linux/getppid.cpp +++ b/libc/src/unistd/linux/getppid.cpp @@ -13,10 +13,10 @@ #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(pid_t, getppid, ()) { - return __llvm_libc::syscall_impl(SYS_getppid); + return LIBC_NAMESPACE::syscall_impl(SYS_getppid); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/getuid.cpp b/libc/src/unistd/linux/getuid.cpp index f214ffd15fda51b8e26c83f67871745c3e52bb31..c8131803c84aa6962fa24b95448147dd789a92a4 100644 --- a/libc/src/unistd/linux/getuid.cpp +++ b/libc/src/unistd/linux/getuid.cpp @@ -13,10 +13,10 @@ #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(uid_t, getuid, ()) { - return __llvm_libc::syscall_impl(SYS_getuid); + return LIBC_NAMESPACE::syscall_impl(SYS_getuid); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/isatty.cpp b/libc/src/unistd/linux/isatty.cpp index d81ae5aab22c0c72761a17be7c11cdc2762cbedf..205013897525b33d8496b998ca200f1b5f74d26b 100644 --- a/libc/src/unistd/linux/isatty.cpp +++ b/libc/src/unistd/linux/isatty.cpp @@ -15,7 +15,7 @@ #include // For ioctl numbers. #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, isatty, (int fd)) { constexpr int INIT_VAL = 0x1234abcd; @@ -23,7 +23,7 @@ LLVM_LIBC_FUNCTION(int, isatty, (int fd)) { // This gets the line dicipline of the terminal. When called on something that // isn't a terminal it doesn't change line_d_val and returns -1. int result = - __llvm_libc::syscall_impl(SYS_ioctl, fd, TIOCGETD, &line_d_val); + LIBC_NAMESPACE::syscall_impl(SYS_ioctl, fd, TIOCGETD, &line_d_val); if (result == 0) return 1; @@ -31,4 +31,4 @@ LLVM_LIBC_FUNCTION(int, isatty, (int fd)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/link.cpp b/libc/src/unistd/linux/link.cpp index 385756b8ea9ebe7ba9de81e62e07f1a31e162667..b5024ad7a59fb76eb9d7abcdaa7bde7a7501fe01 100644 --- a/libc/src/unistd/linux/link.cpp +++ b/libc/src/unistd/linux/link.cpp @@ -15,14 +15,14 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, link, (const char *path1, const char *path2)) { #ifdef SYS_link - int ret = __llvm_libc::syscall_impl(SYS_link, path1, path2); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_link, path1, path2); #elif defined(SYS_linkat) - int ret = __llvm_libc::syscall_impl(SYS_linkat, AT_FDCWD, path1, - AT_FDCWD, path2, 0); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_linkat, AT_FDCWD, path1, + AT_FDCWD, path2, 0); #else #error "link or linkat syscalls not available." #endif @@ -33,4 +33,4 @@ LLVM_LIBC_FUNCTION(int, link, (const char *path1, const char *path2)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/linkat.cpp b/libc/src/unistd/linux/linkat.cpp index ec1c2b45b2edc8f245c5109389212fa7e01c3dd6..c5d071ee83e010ef936322def8b797868eb5a7b6 100644 --- a/libc/src/unistd/linux/linkat.cpp +++ b/libc/src/unistd/linux/linkat.cpp @@ -15,13 +15,13 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, linkat, (int fd1, const char *path1, int fd2, const char *path2, int flags)) { - int ret = - __llvm_libc::syscall_impl(SYS_linkat, fd1, path1, fd2, path2, flags); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_linkat, fd1, path1, fd2, + path2, flags); if (ret < 0) { libc_errno = -ret; return -1; @@ -29,4 +29,4 @@ LLVM_LIBC_FUNCTION(int, linkat, return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/lseek.cpp b/libc/src/unistd/linux/lseek.cpp index 3ab0084269e2db96b0cd03af0de743e597977286..6f3d9937db245ef31bf01376837bdc7f4a2d9707 100644 --- a/libc/src/unistd/linux/lseek.cpp +++ b/libc/src/unistd/linux/lseek.cpp @@ -16,7 +16,7 @@ #include // For syscall numbers. #include // For off_t. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(off_t, lseek, (int fd, off_t offset, int whence)) { auto result = internal::lseekimpl(fd, offset, whence); @@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(off_t, lseek, (int fd, off_t offset, int whence)) { return result.value(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/pread.cpp b/libc/src/unistd/linux/pread.cpp index 8605925f120722aeb4f8b507b66d023a991eef6f..614de9732c6271a941f9766bf6a0b72c695a9fc2 100644 --- a/libc/src/unistd/linux/pread.cpp +++ b/libc/src/unistd/linux/pread.cpp @@ -15,18 +15,18 @@ #include // For uint64_t. #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(ssize_t, pread, (int fd, void *buf, size_t count, off_t offset)) { #ifdef LIBC_TARGET_ARCH_IS_RISCV32 static_assert(sizeof(off_t) == 8); - ssize_t ret = __llvm_libc::syscall_impl( + ssize_t ret = LIBC_NAMESPACE::syscall_impl( SYS_pread64, fd, buf, count, (long)offset, (long)(((uint64_t)(offset)) >> 32)); #else - ssize_t ret = - __llvm_libc::syscall_impl(SYS_pread64, fd, buf, count, offset); + ssize_t ret = LIBC_NAMESPACE::syscall_impl(SYS_pread64, fd, buf, + count, offset); #endif if (ret < 0) { libc_errno = static_cast(-ret); @@ -35,4 +35,4 @@ LLVM_LIBC_FUNCTION(ssize_t, pread, return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/pwrite.cpp b/libc/src/unistd/linux/pwrite.cpp index b4ea52a958ba2d47850e3f62818da04e6dc38348..6c6a0b555ac13357d1bc615bbd74f0fa2e8ebedd 100644 --- a/libc/src/unistd/linux/pwrite.cpp +++ b/libc/src/unistd/linux/pwrite.cpp @@ -15,18 +15,18 @@ #include // For uint64_t. #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(ssize_t, pwrite, (int fd, const void *buf, size_t count, off_t offset)) { #ifdef LIBC_TARGET_ARCH_IS_RISCV32 static_assert(sizeof(off_t) == 8); - ssize_t ret = __llvm_libc::syscall_impl( + ssize_t ret = LIBC_NAMESPACE::syscall_impl( SYS_pwrite64, fd, buf, count, (long)offset, (long)(((uint64_t)(offset)) >> 32)); #else - ssize_t ret = - __llvm_libc::syscall_impl(SYS_pwrite64, fd, buf, count, offset); + ssize_t ret = LIBC_NAMESPACE::syscall_impl(SYS_pwrite64, fd, buf, + count, offset); #endif if (ret < 0) { libc_errno = static_cast(-ret); @@ -35,4 +35,4 @@ LLVM_LIBC_FUNCTION(ssize_t, pwrite, return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/read.cpp b/libc/src/unistd/linux/read.cpp index 6dbff2dee91768f34da221faba14e6cc3bdaed41..691a236982e3750b9d045b34f1a44ad0c68162be 100644 --- a/libc/src/unistd/linux/read.cpp +++ b/libc/src/unistd/linux/read.cpp @@ -14,10 +14,10 @@ #include "src/errno/libc_errno.h" #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(ssize_t, read, (int fd, void *buf, size_t count)) { - ssize_t ret = __llvm_libc::syscall_impl(SYS_read, fd, buf, count); + ssize_t ret = LIBC_NAMESPACE::syscall_impl(SYS_read, fd, buf, count); if (ret < 0) { libc_errno = static_cast(-ret); return -1; @@ -25,4 +25,4 @@ LLVM_LIBC_FUNCTION(ssize_t, read, (int fd, void *buf, size_t count)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/readlink.cpp b/libc/src/unistd/linux/readlink.cpp index 7989b11f5d28c0deeca3b21ae25cdf817093943d..8dee58c8f215f3c532138d59ae331059914c7385 100644 --- a/libc/src/unistd/linux/readlink.cpp +++ b/libc/src/unistd/linux/readlink.cpp @@ -15,17 +15,17 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(ssize_t, readlink, (const char *__restrict path, char *__restrict buf, size_t bufsize)) { #ifdef SYS_readlink ssize_t ret = - __llvm_libc::syscall_impl(SYS_readlink, path, buf, bufsize); + LIBC_NAMESPACE::syscall_impl(SYS_readlink, path, buf, bufsize); #elif defined(SYS_readlinkat) - ssize_t ret = __llvm_libc::syscall_impl(SYS_readlinkat, AT_FDCWD, - path, buf, bufsize); + ssize_t ret = LIBC_NAMESPACE::syscall_impl(SYS_readlinkat, AT_FDCWD, + path, buf, bufsize); #else #error "readlink or readlinkat syscalls not available." #endif @@ -36,4 +36,4 @@ LLVM_LIBC_FUNCTION(ssize_t, readlink, return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/readlinkat.cpp b/libc/src/unistd/linux/readlinkat.cpp index 094853fe85ec0f423030824eb4564c8567ec9b18..479735d4f4d3d343624c773b030d944d71b60a58 100644 --- a/libc/src/unistd/linux/readlinkat.cpp +++ b/libc/src/unistd/linux/readlinkat.cpp @@ -15,13 +15,13 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(ssize_t, readlinkat, (int fd, const char *__restrict path, char *__restrict buf, size_t bufsize)) { - ssize_t ret = __llvm_libc::syscall_impl(SYS_readlinkat, fd, path, - buf, bufsize); + ssize_t ret = LIBC_NAMESPACE::syscall_impl(SYS_readlinkat, fd, path, + buf, bufsize); if (ret < 0) { libc_errno = static_cast(-ret); return -1; @@ -29,4 +29,4 @@ LLVM_LIBC_FUNCTION(ssize_t, readlinkat, return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/rmdir.cpp b/libc/src/unistd/linux/rmdir.cpp index 70f7206aad563946120295167a5ee23cb48ed5ce..234b0c3a09408bec1c5efe4d5c85cc55729dc17b 100644 --- a/libc/src/unistd/linux/rmdir.cpp +++ b/libc/src/unistd/linux/rmdir.cpp @@ -15,14 +15,14 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, rmdir, (const char *path)) { #ifdef SYS_rmdir - int ret = __llvm_libc::syscall_impl(SYS_rmdir, path); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_rmdir, path); #elif defined(SYS_unlinkat) - int ret = __llvm_libc::syscall_impl(SYS_unlinkat, AT_FDCWD, path, - AT_REMOVEDIR); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_unlinkat, AT_FDCWD, path, + AT_REMOVEDIR); #else #error "rmdir and unlinkat syscalls not available." #endif @@ -34,4 +34,4 @@ LLVM_LIBC_FUNCTION(int, rmdir, (const char *path)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/symlink.cpp b/libc/src/unistd/linux/symlink.cpp index a9b7de8acf37324a66c87746da6acc4123a021f8..e8983e252b8e360c305b4577eae65d37cc4ff57f 100644 --- a/libc/src/unistd/linux/symlink.cpp +++ b/libc/src/unistd/linux/symlink.cpp @@ -15,14 +15,14 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, symlink, (const char *path1, const char *path2)) { #ifdef SYS_symlink - int ret = __llvm_libc::syscall_impl(SYS_symlink, path1, path2); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_symlink, path1, path2); #elif defined(SYS_symlinkat) int ret = - __llvm_libc::syscall_impl(SYS_symlinkat, path1, AT_FDCWD, path2); + LIBC_NAMESPACE::syscall_impl(SYS_symlinkat, path1, AT_FDCWD, path2); #else #error "symlink or symlinkat syscalls not available." #endif @@ -33,4 +33,4 @@ LLVM_LIBC_FUNCTION(int, symlink, (const char *path1, const char *path2)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/symlinkat.cpp b/libc/src/unistd/linux/symlinkat.cpp index f5debb8cd0c20dd3dd3915acbfff9332ecae6bb0..64f02d13f9a0c195fa4793a47d24ff71e52046a8 100644 --- a/libc/src/unistd/linux/symlinkat.cpp +++ b/libc/src/unistd/linux/symlinkat.cpp @@ -15,11 +15,11 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, symlinkat, (const char *path1, int fd, const char *path2)) { - int ret = __llvm_libc::syscall_impl(SYS_symlinkat, path1, fd, path2); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_symlinkat, path1, fd, path2); if (ret < 0) { libc_errno = -ret; return -1; @@ -27,4 +27,4 @@ LLVM_LIBC_FUNCTION(int, symlinkat, return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/syscall.cpp b/libc/src/unistd/linux/syscall.cpp index 5c61c6d064a6bd7dd75a60a2ae23b729aecd6649..e1b13c9c143fa413c881aa969c35e1ee5e2a8811 100644 --- a/libc/src/unistd/linux/syscall.cpp +++ b/libc/src/unistd/linux/syscall.cpp @@ -14,13 +14,13 @@ #include "src/errno/libc_errno.h" #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -LLVM_LIBC_FUNCTION(long, __llvm_libc_syscall, +LLVM_LIBC_FUNCTION(long, LIBC_NAMESPACE_syscall, (long number, long arg1, long arg2, long arg3, long arg4, long arg5, long arg6)) { - long ret = __llvm_libc::syscall_impl(number, arg1, arg2, arg3, arg4, - arg5, arg6); + long ret = LIBC_NAMESPACE::syscall_impl(number, arg1, arg2, arg3, arg4, + arg5, arg6); // Syscalls may return large positive values that overflow, but will never // return values between -4096 and -1 if (static_cast(ret) > -4096UL) { @@ -30,4 +30,4 @@ LLVM_LIBC_FUNCTION(long, __llvm_libc_syscall, return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/sysconf.cpp b/libc/src/unistd/linux/sysconf.cpp index 2816cb447c12841f8ad5df5333412ec7ce0fdd6d..b16e15551fc7889e077a91403ee87a21720f0ec1 100644 --- a/libc/src/unistd/linux/sysconf.cpp +++ b/libc/src/unistd/linux/sysconf.cpp @@ -14,7 +14,7 @@ #include // For EXEC_PAGESIZE. #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(long, sysconf, (int name)) { long ret = 0; @@ -30,4 +30,4 @@ LLVM_LIBC_FUNCTION(long, sysconf, (int name)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/truncate.cpp b/libc/src/unistd/linux/truncate.cpp index 7be355edfd48f475ce76d8d205070df889462baa..0120cc738a92165e07e24c05d0cd1c0b072177da 100644 --- a/libc/src/unistd/linux/truncate.cpp +++ b/libc/src/unistd/linux/truncate.cpp @@ -16,16 +16,16 @@ #include // For syscall numbers. #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, truncate, (const char *path, off_t len)) { #ifdef SYS_truncate - int ret = __llvm_libc::syscall_impl(SYS_truncate, path, len); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_truncate, path, len); #elif defined(SYS_truncate64) // Same as truncate but can handle large offsets static_assert(sizeof(off_t) == 8); - int ret = __llvm_libc::syscall_impl(SYS_truncate64, path, (long)len, - (long)(((uint64_t)(len)) >> 32)); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_truncate64, path, (long)len, + (long)(((uint64_t)(len)) >> 32)); #else #error "truncate and truncate64 syscalls not available." #endif @@ -36,4 +36,4 @@ LLVM_LIBC_FUNCTION(int, truncate, (const char *path, off_t len)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/unlink.cpp b/libc/src/unistd/linux/unlink.cpp index d4bbdea8e970b32373bdc8210a1b61db134877b8..e62fb8faa67af2aba526fce5a370288021416648 100644 --- a/libc/src/unistd/linux/unlink.cpp +++ b/libc/src/unistd/linux/unlink.cpp @@ -15,13 +15,13 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, unlink, (const char *path)) { #ifdef SYS_unlink - int ret = __llvm_libc::syscall_impl(SYS_unlink, path); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_unlink, path); #elif defined(SYS_unlinkat) - int ret = __llvm_libc::syscall_impl(SYS_unlinkat, AT_FDCWD, path, 0); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_unlinkat, AT_FDCWD, path, 0); #else #error "unlink and unlinkat syscalls not available." #endif @@ -33,4 +33,4 @@ LLVM_LIBC_FUNCTION(int, unlink, (const char *path)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/unlinkat.cpp b/libc/src/unistd/linux/unlinkat.cpp index eb4af39729f37687e166ec8b3b8a168f677d1cab..4ec5e38cb405cd0d342b0625237b6e19fabda82e 100644 --- a/libc/src/unistd/linux/unlinkat.cpp +++ b/libc/src/unistd/linux/unlinkat.cpp @@ -15,11 +15,11 @@ #include #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, unlinkat, (int dfd, const char *path, int flags)) { #ifdef SYS_unlinkat - int ret = __llvm_libc::syscall_impl(SYS_unlinkat, dfd, path, flags); + int ret = LIBC_NAMESPACE::syscall_impl(SYS_unlinkat, dfd, path, flags); #else #error "unlinkat syscalls not available." #endif @@ -31,4 +31,4 @@ LLVM_LIBC_FUNCTION(int, unlinkat, (int dfd, const char *path, int flags)) { return 0; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/linux/write.cpp b/libc/src/unistd/linux/write.cpp index 4884ccf1ed3332462012381fa573959f303fd96e..bd6c9114f7877512f647c61c4ad1e537bfc2a776 100644 --- a/libc/src/unistd/linux/write.cpp +++ b/libc/src/unistd/linux/write.cpp @@ -14,10 +14,11 @@ #include // For syscall numbers. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(ssize_t, write, (int fd, const void *buf, size_t count)) { - ssize_t ret = __llvm_libc::syscall_impl(SYS_write, fd, buf, count); + ssize_t ret = + LIBC_NAMESPACE::syscall_impl(SYS_write, fd, buf, count); if (ret < 0) { libc_errno = static_cast(-ret); return -1; @@ -25,4 +26,4 @@ LLVM_LIBC_FUNCTION(ssize_t, write, (int fd, const void *buf, size_t count)) { return ret; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/unistd/lseek.h b/libc/src/unistd/lseek.h index 28252e4d4917192766d613d50d27c750522f7447..75e33d8a6987d1989839c927d9477d79c2d976a8 100644 --- a/libc/src/unistd/lseek.h +++ b/libc/src/unistd/lseek.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { off_t lseek(int fd, off_t offset, int whence); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_LSEEK_H diff --git a/libc/src/unistd/pread.h b/libc/src/unistd/pread.h index 5ddf32eae4f81373221b003d6e68a7c6410cabdb..6ecfef4c82c602e3adcd2976427217ea1bd4c308 100644 --- a/libc/src/unistd/pread.h +++ b/libc/src/unistd/pread.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { ssize_t pread(int fd, void *buf, size_t count, off_t offset); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_PREAD_H diff --git a/libc/src/unistd/pwrite.h b/libc/src/unistd/pwrite.h index 4286314abee0ce30f7b7bf4969c4145f9f5e2c25..535c9217c23531b4864caf4c84fc1fe9a32f4a60 100644 --- a/libc/src/unistd/pwrite.h +++ b/libc/src/unistd/pwrite.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_PWRITE_H diff --git a/libc/src/unistd/read.h b/libc/src/unistd/read.h index 62602c82a906ac69cec7076626802e70b194d850..05a56a2fdeaebb97507e4c2dd050e1155c0a0854 100644 --- a/libc/src/unistd/read.h +++ b/libc/src/unistd/read.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { ssize_t read(int fd, void *buf, size_t count); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_READ_H diff --git a/libc/src/unistd/readlink.h b/libc/src/unistd/readlink.h index ba246bf91b8a8b14cd6a94f665fddbf9b848f6eb..c93c430988c79c5657e70aae6e175231d95d1505 100644 --- a/libc/src/unistd/readlink.h +++ b/libc/src/unistd/readlink.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { ssize_t readlink(const char *__restrict, char *__restrict, size_t); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_READLINK_H diff --git a/libc/src/unistd/readlinkat.h b/libc/src/unistd/readlinkat.h index 54346ee1132cb8220bd8052cbbdd9d121890eb1b..a4357efec1a1b124c05f8c121fbe620a3c93824c 100644 --- a/libc/src/unistd/readlinkat.h +++ b/libc/src/unistd/readlinkat.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { ssize_t readlinkat(int, const char *__restrict, char *__restrict, size_t); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_READLINKAT_H diff --git a/libc/src/unistd/rmdir.h b/libc/src/unistd/rmdir.h index 5fe7fac23af7860feff971365427a15e2e52eed3..55dcbafe1f7df7220da545306174e2d46615dc3b 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 44166a623ff42fd28749f7cff5431f2aaa0cf00a..5c2f5074ff978006edc9391bcfd7aaac13ee4d79 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 e5e02e1333147883c760fb4dd6b33dac73681419..0a6aa49540b5b7dd57a55653c8ad4cf5c7c27a99 100644 --- a/libc/src/unistd/swab.h +++ b/libc/src/unistd/swab.h @@ -11,10 +11,10 @@ #include // For ssize_t -namespace __llvm_libc { +namespace LIBC_NAMESPACE { void swab(const void *__restrict from, void *__restrict to, ssize_t n); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_SWAB_H diff --git a/libc/src/unistd/symlink.h b/libc/src/unistd/symlink.h index a495db8238bc0d6942da8e10da64c1303c6f2983..0a0124ccbc7ab75a6417020104b60efe17132ff3 100644 --- a/libc/src/unistd/symlink.h +++ b/libc/src/unistd/symlink.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int symlink(const char *, const char *); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_SYMLINK_H diff --git a/libc/src/unistd/symlinkat.h b/libc/src/unistd/symlinkat.h index ff77f0a52f6d0f0a5d37439769ec3fa1011ab7c1..ecca4380e98eb13c136157646bd13cd106328d54 100644 --- a/libc/src/unistd/symlinkat.h +++ b/libc/src/unistd/symlinkat.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int symlinkat(const char *, int, const char *); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_SYMLINKAT_H diff --git a/libc/src/unistd/syscall.h b/libc/src/unistd/syscall.h index 81ff64ebcf5a13ef3a23f96455ebbbf6e814db0a..255459cadb8b7148d29ed56b51f15bb92fcdfcbb 100644 --- a/libc/src/unistd/syscall.h +++ b/libc/src/unistd/syscall.h @@ -12,11 +12,11 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { -long __llvm_libc_syscall(long number, long arg1, long arg2, long arg3, - long arg4, long arg5, long arg6); +long LIBC_NAMESPACE_syscall(long number, long arg1, long arg2, long arg3, + long arg4, long arg5, long arg6); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_SYSCALL_H diff --git a/libc/src/unistd/sysconf.h b/libc/src/unistd/sysconf.h index b704edb4ada1fa0b6c43b7bc129f48232dfed9e4..89c5efa5746364326c0f4d9169fe827c8f2d0bdf 100644 --- a/libc/src/unistd/sysconf.h +++ b/libc/src/unistd/sysconf.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { long sysconf(int name); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_SYSCONF_H diff --git a/libc/src/unistd/truncate.h b/libc/src/unistd/truncate.h index a6ef92146008cc06dc0dd07c0f3b7cf9f8254fae..5245b6bf2ed028f59ac280ccbf0846fc6a160360 100644 --- a/libc/src/unistd/truncate.h +++ b/libc/src/unistd/truncate.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int truncate(const char *, off_t); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_TRUNCATE_H diff --git a/libc/src/unistd/unlink.h b/libc/src/unistd/unlink.h index 1119bfad7dbc533510e9e9993c7744472475f98c..d1d34fa1a8ac5c7f5cae700db87c656018f73074 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 b32d7b537851d3a040c7c70b2839d2ec627d18ac..81d23bdf5cec368c593d727bf56e55d6587da456 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 821dc49050ec5c7a902bd1110037acc8e0ada9f6..52cdff348085f598eb148dd9fab841de964dce42 100644 --- a/libc/src/unistd/write.h +++ b/libc/src/unistd/write.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { ssize_t write(int fd, const void *buf, size_t count); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_UNISTD_WRITE_H diff --git a/libc/src/wchar/btowc.cpp b/libc/src/wchar/btowc.cpp index 6db888c1aa09cd3a2f988e90a512779b3520bd84..040c60eb805c72ebddf07b33fcbbe3d4418a26b9 100644 --- a/libc/src/wchar/btowc.cpp +++ b/libc/src/wchar/btowc.cpp @@ -12,7 +12,7 @@ #include // for EOF. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, btowc, (wint_t c)) { auto result = internal::btowc(c); @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, btowc, (wint_t c)) { } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/wchar/btowc.h b/libc/src/wchar/btowc.h index ab37738e8c67cb38563889b6db549a5bf2ee70b1..de67f157b5729a5ab7ee14d9322bbf3c5f3259ad 100644 --- a/libc/src/wchar/btowc.h +++ b/libc/src/wchar/btowc.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { wint_t btowc(int c); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_WCHAR_BTOWC_H diff --git a/libc/src/wchar/wctob.cpp b/libc/src/wchar/wctob.cpp index 274818a37773aed382bf3deaa5e836be68901a28..538d5388e50581878994c15fa7102982b67c3465 100644 --- a/libc/src/wchar/wctob.cpp +++ b/libc/src/wchar/wctob.cpp @@ -12,7 +12,7 @@ #include // for EOF. -namespace __llvm_libc { +namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, wctob, (wint_t c)) { auto result = internal::wctob(c); @@ -23,4 +23,4 @@ LLVM_LIBC_FUNCTION(int, wctob, (wint_t c)) { } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/src/wchar/wctob.h b/libc/src/wchar/wctob.h index 5c0f229436d62569cf1d58daa7e6029b53f4db81..1cc0c211e98a5240e14d5fd202d0612053463730 100644 --- a/libc/src/wchar/wctob.h +++ b/libc/src/wchar/wctob.h @@ -11,10 +11,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int wctob(wint_t c); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_SRC_WCHAR_WCTOB_H diff --git a/libc/startup/gpu/amdgpu/start.cpp b/libc/startup/gpu/amdgpu/start.cpp index e6304ab243b8ff711671337409ade5f7273ccee0..9e642dbe3fc7d3019bd007ac4021b4527e63fd18 100644 --- a/libc/startup/gpu/amdgpu/start.cpp +++ b/libc/startup/gpu/amdgpu/start.cpp @@ -13,13 +13,13 @@ extern "C" int main(int argc, char **argv, char **envp); -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // The AMDGPU architecture provides a fixed frequency clock used for obtaining // real time. However, the frequency of this clock varies between cards and can // only be obtained via the driver. The loader will set this so we can use it. extern "C" [[gnu::visibility("protected")]] uint64_t - [[clang::address_space(4)]] __llvm_libc_clock_freq = 0; + [[clang::address_space(4)]] LIBC_NAMESPACE_clock_freq = 0; extern "C" uintptr_t __init_array_start[]; extern "C" uintptr_t __init_array_end[]; @@ -41,7 +41,7 @@ static void call_fini_array_callbacks() { reinterpret_cast(__fini_array_start[i])(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE extern "C" [[gnu::visibility("protected"), clang::amdgpu_kernel]] void _begin(int argc, char **argv, char **env) { @@ -49,8 +49,8 @@ _begin(int argc, char **argv, char **env) { // callbacks are run. So, we register them before running the init // array callbacks as they can potentially register their own atexit // callbacks. - __llvm_libc::atexit(&__llvm_libc::call_fini_array_callbacks); - __llvm_libc::call_init_array_callbacks(argc, argv, env); + LIBC_NAMESPACE::atexit(&LIBC_NAMESPACE::call_fini_array_callbacks); + LIBC_NAMESPACE::call_init_array_callbacks(argc, argv, env); } extern "C" [[gnu::visibility("protected"), clang::amdgpu_kernel]] void @@ -65,5 +65,5 @@ _end(int retval) { // Only a single thread should call `exit` here, the rest should gracefully // return from the kernel. This is so only one thread calls the destructors // registred with 'atexit' above. - __llvm_libc::exit(retval); + LIBC_NAMESPACE::exit(retval); } diff --git a/libc/startup/gpu/nvptx/start.cpp b/libc/startup/gpu/nvptx/start.cpp index d5d3ad2f15cac2e9079ad5ea8ab83ad26c10f30d..1ff187a577789f14a77bdb0d51b2e1ac2b8b1ef3 100644 --- a/libc/startup/gpu/nvptx/start.cpp +++ b/libc/startup/gpu/nvptx/start.cpp @@ -13,7 +13,7 @@ extern "C" int main(int argc, char **argv, char **envp); -namespace __llvm_libc { +namespace LIBC_NAMESPACE { extern "C" { // Nvidia's 'nvlink' linker does not provide these symbols. We instead need @@ -39,7 +39,7 @@ static void call_fini_array_callbacks() { reinterpret_cast(__fini_array_start[i])(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE extern "C" [[gnu::visibility("protected"), clang::nvptx_kernel]] void _begin(int argc, char **argv, char **env) { @@ -47,8 +47,8 @@ _begin(int argc, char **argv, char **env) { // callbacks are run. So, we register them before running the init // array callbacks as they can potentially register their own atexit // callbacks. - __llvm_libc::atexit(&__llvm_libc::call_fini_array_callbacks); - __llvm_libc::call_init_array_callbacks(argc, argv, env); + LIBC_NAMESPACE::atexit(&LIBC_NAMESPACE::call_fini_array_callbacks); + LIBC_NAMESPACE::call_init_array_callbacks(argc, argv, env); } extern "C" [[gnu::visibility("protected"), clang::nvptx_kernel]] void @@ -62,5 +62,5 @@ extern "C" [[gnu::visibility("protected"), clang::nvptx_kernel]] void _end(int retval) { // To finis the execution we invoke all the callbacks registered via 'atexit' // and then exit with the appropriate return value. - __llvm_libc::exit(retval); + LIBC_NAMESPACE::exit(retval); } diff --git a/libc/startup/linux/aarch64/start.cpp b/libc/startup/linux/aarch64/start.cpp index 7b94ae64c4ced9027b2b2f9da1534035f147fbc3..002af5313cc82dd5247b9e750ef36f4339bb97d1 100644 --- a/libc/startup/linux/aarch64/start.cpp +++ b/libc/startup/linux/aarch64/start.cpp @@ -27,7 +27,7 @@ extern "C" int main(int, char **, char **); // Source documentation: // https://github.com/ARM-software/abi-aa/tree/main/sysvabi64 -namespace __llvm_libc { +namespace LIBC_NAMESPACE { #ifdef SYS_mmap2 static constexpr long MMAP_SYSCALL_NUMBER = SYS_mmap2; @@ -69,18 +69,18 @@ void init_tls(TLSDescriptor &tls_descriptor) { // We cannot call the mmap function here as the functions set errno on // failure. Since errno is implemented via a thread local variable, we cannot // use errno before TLS is setup. - long mmap_ret_val = __llvm_libc::syscall_impl( + long mmap_ret_val = LIBC_NAMESPACE::syscall_impl( MMAP_SYSCALL_NUMBER, nullptr, alloc_size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); // We cannot check the return value with MAP_FAILED as that is the return // of the mmap function and not the mmap syscall. if (mmap_ret_val < 0 && static_cast(mmap_ret_val) > -app.pageSize) - __llvm_libc::syscall_impl(SYS_exit, 1); + LIBC_NAMESPACE::syscall_impl(SYS_exit, 1); uintptr_t thread_ptr = uintptr_t(reinterpret_cast(mmap_ret_val)); uintptr_t tls_addr = thread_ptr + size_of_pointers + padding; - __llvm_libc::inline_memcpy(reinterpret_cast(tls_addr), - reinterpret_cast(app.tls.address), - app.tls.init_size); + LIBC_NAMESPACE::inline_memcpy(reinterpret_cast(tls_addr), + reinterpret_cast(app.tls.address), + app.tls.init_size); tls_descriptor.size = alloc_size; tls_descriptor.addr = thread_ptr; tls_descriptor.tp = thread_ptr; @@ -89,7 +89,7 @@ void init_tls(TLSDescriptor &tls_descriptor) { void cleanup_tls(uintptr_t addr, uintptr_t size) { if (size == 0) return; - __llvm_libc::syscall_impl(SYS_munmap, addr, size); + LIBC_NAMESPACE::syscall_impl(SYS_munmap, addr, size); } static void set_thread_ptr(uintptr_t val) { __arm_wsr64("tpidr_el0", val); } @@ -123,9 +123,9 @@ static void call_fini_array_callbacks() { reinterpret_cast(__fini_array_start[i - 1])(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE -using __llvm_libc::app; +using LIBC_NAMESPACE::app; // TODO: Would be nice to use the aux entry structure from elf.h when available. struct AuxEntry { @@ -134,10 +134,10 @@ struct AuxEntry { }; __attribute__((noinline)) static void do_start() { - auto tid = __llvm_libc::syscall_impl(SYS_gettid); + auto tid = LIBC_NAMESPACE::syscall_impl(SYS_gettid); if (tid <= 0) - __llvm_libc::syscall_impl(SYS_exit, 1); - __llvm_libc::main_thread_attrib.tid = static_cast(tid); + LIBC_NAMESPACE::syscall_impl(SYS_exit, 1); + LIBC_NAMESPACE::main_thread_attrib.tid = static_cast(tid); // After the argv array, is a 8-byte long NULL value before the array of env // values. The end of the env values is marked by another 8-byte long NULL @@ -184,22 +184,22 @@ __attribute__((noinline)) static void do_start() { app.tls.align = phdr->p_align; } - __llvm_libc::TLSDescriptor tls; - __llvm_libc::init_tls(tls); + LIBC_NAMESPACE::TLSDescriptor tls; + LIBC_NAMESPACE::init_tls(tls); if (tls.size != 0) - __llvm_libc::set_thread_ptr(tls.tp); + LIBC_NAMESPACE::set_thread_ptr(tls.tp); - __llvm_libc::self.attrib = &__llvm_libc::main_thread_attrib; - __llvm_libc::main_thread_attrib.atexit_callback_mgr = - __llvm_libc::internal::get_thread_atexit_callback_mgr(); + LIBC_NAMESPACE::self.attrib = &LIBC_NAMESPACE::main_thread_attrib; + LIBC_NAMESPACE::main_thread_attrib.atexit_callback_mgr = + LIBC_NAMESPACE::internal::get_thread_atexit_callback_mgr(); // We want the fini array callbacks to be run after other atexit // callbacks are run. So, we register them before running the init // array callbacks as they can potentially register their own atexit // callbacks. - __llvm_libc::atexit(&__llvm_libc::call_fini_array_callbacks); + LIBC_NAMESPACE::atexit(&LIBC_NAMESPACE::call_fini_array_callbacks); - __llvm_libc::call_init_array_callbacks( + LIBC_NAMESPACE::call_init_array_callbacks( static_cast(app.args->argc), reinterpret_cast(app.args->argv), reinterpret_cast(env_ptr)); @@ -211,8 +211,8 @@ __attribute__((noinline)) static void do_start() { // TODO: TLS cleanup should be done after all other atexit callbacks // are run. So, register a cleanup callback for it with atexit before // everything else. - __llvm_libc::cleanup_tls(tls.addr, tls.size); - __llvm_libc::exit(retval); + LIBC_NAMESPACE::cleanup_tls(tls.addr, tls.size); + LIBC_NAMESPACE::exit(retval); } extern "C" void _start() { @@ -226,7 +226,7 @@ extern "C" void _start() { // will take us to the previous stack pointer. That is the reason why the // actual business logic of the startup code is pushed into a non-inline // function do_start so that this function is free of any stack usage. - app.args = reinterpret_cast<__llvm_libc::Args *>( + app.args = reinterpret_cast( reinterpret_cast(__builtin_frame_address(0)) + 2); do_start(); } diff --git a/libc/startup/linux/riscv64/start.cpp b/libc/startup/linux/riscv64/start.cpp index 1bf05b94ad5acfe3656fd414828972fd34c61485..ed976d294d942150121893d2dc662456752e746c 100644 --- a/libc/startup/linux/riscv64/start.cpp +++ b/libc/startup/linux/riscv64/start.cpp @@ -22,7 +22,7 @@ extern "C" int main(int, char **, char **); -namespace __llvm_libc { +namespace LIBC_NAMESPACE { #ifdef SYS_mmap2 static constexpr long MMAP_SYSCALL_NUMBER = SYS_mmap2; @@ -56,18 +56,18 @@ void init_tls(TLSDescriptor &tls_descriptor) { // We cannot call the mmap function here as the functions set errno on // failure. Since errno is implemented via a thread local variable, we cannot // use errno before TLS is setup. - long mmap_ret_val = __llvm_libc::syscall_impl( + long mmap_ret_val = LIBC_NAMESPACE::syscall_impl( MMAP_SYSCALL_NUMBER, nullptr, alloc_size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); // We cannot check the return value with MAP_FAILED as that is the return // of the mmap function and not the mmap syscall. if (mmap_ret_val < 0 && static_cast(mmap_ret_val) > -app.pageSize) - __llvm_libc::syscall_impl(SYS_exit, 1); + LIBC_NAMESPACE::syscall_impl(SYS_exit, 1); uintptr_t thread_ptr = uintptr_t(reinterpret_cast(mmap_ret_val)); uintptr_t tls_addr = thread_ptr + size_of_pointers + padding; - __llvm_libc::inline_memcpy(reinterpret_cast(tls_addr), - reinterpret_cast(app.tls.address), - app.tls.init_size); + LIBC_NAMESPACE::inline_memcpy(reinterpret_cast(tls_addr), + reinterpret_cast(app.tls.address), + app.tls.init_size); tls_descriptor.size = alloc_size; tls_descriptor.addr = thread_ptr; tls_descriptor.tp = tls_addr; @@ -76,7 +76,7 @@ void init_tls(TLSDescriptor &tls_descriptor) { void cleanup_tls(uintptr_t addr, uintptr_t size) { if (size == 0) return; - __llvm_libc::syscall_impl(SYS_munmap, addr, size); + LIBC_NAMESPACE::syscall_impl(SYS_munmap, addr, size); } static void set_thread_ptr(uintptr_t val) { @@ -112,14 +112,14 @@ static void call_fini_array_callbacks() { reinterpret_cast(__fini_array_start[i - 1])(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE -using __llvm_libc::app; +using LIBC_NAMESPACE::app; // TODO: Would be nice to use the aux entry structure from elf.h when available. struct AuxEntry { - __llvm_libc::AuxEntryType type; - __llvm_libc::AuxEntryType value; + LIBC_NAMESPACE::AuxEntryType type; + LIBC_NAMESPACE::AuxEntryType value; }; #if defined(LIBC_TARGET_ARCH_IS_X86_64) || \ @@ -137,16 +137,16 @@ __attribute__((noinline)) static void do_start() { ".option norelax\n\t" "lla gp, __global_pointer$\n\t" ".option pop\n\t"); - auto tid = __llvm_libc::syscall_impl(SYS_gettid); + auto tid = LIBC_NAMESPACE::syscall_impl(SYS_gettid); if (tid <= 0) - __llvm_libc::syscall_impl(SYS_exit, 1); - __llvm_libc::main_thread_attrib.tid = static_cast(tid); + LIBC_NAMESPACE::syscall_impl(SYS_exit, 1); + LIBC_NAMESPACE::main_thread_attrib.tid = static_cast(tid); // After the argv array, is a 8-byte long NULL value before the array of env // values. The end of the env values is marked by another 8-byte long NULL // value. We step over it (the "+ 1" below) to get to the env values. - __llvm_libc::ArgVEntryType *env_ptr = app.args->argv + app.args->argc + 1; - __llvm_libc::ArgVEntryType *env_end_marker = env_ptr; + LIBC_NAMESPACE::ArgVEntryType *env_ptr = app.args->argv + app.args->argc + 1; + LIBC_NAMESPACE::ArgVEntryType *env_end_marker = env_ptr; app.envPtr = env_ptr; while (*env_end_marker) ++env_end_marker; @@ -187,22 +187,22 @@ __attribute__((noinline)) static void do_start() { app.tls.align = phdr->p_align; } - __llvm_libc::TLSDescriptor tls; - __llvm_libc::init_tls(tls); + LIBC_NAMESPACE::TLSDescriptor tls; + LIBC_NAMESPACE::init_tls(tls); if (tls.size != 0) - __llvm_libc::set_thread_ptr(tls.tp); + LIBC_NAMESPACE::set_thread_ptr(tls.tp); - __llvm_libc::self.attrib = &__llvm_libc::main_thread_attrib; - __llvm_libc::main_thread_attrib.atexit_callback_mgr = - __llvm_libc::internal::get_thread_atexit_callback_mgr(); + LIBC_NAMESPACE::self.attrib = &LIBC_NAMESPACE::main_thread_attrib; + LIBC_NAMESPACE::main_thread_attrib.atexit_callback_mgr = + LIBC_NAMESPACE::internal::get_thread_atexit_callback_mgr(); // We want the fini array callbacks to be run after other atexit // callbacks are run. So, we register them before running the init // array callbacks as they can potentially register their own atexit // callbacks. - __llvm_libc::atexit(&__llvm_libc::call_fini_array_callbacks); + LIBC_NAMESPACE::atexit(&LIBC_NAMESPACE::call_fini_array_callbacks); - __llvm_libc::call_init_array_callbacks( + LIBC_NAMESPACE::call_init_array_callbacks( static_cast(app.args->argc), reinterpret_cast(app.args->argv), reinterpret_cast(env_ptr)); @@ -214,13 +214,13 @@ __attribute__((noinline)) static void do_start() { // TODO: TLS cleanup should be done after all other atexit callbacks // are run. So, register a cleanup callback for it with atexit before // everything else. - __llvm_libc::cleanup_tls(tls.addr, tls.size); - __llvm_libc::exit(retval); + LIBC_NAMESPACE::cleanup_tls(tls.addr, tls.size); + LIBC_NAMESPACE::exit(retval); } extern "C" void _start() { // Fetch the args using the frame pointer. - app.args = reinterpret_cast<__llvm_libc::Args *>( + app.args = reinterpret_cast( reinterpret_cast(__builtin_frame_address(0))); do_start(); } diff --git a/libc/startup/linux/x86_64/start.cpp b/libc/startup/linux/x86_64/start.cpp index 2f9dbfddf6bee6ddc3fd4453df6a03f7558c2063..4b46a4f4a7b0813e3f44d6804cf6cdaef9117793 100644 --- a/libc/startup/linux/x86_64/start.cpp +++ b/libc/startup/linux/x86_64/start.cpp @@ -23,7 +23,7 @@ extern "C" int main(int, char **, char **); -namespace __llvm_libc { +namespace LIBC_NAMESPACE { #ifdef SYS_mmap2 static constexpr long mmapSyscallNumber = SYS_mmap2; @@ -59,13 +59,13 @@ void init_tls(TLSDescriptor &tls_descriptor) { // We cannot call the mmap function here as the functions set errno on // failure. Since errno is implemented via a thread local variable, we cannot // use errno before TLS is setup. - long mmapRetVal = __llvm_libc::syscall_impl( + long mmapRetVal = LIBC_NAMESPACE::syscall_impl( mmapSyscallNumber, nullptr, tlsSizeWithAddr, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); // We cannot check the return value with MAP_FAILED as that is the return // of the mmap function and not the mmap syscall. if (mmapRetVal < 0 && static_cast(mmapRetVal) > -app.pageSize) - __llvm_libc::syscall_impl(SYS_exit, 1); + LIBC_NAMESPACE::syscall_impl(SYS_exit, 1); uintptr_t *tlsAddr = reinterpret_cast(mmapRetVal); // x86_64 TLS faces down from the thread pointer with the first entry @@ -73,9 +73,9 @@ void init_tls(TLSDescriptor &tls_descriptor) { uintptr_t endPtr = reinterpret_cast(tlsAddr) + tlsSize; *reinterpret_cast(endPtr) = endPtr; - __llvm_libc::inline_memcpy(reinterpret_cast(tlsAddr), - reinterpret_cast(app.tls.address), - app.tls.init_size); + LIBC_NAMESPACE::inline_memcpy(reinterpret_cast(tlsAddr), + reinterpret_cast(app.tls.address), + app.tls.init_size); tls_descriptor = {tlsSizeWithAddr, uintptr_t(tlsAddr), endPtr}; return; @@ -84,12 +84,12 @@ void init_tls(TLSDescriptor &tls_descriptor) { void cleanup_tls(uintptr_t addr, uintptr_t size) { if (size == 0) return; - __llvm_libc::syscall_impl(SYS_munmap, addr, size); + LIBC_NAMESPACE::syscall_impl(SYS_munmap, addr, size); } // Sets the thread pointer to |val|. Returns true on success, false on failure. static bool set_thread_ptr(uintptr_t val) { - return __llvm_libc::syscall_impl(SYS_arch_prctl, ARCH_SET_FS, val) != -1; + return LIBC_NAMESPACE::syscall_impl(SYS_arch_prctl, ARCH_SET_FS, val) != -1; } using InitCallback = void(int, char **, char **); @@ -121,9 +121,9 @@ static void call_fini_array_callbacks() { reinterpret_cast(__fini_array_start[i - 1])(); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE -using __llvm_libc::app; +using LIBC_NAMESPACE::app; // TODO: Would be nice to use the aux entry structure from elf.h when available. struct AuxEntry { @@ -135,7 +135,7 @@ extern "C" void _start() { // This TU is compiled with -fno-omit-frame-pointer. Hence, the previous value // of the base pointer is pushed on to the stack. So, we step over it (the // "+ 1" below) to get to the args. - app.args = reinterpret_cast<__llvm_libc::Args *>( + app.args = reinterpret_cast( reinterpret_cast(__builtin_frame_address(0)) + 1); // The x86_64 ABI requires that the stack pointer is aligned to a 16-byte @@ -152,10 +152,10 @@ extern "C" void _start() { __asm__ __volatile__("andq $0xfffffffffffffff0, %rsp\n\t"); __asm__ __volatile__("andq $0xfffffffffffffff0, %rbp\n\t"); - auto tid = __llvm_libc::syscall_impl(SYS_gettid); + auto tid = LIBC_NAMESPACE::syscall_impl(SYS_gettid); if (tid <= 0) - __llvm_libc::syscall_impl(SYS_exit, 1); - __llvm_libc::main_thread_attrib.tid = static_cast(tid); + LIBC_NAMESPACE::syscall_impl(SYS_exit, 1); + LIBC_NAMESPACE::main_thread_attrib.tid = static_cast(tid); // After the argv array, is a 8-byte long NULL value before the array of env // values. The end of the env values is marked by another 8-byte long NULL @@ -202,22 +202,22 @@ extern "C" void _start() { app.tls.align = phdr->p_align; } - __llvm_libc::TLSDescriptor tls; - __llvm_libc::init_tls(tls); - if (tls.size != 0 && !__llvm_libc::set_thread_ptr(tls.tp)) - __llvm_libc::syscall_impl(SYS_exit, 1); + LIBC_NAMESPACE::TLSDescriptor tls; + LIBC_NAMESPACE::init_tls(tls); + if (tls.size != 0 && !LIBC_NAMESPACE::set_thread_ptr(tls.tp)) + LIBC_NAMESPACE::syscall_impl(SYS_exit, 1); - __llvm_libc::self.attrib = &__llvm_libc::main_thread_attrib; - __llvm_libc::main_thread_attrib.atexit_callback_mgr = - __llvm_libc::internal::get_thread_atexit_callback_mgr(); + LIBC_NAMESPACE::self.attrib = &LIBC_NAMESPACE::main_thread_attrib; + LIBC_NAMESPACE::main_thread_attrib.atexit_callback_mgr = + LIBC_NAMESPACE::internal::get_thread_atexit_callback_mgr(); // We want the fini array callbacks to be run after other atexit // callbacks are run. So, we register them before running the init // array callbacks as they can potentially register their own atexit // callbacks. - __llvm_libc::atexit(&__llvm_libc::call_fini_array_callbacks); + LIBC_NAMESPACE::atexit(&LIBC_NAMESPACE::call_fini_array_callbacks); - __llvm_libc::call_init_array_callbacks( + LIBC_NAMESPACE::call_init_array_callbacks( static_cast(app.args->argc), reinterpret_cast(app.args->argv), reinterpret_cast(env_ptr)); @@ -229,6 +229,6 @@ extern "C" void _start() { // TODO: TLS cleanup should be done after all other atexit callbacks // are run. So, register a cleanup callback for it with atexit before // everything else. - __llvm_libc::cleanup_tls(tls.addr, tls.size); - __llvm_libc::exit(retval); + LIBC_NAMESPACE::cleanup_tls(tls.addr, tls.size); + LIBC_NAMESPACE::exit(retval); } diff --git a/libc/test/IntegrationTest/test.cpp b/libc/test/IntegrationTest/test.cpp index 8e2feccd0dac7195fced4f745034d10c8e1f08ca..3bdbe89a3fb62d9fe026ea50fb90b917d21c2cbd 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 8dff1980f9236e4b8e39280c5e641397a8ac7153..1e5ad1cfef0d7b56ea2d4e20fea991eb3800cda1 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 7bee46c4029e57da868c7bad9d4808e9ef914790..79730868ecdf3f1c5efea922dea8a1f7fa76abb5 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 1e89167a002755d637cd6444af7d68305dc9ed5b..2a7d1c39d3205cbb5a2169c068122f08226b5cb3 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 e55beb52d79ae33e1195b7f2b428b25150b8b3e5..b748c29751c328367649ed81d684b95f55a39713 100644 --- a/libc/test/UnitTest/ErrnoSetterMatcher.h +++ b/libc/test/UnitTest/ErrnoSetterMatcher.h @@ -16,7 +16,7 @@ #include "src/errno/libc_errno.h" #include "test/UnitTest/Test.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { namespace internal { @@ -170,6 +170,6 @@ returns(internal::Comparator cmp) { } // namespace ErrnoSetterMatcher } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_TEST_ERRNOSETTERMATCHER_H diff --git a/libc/test/UnitTest/ExecuteFunction.h b/libc/test/UnitTest/ExecuteFunction.h index 335720fdba2c7bb13af9e0b7fb87dfae24c80d41..2129e63a3a0029d86379b472763547f7b23e8e7d 100644 --- a/libc/test/UnitTest/ExecuteFunction.h +++ b/libc/test/UnitTest/ExecuteFunction.h @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testutils { class FunctionCaller { @@ -47,6 +47,6 @@ invoke_in_subprocess(FunctionCaller *func, const char *signal_as_string(int signum); } // namespace testutils -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_UTILS_TESTUTILS_EXECUTEFUNCTION_H diff --git a/libc/test/UnitTest/ExecuteFunctionUnix.cpp b/libc/test/UnitTest/ExecuteFunctionUnix.cpp index 1caaa24b8d41464b2829c5c78b2e08a412301d44..b244337f9c6fcd6508e689f932a5fe88bc22f451 100644 --- a/libc/test/UnitTest/ExecuteFunctionUnix.cpp +++ b/libc/test/UnitTest/ExecuteFunctionUnix.cpp @@ -17,7 +17,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testutils { bool ProcessStatus::exited_normally() { return WIFEXITED(platform_defined); } @@ -78,4 +78,4 @@ ProcessStatus invoke_in_subprocess(FunctionCaller *func, unsigned timeout_ms) { const char *signal_as_string(int signum) { return ::strsignal(signum); } } // namespace testutils -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/UnitTest/FPExceptMatcher.cpp b/libc/test/UnitTest/FPExceptMatcher.cpp index c712fec01d485c9d44ae989f3db2b6f3d61c626c..1601b7e53f2be1b968db601bb362bcdc2f78fe57 100644 --- a/libc/test/UnitTest/FPExceptMatcher.cpp +++ b/libc/test/UnitTest/FPExceptMatcher.cpp @@ -13,7 +13,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { #if defined(_WIN32) @@ -47,4 +47,4 @@ FPExceptMatcher::FPExceptMatcher(FunctionCaller *func) { } } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/UnitTest/FPExceptMatcher.h b/libc/test/UnitTest/FPExceptMatcher.h index 1563561854abdb5d798ddee00a61189253d232d4..98c4f737d172753060ed0a90b992eef511a3e7dc 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 d8d032b3ef530d08466c2b36b1a3e5e1f0b3d546..0c1f340449236e25b2befd37685019098b3d8d62 100644 --- a/libc/test/UnitTest/FPMatcher.h +++ b/libc/test/UnitTest/FPMatcher.h @@ -18,7 +18,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { template class FPMatcher : public Matcher { @@ -60,10 +60,10 @@ template FPMatcher getMatcher(T expectedValue) { } } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #define DECLARE_SPECIAL_CONSTANTS(T) \ - using FPBits = __llvm_libc::fputil::FPBits; \ + using FPBits = LIBC_NAMESPACE::fputil::FPBits; \ using UIntType = typename FPBits::UIntType; \ const T zero = T(FPBits::zero()); \ const T neg_zero = T(FPBits::neg_zero()); \ @@ -72,35 +72,27 @@ template FPMatcher getMatcher(T expectedValue) { const T neg_inf = T(FPBits::neg_inf()); #define EXPECT_FP_EQ(expected, actual) \ - EXPECT_THAT( \ - actual, \ - __llvm_libc::testing::getMatcher<__llvm_libc::testing::TestCond::EQ>( \ - expected)) + EXPECT_THAT(actual, LIBC_NAMESPACE::testing::getMatcher< \ + LIBC_NAMESPACE::testing::TestCond::EQ>(expected)) #define TEST_FP_EQ(expected, actual) \ - __llvm_libc::testing::getMatcher<__llvm_libc::testing::TestCond::EQ>( \ + LIBC_NAMESPACE::testing::getMatcher( \ expected) \ .match(actual) #define EXPECT_FP_IS_NAN(actual) EXPECT_TRUE((actual) != (actual)) #define ASSERT_FP_EQ(expected, actual) \ - ASSERT_THAT( \ - actual, \ - __llvm_libc::testing::getMatcher<__llvm_libc::testing::TestCond::EQ>( \ - expected)) + ASSERT_THAT(actual, LIBC_NAMESPACE::testing::getMatcher< \ + LIBC_NAMESPACE::testing::TestCond::EQ>(expected)) #define EXPECT_FP_NE(expected, actual) \ - EXPECT_THAT( \ - actual, \ - __llvm_libc::testing::getMatcher<__llvm_libc::testing::TestCond::NE>( \ - expected)) + EXPECT_THAT(actual, LIBC_NAMESPACE::testing::getMatcher< \ + LIBC_NAMESPACE::testing::TestCond::NE>(expected)) #define ASSERT_FP_NE(expected, actual) \ - ASSERT_THAT( \ - actual, \ - __llvm_libc::testing::getMatcher<__llvm_libc::testing::TestCond::NE>( \ - expected)) + ASSERT_THAT(actual, LIBC_NAMESPACE::testing::getMatcher< \ + LIBC_NAMESPACE::testing::TestCond::NE>(expected)) #define EXPECT_MATH_ERRNO(expected) \ do { \ @@ -123,7 +115,7 @@ template FPMatcher getMatcher(T expectedValue) { #define EXPECT_FP_EXCEPTION(expected) \ do { \ if (math_errhandling & MATH_ERREXCEPT) { \ - EXPECT_GE(__llvm_libc::fputil::test_except(FE_ALL_EXCEPT) & expected, \ + EXPECT_GE(LIBC_NAMESPACE::fputil::test_except(FE_ALL_EXCEPT) & expected, \ expected); \ } \ } while (0) @@ -131,38 +123,38 @@ template FPMatcher getMatcher(T expectedValue) { #define ASSERT_FP_EXCEPTION(expected) \ do { \ if (math_errhandling & MATH_ERREXCEPT) { \ - ASSERT_GE(__llvm_libc::fputil::test_except(FE_ALL_EXCEPT) & expected, \ + ASSERT_GE(LIBC_NAMESPACE::fputil::test_except(FE_ALL_EXCEPT) & expected, \ expected); \ } \ } while (0) #define EXPECT_FP_EQ_WITH_EXCEPTION(expected_val, actual_val, expected_except) \ do { \ - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); \ + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); \ EXPECT_FP_EQ(expected_val, actual_val); \ if (math_errhandling & MATH_ERREXCEPT) { \ - EXPECT_GE(__llvm_libc::fputil::test_except(FE_ALL_EXCEPT) & \ + EXPECT_GE(LIBC_NAMESPACE::fputil::test_except(FE_ALL_EXCEPT) & \ expected_except, \ expected_except); \ - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); \ + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); \ } \ } while (0) #define EXPECT_FP_IS_NAN_WITH_EXCEPTION(actual_val, expected_except) \ do { \ - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); \ + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); \ EXPECT_FP_IS_NAN(actual_val); \ if (math_errhandling & MATH_ERREXCEPT) { \ - EXPECT_GE(__llvm_libc::fputil::test_except(FE_ALL_EXCEPT) & \ + EXPECT_GE(LIBC_NAMESPACE::fputil::test_except(FE_ALL_EXCEPT) & \ expected_except, \ expected_except); \ - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); \ + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); \ } \ } while (0) #define EXPECT_FP_EQ_ALL_ROUNDING(expected, actual) \ do { \ - using namespace __llvm_libc::fputil::testing; \ + using namespace LIBC_NAMESPACE::fputil::testing; \ ForceRoundingMode __r1(RoundingMode::Nearest); \ if (__r1.success) \ EXPECT_FP_EQ((expected), (actual)); \ diff --git a/libc/test/UnitTest/FuchsiaTest.h b/libc/test/UnitTest/FuchsiaTest.h index f711e83bdf26028219300316c9a0aa43f3f83a01..07a6e9b3f6bde5affae037addd84198455d7ea7f 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 3d88b0ed64e81e5cc89e9d981a549bd1c44e2ff7..73d54b9eeb5ecc9486578da445fbd16893395f3c 100644 --- a/libc/test/UnitTest/HermeticTestUtils.cpp +++ b/libc/test/UnitTest/HermeticTestUtils.cpp @@ -9,7 +9,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { int bcmp(const void *lhs, const void *rhs, size_t count); void bzero(void *ptr, size_t count); @@ -19,7 +19,7 @@ void *memmove(void *dst, const void *src, size_t count); void *memset(void *ptr, int value, size_t count); int atexit(void (*func)(void)); -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE namespace { @@ -43,24 +43,24 @@ extern "C" { // This is done manually as not all targets support aliases. int bcmp(const void *lhs, const void *rhs, size_t count) { - return __llvm_libc::bcmp(lhs, rhs, count); + return LIBC_NAMESPACE::bcmp(lhs, rhs, count); } -void bzero(void *ptr, size_t count) { __llvm_libc::bzero(ptr, count); } +void bzero(void *ptr, size_t count) { LIBC_NAMESPACE::bzero(ptr, count); } int memcmp(const void *lhs, const void *rhs, size_t count) { - return __llvm_libc::memcmp(lhs, rhs, count); + return LIBC_NAMESPACE::memcmp(lhs, rhs, count); } void *memcpy(void *__restrict dst, const void *__restrict src, size_t count) { - return __llvm_libc::memcpy(dst, src, count); + return LIBC_NAMESPACE::memcpy(dst, src, count); } void *memmove(void *dst, const void *src, size_t count) { - return __llvm_libc::memmove(dst, src, count); + return LIBC_NAMESPACE::memmove(dst, src, count); } void *memset(void *ptr, int value, size_t count) { - return __llvm_libc::memset(ptr, value, count); + return LIBC_NAMESPACE::memset(ptr, value, count); } // This is needed if the test was compiled with '-fno-use-cxa-atexit'. -int atexit(void (*func)(void)) { return __llvm_libc::atexit(func); } +int atexit(void (*func)(void)) { return LIBC_NAMESPACE::atexit(func); } constexpr uint64_t ALIGNMENT = alignof(uintptr_t); diff --git a/libc/test/UnitTest/LibcDeathTestExecutors.cpp b/libc/test/UnitTest/LibcDeathTestExecutors.cpp index f25c0f77240024a0eafc0020ec65d30510353d02..e891c4e3c0b586fe06c7f3e1699e5caf4171bbb2 100644 --- a/libc/test/UnitTest/LibcDeathTestExecutors.cpp +++ b/libc/test/UnitTest/LibcDeathTestExecutors.cpp @@ -13,7 +13,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { bool Test::testProcessKilled(testutils::FunctionCaller *Func, int Signal, @@ -101,4 +101,4 @@ bool Test::testProcessExits(testutils::FunctionCaller *Func, int ExitCode, } } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/UnitTest/LibcTest.cpp b/libc/test/UnitTest/LibcTest.cpp index d9a9e50ca9a65be70dca75d0dfdbeed5f10c5b26..2f18d5778e71d8448d5cdeb1e27c7606ba6f527f 100644 --- a/libc/test/UnitTest/LibcTest.cpp +++ b/libc/test/UnitTest/LibcTest.cpp @@ -17,21 +17,21 @@ #include #elif defined(LIBC_TARGET_ARCH_IS_GPU) #include "src/__support/GPU/utils.h" -static long clock() { return __llvm_libc::gpu::fixed_frequency_clock(); } +static long clock() { return LIBC_NAMESPACE::gpu::fixed_frequency_clock(); } #if defined(LIBC_TARGET_ARCH_IS_NVPTX) #define CLOCKS_PER_SEC 1000000000UL #else // The AMDGPU loader needs to initialize this at runtime by querying the driver. extern "C" [[gnu::visibility("protected")]] uint64_t - [[clang::address_space(4)]] __llvm_libc_clock_freq; -#define CLOCKS_PER_SEC __llvm_libc_clock_freq + [[clang::address_space(4)]] LIBC_NAMESPACE_clock_freq; +#define CLOCKS_PER_SEC LIBC_NAMESPACE_clock_freq #endif #else static long clock() { return 0; } #define CLOCKS_PER_SEC 1 #endif -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { namespace internal { @@ -244,52 +244,43 @@ template bool test<__uint128_t>(RunContext *Ctx, TestCond Cond, __uint128_t LHS, const char *RHSStr, Location Loc); #endif -template bool test<__llvm_libc::cpp::Int<128>>(RunContext *Ctx, TestCond Cond, - __llvm_libc::cpp::Int<128> LHS, - __llvm_libc::cpp::Int<128> RHS, - const char *LHSStr, - const char *RHSStr, - Location Loc); +template bool test>( + RunContext *Ctx, TestCond Cond, LIBC_NAMESPACE::cpp::Int<128> LHS, + LIBC_NAMESPACE::cpp::Int<128> RHS, const char *LHSStr, const char *RHSStr, + Location Loc); -template bool test<__llvm_libc::cpp::UInt<128>>(RunContext *Ctx, TestCond Cond, - __llvm_libc::cpp::UInt<128> LHS, - __llvm_libc::cpp::UInt<128> RHS, - const char *LHSStr, - const char *RHSStr, - Location Loc); +template bool test>( + RunContext *Ctx, TestCond Cond, LIBC_NAMESPACE::cpp::UInt<128> LHS, + LIBC_NAMESPACE::cpp::UInt<128> RHS, const char *LHSStr, const char *RHSStr, + Location Loc); -template bool test<__llvm_libc::cpp::UInt<192>>(RunContext *Ctx, TestCond Cond, - __llvm_libc::cpp::UInt<192> LHS, - __llvm_libc::cpp::UInt<192> RHS, - const char *LHSStr, - const char *RHSStr, - Location Loc); +template bool test>( + RunContext *Ctx, TestCond Cond, LIBC_NAMESPACE::cpp::UInt<192> LHS, + LIBC_NAMESPACE::cpp::UInt<192> RHS, const char *LHSStr, const char *RHSStr, + Location Loc); -template bool test<__llvm_libc::cpp::UInt<256>>(RunContext *Ctx, TestCond Cond, - __llvm_libc::cpp::UInt<256> LHS, - __llvm_libc::cpp::UInt<256> RHS, - const char *LHSStr, - const char *RHSStr, - Location Loc); +template bool test>( + RunContext *Ctx, TestCond Cond, LIBC_NAMESPACE::cpp::UInt<256> LHS, + LIBC_NAMESPACE::cpp::UInt<256> RHS, const char *LHSStr, const char *RHSStr, + Location Loc); + +template bool test>( + RunContext *Ctx, TestCond Cond, LIBC_NAMESPACE::cpp::UInt<320> LHS, + LIBC_NAMESPACE::cpp::UInt<320> RHS, const char *LHSStr, const char *RHSStr, + Location Loc); -template bool test<__llvm_libc::cpp::UInt<320>>(RunContext *Ctx, TestCond Cond, - __llvm_libc::cpp::UInt<320> LHS, - __llvm_libc::cpp::UInt<320> RHS, +template bool test( + RunContext *Ctx, TestCond Cond, LIBC_NAMESPACE::cpp::string_view LHS, + LIBC_NAMESPACE::cpp::string_view RHS, const char *LHSStr, + const char *RHSStr, Location Loc); + +template bool test(RunContext *Ctx, TestCond Cond, + LIBC_NAMESPACE::cpp::string LHS, + LIBC_NAMESPACE::cpp::string RHS, const char *LHSStr, const char *RHSStr, Location Loc); -template bool test<__llvm_libc::cpp::string_view>( - RunContext *Ctx, TestCond Cond, __llvm_libc::cpp::string_view LHS, - __llvm_libc::cpp::string_view RHS, const char *LHSStr, const char *RHSStr, - Location Loc); - -template bool test<__llvm_libc::cpp::string>(RunContext *Ctx, TestCond Cond, - __llvm_libc::cpp::string LHS, - __llvm_libc::cpp::string RHS, - const char *LHSStr, - const char *RHSStr, Location Loc); - } // namespace internal bool Test::testStrEq(const char *LHS, const char *RHS, const char *LHSStr, @@ -321,4 +312,4 @@ bool Test::testMatch(bool MatchResult, MatcherBase &Matcher, const char *LHSStr, } } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/UnitTest/LibcTest.h b/libc/test/UnitTest/LibcTest.h index d01618d008c7091b988807fd90dd650bcb573f0e..dc17c3c49d4277ebe99e71bdde6653268978d339 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, - int> = 0> + cpp::enable_if_t< + cpp::is_same_v, int> = 0> bool test(TestCond Cond, ValType LHS, ValType RHS, const char *LHSStr, const char *RHSStr, internal::Location Loc) { return internal::test(Ctx, Cond, LHS, RHS, LHSStr, RHSStr, Loc); } template , - int> = 0> + cpp::enable_if_t< + cpp::is_same_v, int> = 0> bool test(TestCond Cond, ValType LHS, ValType RHS, const char *LHSStr, const char *RHSStr, internal::Location Loc) { return internal::test(Ctx, Cond, LHS, RHS, LHSStr, RHSStr, Loc); @@ -225,8 +225,9 @@ constexpr bool valid_prefix(char const *lhs) { } // 'str' is a null terminated string of the form -// "const char *__llvm_libc::testing::internal::GetTypeName() [ParamType = XXX]" -// We return the substring that start at character '[' or a default message. +// "const char *LIBC_NAMESPACE::testing::internal::GetTypeName() [ParamType = +// XXX]" We return the substring that start at character '[' or a default +// message. constexpr char const *GetPrettyFunctionParamType(char const *str) { for (const char *ptr = str; *ptr != '\0'; ++ptr) if (*ptr == '[') @@ -292,13 +293,13 @@ template struct TypeList { } // namespace internal -// Make TypeList visible in __llvm_libc::testing. +// Make TypeList visible in LIBC_NAMESPACE::testing. template using TypeList = internal::TypeList; CString libc_make_test_file_path_func(const char *file_name); } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE // For TYPED_TEST and TYPED_TEST_F below we need to display which type was used // to run the test. The default will return the fully qualified canonical type @@ -306,22 +307,23 @@ CString libc_make_test_file_path_func(const char *file_name); // client to register the type name as they see it in the code. #define REGISTER_TYPE_NAME(TYPE) \ template <> \ - constexpr const char *__llvm_libc::testing::internal::GetTypeName() { \ + constexpr const char * \ + LIBC_NAMESPACE::testing::internal::GetTypeName() { \ return "[ParamType = " #TYPE "]"; \ } #define TYPED_TEST(SuiteName, TestName, TypeList) \ static_assert( \ - __llvm_libc::testing::internal::valid_prefix(#SuiteName), \ + LIBC_NAMESPACE::testing::internal::valid_prefix(#SuiteName), \ "All LLVM-libc TYPED_TEST suite names must start with 'LlvmLibc'."); \ template \ - class SuiteName##_##TestName : public __llvm_libc::testing::Test { \ + class SuiteName##_##TestName : public LIBC_NAMESPACE::testing::Test { \ public: \ using ParamType = T; \ char name[256]; \ SuiteName##_##TestName() { \ addTest(this); \ - __llvm_libc::testing::internal::GenerateName( \ + LIBC_NAMESPACE::testing::internal::GenerateName( \ name, sizeof(name), #SuiteName "." #TestName); \ } \ void Run() override; \ @@ -332,7 +334,7 @@ CString libc_make_test_file_path_func(const char *file_name); template void SuiteName##_##TestName::Run() #define TYPED_TEST_F(SuiteClass, TestName, TypeList) \ - static_assert(__llvm_libc::testing::internal::valid_prefix(#SuiteClass), \ + static_assert(LIBC_NAMESPACE::testing::internal::valid_prefix(#SuiteClass), \ "All LLVM-libc TYPED_TEST_F suite class names must start " \ "with 'LlvmLibc'."); \ template class SuiteClass##_##TestName : public SuiteClass { \ @@ -341,7 +343,7 @@ CString libc_make_test_file_path_func(const char *file_name); char name[256]; \ SuiteClass##_##TestName() { \ SuiteClass::addTest(this); \ - __llvm_libc::testing::internal::GenerateName( \ + LIBC_NAMESPACE::testing::internal::GenerateName( \ name, sizeof(name), #SuiteClass "." #TestName); \ } \ void Run() override; \ @@ -352,9 +354,9 @@ CString libc_make_test_file_path_func(const char *file_name); template void SuiteClass##_##TestName::Run() #define TEST(SuiteName, TestName) \ - static_assert(__llvm_libc::testing::internal::valid_prefix(#SuiteName), \ + static_assert(LIBC_NAMESPACE::testing::internal::valid_prefix(#SuiteName), \ "All LLVM-libc TEST suite names must start with 'LlvmLibc'."); \ - class SuiteName##_##TestName : public __llvm_libc::testing::Test { \ + class SuiteName##_##TestName : public LIBC_NAMESPACE::testing::Test { \ public: \ SuiteName##_##TestName() { addTest(this); } \ void Run() override; \ @@ -365,7 +367,7 @@ CString libc_make_test_file_path_func(const char *file_name); #define TEST_F(SuiteClass, TestName) \ static_assert( \ - __llvm_libc::testing::internal::valid_prefix(#SuiteClass), \ + LIBC_NAMESPACE::testing::internal::valid_prefix(#SuiteClass), \ "All LLVM-libc TEST_F suite class names must start with 'LlvmLibc'."); \ class SuiteClass##_##TestName : public SuiteClass { \ public: \ @@ -404,12 +406,12 @@ CString libc_make_test_file_path_func(const char *file_name); if (TEST) \ ; \ else \ - RET_OR_EMPTY __llvm_libc::testing::internal::Failure() = \ - __llvm_libc::testing::internal::Message() + RET_OR_EMPTY LIBC_NAMESPACE::testing::internal::Failure() = \ + LIBC_NAMESPACE::testing::internal::Message() #define LIBC_TEST_BINOP_(COND, LHS, RHS, RET_OR_EMPTY) \ - LIBC_TEST_SCAFFOLDING_(test(__llvm_libc::testing::TestCond::COND, LHS, RHS, \ - #LHS, #RHS, LIBC_TEST_LOC_()), \ + LIBC_TEST_SCAFFOLDING_(test(LIBC_NAMESPACE::testing::TestCond::COND, LHS, \ + RHS, #LHS, #RHS, LIBC_TEST_LOC_()), \ RET_OR_EMPTY) //////////////////////////////////////////////////////////////////////////////// @@ -462,7 +464,7 @@ CString libc_make_test_file_path_func(const char *file_name); #define LIBC_TEST_PROCESS_(TEST_FUNC, FUNC, VALUE, RET_OR_EMPTY) \ LIBC_TEST_SCAFFOLDING_( \ - TEST_FUNC(__llvm_libc::testing::Test::createCallable(FUNC), VALUE, \ + TEST_FUNC(LIBC_NAMESPACE::testing::Test::createCallable(FUNC), VALUE, \ #FUNC, #VALUE, LIBC_TEST_LOC_()), \ RET_OR_EMPTY) diff --git a/libc/test/UnitTest/LibcTestMain.cpp b/libc/test/UnitTest/LibcTestMain.cpp index 756d1196bc36564c9a2349b88019d30b2bd94d12..bf1a921c04ca98c20fe553f013ade90594f0db16 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 32f7d5e17e0208d717e0fa1a72d9240445ef4f7f..d9d89504dbeba7960d5e8d4bbae0fa7e7b502539 100644 --- a/libc/test/UnitTest/MemoryMatcher.cpp +++ b/libc/test/UnitTest/MemoryMatcher.cpp @@ -10,9 +10,9 @@ #include "test/UnitTest/Test.h" -using __llvm_libc::testing::tlog; +using LIBC_NAMESPACE::testing::tlog; -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { template @@ -75,4 +75,4 @@ void MemoryMatcher::explainError() { } } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/UnitTest/MemoryMatcher.h b/libc/test/UnitTest/MemoryMatcher.h index e3df4c09315c9f336f4d01e633242a24a0a09599..cf861a6757ae1740f4f08c9f13cc93858bae46c1 100644 --- a/libc/test/UnitTest/MemoryMatcher.h +++ b/libc/test/UnitTest/MemoryMatcher.h @@ -13,35 +13,35 @@ #include "test/UnitTest/Test.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { -using MemoryView = __llvm_libc::cpp::span; +using MemoryView = LIBC_NAMESPACE::cpp::span; } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #ifdef LIBC_COPT_TEST_USE_FUCHSIA #define EXPECT_MEM_EQ(expected, actual) \ do { \ - __llvm_libc::testing::MemoryView e = (expected); \ - __llvm_libc::testing::MemoryView a = (actual); \ + LIBC_NAMESPACE::testing::MemoryView e = (expected); \ + LIBC_NAMESPACE::testing::MemoryView a = (actual); \ ASSERT_EQ(e.size(), a.size()); \ EXPECT_BYTES_EQ(e.data(), a.data(), e.size()); \ } while (0) #define ASSERT_MEM_EQ(expected, actual) \ do { \ - __llvm_libc::testing::MemoryView e = (expected); \ - __llvm_libc::testing::MemoryView a = (actual); \ + LIBC_NAMESPACE::testing::MemoryView e = (expected); \ + LIBC_NAMESPACE::testing::MemoryView a = (actual); \ ASSERT_EQ(e.size(), a.size()); \ ASSERT_BYTES_EQ(e.data(), a.data(), e.size()); \ } while (0) #else -namespace __llvm_libc::testing { +namespace LIBC_NAMESPACE::testing { class MemoryMatcher : public Matcher { MemoryView expected; @@ -57,12 +57,12 @@ 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 f3b33b76be4bd320b04f726695e637522f12d1e6..855633527fb3596edc4f043eeb6c83fd565a87f7 100644 --- a/libc/test/UnitTest/PigweedTest.h +++ b/libc/test/UnitTest/PigweedTest.h @@ -11,7 +11,7 @@ #include -namespace __llvm_libc::testing { +namespace LIBC_NAMESPACE::testing { using Test = ::testing::Test; } diff --git a/libc/test/UnitTest/PrintfMatcher.cpp b/libc/test/UnitTest/PrintfMatcher.cpp index 019eafcfb4b220fba60cd18f65708617770ab334..e895da2be120f8cfba96b1f1f18512d6cc9afecc 100644 --- a/libc/test/UnitTest/PrintfMatcher.cpp +++ b/libc/test/UnitTest/PrintfMatcher.cpp @@ -16,7 +16,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { using printf_core::FormatFlags; @@ -94,4 +94,4 @@ void FormatSectionMatcher::explainError() { } } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/UnitTest/PrintfMatcher.h b/libc/test/UnitTest/PrintfMatcher.h index 148c9ff80931dbba45b72fc026ee27fd3824695e..a4fbeda4d585a6b03838287fad45a54a7862f330 100644 --- a/libc/test/UnitTest/PrintfMatcher.h +++ b/libc/test/UnitTest/PrintfMatcher.h @@ -14,7 +14,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { class FormatSectionMatcher : public Matcher { @@ -31,12 +31,12 @@ 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 f880effd75a3512d6de428d833fed3a044273a9d..c8f32f81e7134aa0c5c7121a06070c09cb68ee00 100644 --- a/libc/test/UnitTest/RoundingModeUtils.cpp +++ b/libc/test/UnitTest/RoundingModeUtils.cpp @@ -12,7 +12,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { namespace testing { @@ -48,4 +48,4 @@ ForceRoundingMode::~ForceRoundingMode() { } // namespace testing } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/UnitTest/RoundingModeUtils.h b/libc/test/UnitTest/RoundingModeUtils.h index e8611c34b5403376fdc36737cb1b81146391f10c..d1c3c6ff400a54230f0bfc2aaff948cdfe2a6599 100644 --- a/libc/test/UnitTest/RoundingModeUtils.h +++ b/libc/test/UnitTest/RoundingModeUtils.h @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace fputil { namespace testing { @@ -32,6 +32,6 @@ template struct ForceRoundingModeTest : ForceRoundingMode { } // namespace testing } // namespace fputil -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_UTILS_TESTUTILS_ROUNDINGMODEUTILS_H diff --git a/libc/test/UnitTest/ScanfMatcher.cpp b/libc/test/UnitTest/ScanfMatcher.cpp index 7374858910d5485be0496c13f3655cc42d9be106..91cb73fb332ed3cfe10516d0eaed9edb0806658e 100644 --- a/libc/test/UnitTest/ScanfMatcher.cpp +++ b/libc/test/UnitTest/ScanfMatcher.cpp @@ -16,7 +16,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { using scanf_core::FormatFlags; @@ -99,4 +99,4 @@ void FormatSectionMatcher::explainError() { } } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/UnitTest/ScanfMatcher.h b/libc/test/UnitTest/ScanfMatcher.h index 864a35d74adeb8b147f41950530869df47edafcb..0b9a8868bf0b81031b031ab4efadbb25830b1d37 100644 --- a/libc/test/UnitTest/ScanfMatcher.h +++ b/libc/test/UnitTest/ScanfMatcher.h @@ -14,7 +14,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { class FormatSectionMatcher : public Matcher { @@ -31,12 +31,12 @@ 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 8f517a5ec9c8f484df0a8bac057655db9e57fae4..ac28926d51cd8979cf1a10b6da94e793beaba3ce 100644 --- a/libc/test/UnitTest/StringUtils.h +++ b/libc/test/UnitTest/StringUtils.h @@ -12,7 +12,7 @@ #include "src/__support/CPP/string.h" #include "src/__support/CPP/type_traits.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Return the first N hex digits of an integer as a string in upper case. template @@ -31,6 +31,6 @@ int_to_hex(T value, size_t length = sizeof(T) * 2) { return "0x" + s; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_UTILS_UNITTEST_SIMPLE_STRING_CONV_H diff --git a/libc/test/UnitTest/TestLogger.cpp b/libc/test/UnitTest/TestLogger.cpp index 02be4bdf5de81133f484636ea9b3105ad1bb56c6..6bb0e17dc3888ef169d0f28e1cd71004c7835bef 100644 --- a/libc/test/UnitTest/TestLogger.cpp +++ b/libc/test/UnitTest/TestLogger.cpp @@ -6,13 +6,13 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { // cpp::string_view specialization template <> TestLogger &TestLogger::operator<< (cpp::string_view str) { - __llvm_libc::write_to_stderr(str); + LIBC_NAMESPACE::write_to_stderr(str); return *this; } @@ -83,4 +83,4 @@ template TestLogger &TestLogger::operator<< >(cpp::UInt<320>); TestLogger tlog; } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/UnitTest/TestLogger.h b/libc/test/UnitTest/TestLogger.h index 2d46ea1ca14657aaf70831faae11a0226bf1f969..6188bcf4434afa896e71b0e841677d378f3c7646 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 300cf2c7be3b7a58e63087de554deabbb44ef40b..697d991d07547c4036f722a25dd8577be9b1ad38 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 2574f1f8b2500280e575890f76966a19df094294..d7ad54e52b81c00ce3d5a4a02f3dfef3cbc359ca 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 c8d512343586f6649c4819f9b3597ddd6d88316d..6a9b44cc1422cc519204b46bfce5c6b07ea90bf7 100644 --- a/libc/test/integration/src/pthread/pthread_create_test.cpp +++ b/libc/test/integration/src/pthread/pthread_create_test.cpp @@ -40,12 +40,12 @@ struct TestThreadArgs { pthread_attr_t attrs; void *ret; }; -static __llvm_libc::AllocChecker global_ac; -static __llvm_libc::cpp::Atomic global_thr_count = 0; +static LIBC_NAMESPACE::AllocChecker global_ac; +static LIBC_NAMESPACE::cpp::Atomic global_thr_count = 0; static void *successThread(void *Arg) { - pthread_t th = __llvm_libc::pthread_self(); - auto *thread = reinterpret_cast<__llvm_libc::Thread *>(&th); + pthread_t th = LIBC_NAMESPACE::pthread_self(); + auto *thread = reinterpret_cast(&th); ASSERT_EQ(libc_errno, 0); ASSERT_TRUE(thread); @@ -59,22 +59,23 @@ static void *successThread(void *Arg) { size_t expec_stacksize, expec_guardsize, expec_stacksize2; int expec_detached; - ASSERT_EQ(__llvm_libc::pthread_attr_getstack(expec_attrs, &expec_stack, - &expec_stacksize), + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_getstack(expec_attrs, &expec_stack, + &expec_stacksize), 0); ASSERT_EQ(libc_errno, 0); ASSERT_EQ( - __llvm_libc::pthread_attr_getstacksize(expec_attrs, &expec_stacksize2), + LIBC_NAMESPACE::pthread_attr_getstacksize(expec_attrs, &expec_stacksize2), 0); ASSERT_EQ(libc_errno, 0); ASSERT_EQ( - __llvm_libc::pthread_attr_getguardsize(expec_attrs, &expec_guardsize), 0); + LIBC_NAMESPACE::pthread_attr_getguardsize(expec_attrs, &expec_guardsize), + 0); ASSERT_EQ(libc_errno, 0); ASSERT_EQ( - __llvm_libc::pthread_attr_getdetachstate(expec_attrs, &expec_detached), + LIBC_NAMESPACE::pthread_attr_getdetachstate(expec_attrs, &expec_detached), 0); ASSERT_EQ(libc_errno, 0); @@ -96,10 +97,10 @@ static void *successThread(void *Arg) { ASSERT_EQ(expec_detached == PTHREAD_CREATE_JOINABLE, thread->attrib->detach_state.load() == - static_cast(__llvm_libc::DetachState::JOINABLE)); + static_cast(LIBC_NAMESPACE::DetachState::JOINABLE)); ASSERT_EQ(expec_detached == PTHREAD_CREATE_DETACHED, thread->attrib->detach_state.load() == - static_cast(__llvm_libc::DetachState::DETACHED)); + static_cast(LIBC_NAMESPACE::DetachState::DETACHED)); { // Allocate some bytes on the stack on most of the stack and make sure we @@ -123,7 +124,7 @@ static void *successThread(void *Arg) { // [stack - expec_guardsize, stack) is both mapped and has PROT_NONE // permissions. Maybe we can read from /proc/{self}/map? - ASSERT_EQ(__llvm_libc::pthread_attr_destroy(expec_attrs), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_destroy(expec_attrs), 0); ASSERT_EQ(libc_errno, 0); // Arg is malloced, so free. @@ -138,33 +139,33 @@ static void run_success_config(int detachstate, size_t guardsize, TestThreadArgs *th_arg = new (global_ac) TestThreadArgs{}; pthread_attr_t *attr = &(th_arg->attrs); - ASSERT_EQ(__llvm_libc::pthread_attr_init(attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(attr), 0); ASSERT_EQ(libc_errno, 0); - ASSERT_EQ(__llvm_libc::pthread_attr_setdetachstate(attr, detachstate), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setdetachstate(attr, detachstate), 0); ASSERT_EQ(libc_errno, 0); - ASSERT_EQ(__llvm_libc::pthread_attr_setguardsize(attr, guardsize), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setguardsize(attr, guardsize), 0); ASSERT_EQ(libc_errno, 0); void *Stack = nullptr; if (customstack) { - Stack = __llvm_libc::mmap(nullptr, stacksize, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + Stack = LIBC_NAMESPACE::mmap(nullptr, stacksize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); ASSERT_NE(Stack, MAP_FAILED); ASSERT_NE(Stack, static_cast(nullptr)); ASSERT_EQ(libc_errno, 0); - ASSERT_EQ(__llvm_libc::pthread_attr_setstack(attr, Stack, stacksize), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setstack(attr, Stack, stacksize), 0); ASSERT_EQ(libc_errno, 0); } else { - ASSERT_EQ(__llvm_libc::pthread_attr_setstacksize(attr, stacksize), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setstacksize(attr, stacksize), 0); ASSERT_EQ(libc_errno, 0); } void *expec_ret = nullptr; if (detachstate == PTHREAD_CREATE_JOINABLE) { - ASSERT_EQ(__llvm_libc::getrandom(&expec_ret, sizeof(expec_ret), 0), + ASSERT_EQ(LIBC_NAMESPACE::getrandom(&expec_ret, sizeof(expec_ret), 0), static_cast(sizeof(expec_ret))); ASSERT_EQ(libc_errno, 0); } @@ -174,19 +175,19 @@ static void run_success_config(int detachstate, size_t guardsize, pthread_t tid; // th_arg and attr are cleanup by the thread. - ASSERT_EQ(__llvm_libc::pthread_create(&tid, attr, successThread, - reinterpret_cast(th_arg)), + ASSERT_EQ(LIBC_NAMESPACE::pthread_create(&tid, attr, successThread, + reinterpret_cast(th_arg)), 0); ASSERT_EQ(libc_errno, 0); if (detachstate == PTHREAD_CREATE_JOINABLE) { void *th_ret; - ASSERT_EQ(__llvm_libc::pthread_join(tid, &th_ret), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_join(tid, &th_ret), 0); ASSERT_EQ(libc_errno, 0); ASSERT_EQ(th_ret, expec_ret); if (customstack) { - ASSERT_EQ(__llvm_libc::munmap(Stack, stacksize), 0); + ASSERT_EQ(LIBC_NAMESPACE::munmap(Stack, stacksize), 0); ASSERT_EQ(libc_errno, 0); } } else { @@ -197,7 +198,7 @@ static void run_success_config(int detachstate, size_t guardsize, static void run_success_tests() { // Test parameters - using __llvm_libc::cpp::array; + using LIBC_NAMESPACE::cpp::array; array detachstates = {PTHREAD_CREATE_DETACHED, PTHREAD_CREATE_JOINABLE}; @@ -253,27 +254,28 @@ static void *failure_thread(void *) { static void create_and_check_failure_thread(pthread_attr_t *attr) { pthread_t tid; - int result = __llvm_libc::pthread_create(&tid, attr, failure_thread, nullptr); + int result = + LIBC_NAMESPACE::pthread_create(&tid, attr, failure_thread, nullptr); // EINVAL if we caught on overflow or something of that nature. EAGAIN if it // was just really larger we failed mmap. ASSERT_TRUE(result == EINVAL || result == EAGAIN); // pthread_create should NOT set errno on error ASSERT_EQ(libc_errno, 0); - ASSERT_EQ(__llvm_libc::pthread_attr_destroy(attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_destroy(attr), 0); ASSERT_EQ(libc_errno, 0); } static void run_failure_config(size_t guardsize, size_t stacksize) { pthread_attr_t attr; guardsize &= -EXEC_PAGESIZE; - ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0); ASSERT_EQ(libc_errno, 0); - ASSERT_EQ(__llvm_libc::pthread_attr_setguardsize(&attr, guardsize), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setguardsize(&attr, guardsize), 0); ASSERT_EQ(libc_errno, 0); - ASSERT_EQ(__llvm_libc::pthread_attr_setstacksize(&attr, stacksize), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setstacksize(&attr, stacksize), 0); ASSERT_EQ(libc_errno, 0); create_and_check_failure_thread(&attr); @@ -298,32 +300,32 @@ static void run_failure_tests() { pthread_attr_t attr; // Stacksize too small. - ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0); ASSERT_EQ(libc_errno, 0); attr.__stacksize = PTHREAD_STACK_MIN - 16; create_and_check_failure_thread(&attr); // Stack misaligned. - ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0); ASSERT_EQ(libc_errno, 0); attr.__stack = reinterpret_cast(1); create_and_check_failure_thread(&attr); // Stack + stacksize misaligned. - ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0); ASSERT_EQ(libc_errno, 0); attr.__stacksize = PTHREAD_STACK_MIN + 1; attr.__stack = reinterpret_cast(16); create_and_check_failure_thread(&attr); // Guardsize misaligned. - ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0); ASSERT_EQ(libc_errno, 0); attr.__guardsize = EXEC_PAGESIZE / 2; create_and_check_failure_thread(&attr); // Detachstate is unknown. - ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0); ASSERT_EQ(libc_errno, 0); attr.__detachstate = -1; create_and_check_failure_thread(&attr); diff --git a/libc/test/integration/src/pthread/pthread_equal_test.cpp b/libc/test/integration/src/pthread/pthread_equal_test.cpp index 08d89892d22a94ac0032f61ffa1da2390fa8b5bf..82f5a494e1bdfb5017f034f63bcfaa332bdeda92 100644 --- a/libc/test/integration/src/pthread/pthread_equal_test.cpp +++ b/libc/test/integration/src/pthread/pthread_equal_test.cpp @@ -24,21 +24,21 @@ pthread_t child_thread; pthread_mutex_t mutex; static void *child_func(void *arg) { - __llvm_libc::pthread_mutex_lock(&mutex); + LIBC_NAMESPACE::pthread_mutex_lock(&mutex); int *ret = reinterpret_cast(arg); - auto self = __llvm_libc::pthread_self(); - *ret = __llvm_libc::pthread_equal(child_thread, self); - __llvm_libc::pthread_mutex_unlock(&mutex); + auto self = LIBC_NAMESPACE::pthread_self(); + *ret = LIBC_NAMESPACE::pthread_equal(child_thread, self); + LIBC_NAMESPACE::pthread_mutex_unlock(&mutex); return nullptr; } TEST_MAIN() { // We init and lock the mutex so that we guarantee that the child thread is // waiting after startup. - ASSERT_EQ(__llvm_libc::pthread_mutex_init(&mutex, nullptr), 0); - ASSERT_EQ(__llvm_libc::pthread_mutex_lock(&mutex), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_init(&mutex, nullptr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_lock(&mutex), 0); - auto main_thread = __llvm_libc::pthread_self(); + auto main_thread = LIBC_NAMESPACE::pthread_self(); // The idea here is that, we start a child thread which will immediately // wait on |mutex|. The main thread will update the global |child_thread| var @@ -47,22 +47,23 @@ TEST_MAIN() { // comparison is returned in the thread arg. int result = 0; pthread_t th; - ASSERT_EQ(__llvm_libc::pthread_create(&th, nullptr, child_func, &result), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_create(&th, nullptr, child_func, &result), + 0); // This new thread should of course not be equal to the main thread. - ASSERT_EQ(__llvm_libc::pthread_equal(th, main_thread), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_equal(th, main_thread), 0); // Set the |child_thread| global var and unlock to allow the child to perform // the comparison. child_thread = th; - ASSERT_EQ(__llvm_libc::pthread_mutex_unlock(&mutex), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_unlock(&mutex), 0); void *retval; - ASSERT_EQ(__llvm_libc::pthread_join(th, &retval), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_join(th, &retval), 0); ASSERT_EQ(uintptr_t(retval), uintptr_t(nullptr)); // The child thread should see that pthread_self return value is the same as // |child_thread|. ASSERT_NE(result, 0); - __llvm_libc::pthread_mutex_destroy(&mutex); + LIBC_NAMESPACE::pthread_mutex_destroy(&mutex); return 0; } diff --git a/libc/test/integration/src/pthread/pthread_exit_test.cpp b/libc/test/integration/src/pthread/pthread_exit_test.cpp index e60fe67d2a2a0bd3807709b70d9dd5955599717f..48e6c81713a4035c431c7194b86b667e7c279e5a 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 7397fa89a9f47e20cc47b44fb732515185970616..f4126357a0579dc6e051d89d9f4fa67d99d639b1 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 67300872dc60a2772f48c842143c89c8e56b494a..ce2a3538924da8416c9f27c810adc2da0aed906e 100644 --- a/libc/test/integration/src/pthread/pthread_mutex_test.cpp +++ b/libc/test/integration/src/pthread/pthread_mutex_test.cpp @@ -28,12 +28,12 @@ static int shared_int = START; void *counter(void *arg) { int last_count = START; while (true) { - __llvm_libc::pthread_mutex_lock(&mutex); + LIBC_NAMESPACE::pthread_mutex_lock(&mutex); if (shared_int == last_count + 1) { shared_int++; last_count = shared_int; } - __llvm_libc::pthread_mutex_unlock(&mutex); + LIBC_NAMESPACE::pthread_mutex_unlock(&mutex); if (last_count >= MAX) break; } @@ -41,16 +41,16 @@ void *counter(void *arg) { } void relay_counter() { - ASSERT_EQ(__llvm_libc::pthread_mutex_init(&mutex, nullptr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_init(&mutex, nullptr), 0); // The idea of this test is that two competing threads will update // a counter only if the other thread has updated it. pthread_t thread; - __llvm_libc::pthread_create(&thread, nullptr, counter, nullptr); + LIBC_NAMESPACE::pthread_create(&thread, nullptr, counter, nullptr); int last_count = START; while (true) { - ASSERT_EQ(__llvm_libc::pthread_mutex_lock(&mutex), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_lock(&mutex), 0); if (shared_int == START) { ++shared_int; last_count = shared_int; @@ -59,51 +59,51 @@ void relay_counter() { ++shared_int; last_count = shared_int; } - ASSERT_EQ(__llvm_libc::pthread_mutex_unlock(&mutex), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_unlock(&mutex), 0); if (last_count > MAX) break; } void *retval = reinterpret_cast(123); - __llvm_libc::pthread_join(thread, &retval); + LIBC_NAMESPACE::pthread_join(thread, &retval); ASSERT_EQ(uintptr_t(retval), uintptr_t(nullptr)); - __llvm_libc::pthread_mutex_destroy(&mutex); + LIBC_NAMESPACE::pthread_mutex_destroy(&mutex); } pthread_mutex_t start_lock, step_lock; bool started, step; void *stepper(void *arg) { - __llvm_libc::pthread_mutex_lock(&start_lock); + LIBC_NAMESPACE::pthread_mutex_lock(&start_lock); started = true; - __llvm_libc::pthread_mutex_unlock(&start_lock); + LIBC_NAMESPACE::pthread_mutex_unlock(&start_lock); - __llvm_libc::pthread_mutex_lock(&step_lock); + LIBC_NAMESPACE::pthread_mutex_lock(&step_lock); step = true; - __llvm_libc::pthread_mutex_unlock(&step_lock); + LIBC_NAMESPACE::pthread_mutex_unlock(&step_lock); return nullptr; } void wait_and_step() { - ASSERT_EQ(__llvm_libc::pthread_mutex_init(&start_lock, nullptr), 0); - ASSERT_EQ(__llvm_libc::pthread_mutex_init(&step_lock, nullptr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_init(&start_lock, nullptr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_init(&step_lock, nullptr), 0); // In this test, we start a new thread but block it before it can make a // step. Once we ensure that the thread is blocked, we unblock it. // After unblocking, we then verify that the thread was indeed unblocked. step = false; started = false; - ASSERT_EQ(__llvm_libc::pthread_mutex_lock(&step_lock), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_lock(&step_lock), 0); pthread_t thread; - __llvm_libc::pthread_create(&thread, nullptr, stepper, nullptr); + LIBC_NAMESPACE::pthread_create(&thread, nullptr, stepper, nullptr); while (true) { // Make sure the thread actually started. - ASSERT_EQ(__llvm_libc::pthread_mutex_lock(&start_lock), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_lock(&start_lock), 0); bool s = started; - ASSERT_EQ(__llvm_libc::pthread_mutex_unlock(&start_lock), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_unlock(&start_lock), 0); if (s) break; } @@ -112,22 +112,22 @@ void wait_and_step() { ASSERT_FALSE(step); // Unlock the step lock and wait until the step is made. - ASSERT_EQ(__llvm_libc::pthread_mutex_unlock(&step_lock), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_unlock(&step_lock), 0); while (true) { - ASSERT_EQ(__llvm_libc::pthread_mutex_lock(&step_lock), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_lock(&step_lock), 0); bool current_step_value = step; - ASSERT_EQ(__llvm_libc::pthread_mutex_unlock(&step_lock), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_unlock(&step_lock), 0); if (current_step_value) break; } void *retval = reinterpret_cast(123); - __llvm_libc::pthread_join(thread, &retval); + LIBC_NAMESPACE::pthread_join(thread, &retval); ASSERT_EQ(uintptr_t(retval), uintptr_t(nullptr)); - __llvm_libc::pthread_mutex_destroy(&start_lock); - __llvm_libc::pthread_mutex_destroy(&step_lock); + LIBC_NAMESPACE::pthread_mutex_destroy(&start_lock); + LIBC_NAMESPACE::pthread_mutex_destroy(&step_lock); } static constexpr int THREAD_COUNT = 10; @@ -136,54 +136,54 @@ static pthread_mutex_t counter_lock; static int wait_count = 0; void *waiter_func(void *) { - __llvm_libc::pthread_mutex_lock(&counter_lock); + LIBC_NAMESPACE::pthread_mutex_lock(&counter_lock); ++wait_count; - __llvm_libc::pthread_mutex_unlock(&counter_lock); + LIBC_NAMESPACE::pthread_mutex_unlock(&counter_lock); // Block on the waiter lock until the main // thread unblocks. - __llvm_libc::pthread_mutex_lock(&multiple_waiter_lock); - __llvm_libc::pthread_mutex_unlock(&multiple_waiter_lock); + LIBC_NAMESPACE::pthread_mutex_lock(&multiple_waiter_lock); + LIBC_NAMESPACE::pthread_mutex_unlock(&multiple_waiter_lock); - __llvm_libc::pthread_mutex_lock(&counter_lock); + LIBC_NAMESPACE::pthread_mutex_lock(&counter_lock); --wait_count; - __llvm_libc::pthread_mutex_unlock(&counter_lock); + LIBC_NAMESPACE::pthread_mutex_unlock(&counter_lock); return nullptr; } void multiple_waiters() { - __llvm_libc::pthread_mutex_init(&multiple_waiter_lock, nullptr); - __llvm_libc::pthread_mutex_init(&counter_lock, nullptr); + LIBC_NAMESPACE::pthread_mutex_init(&multiple_waiter_lock, nullptr); + LIBC_NAMESPACE::pthread_mutex_init(&counter_lock, nullptr); - __llvm_libc::pthread_mutex_lock(&multiple_waiter_lock); + LIBC_NAMESPACE::pthread_mutex_lock(&multiple_waiter_lock); pthread_t waiters[THREAD_COUNT]; for (int i = 0; i < THREAD_COUNT; ++i) { - __llvm_libc::pthread_create(waiters + i, nullptr, waiter_func, nullptr); + LIBC_NAMESPACE::pthread_create(waiters + i, nullptr, waiter_func, nullptr); } // Spin until the counter is incremented to the desired // value. while (true) { - __llvm_libc::pthread_mutex_lock(&counter_lock); + LIBC_NAMESPACE::pthread_mutex_lock(&counter_lock); if (wait_count == THREAD_COUNT) { - __llvm_libc::pthread_mutex_unlock(&counter_lock); + LIBC_NAMESPACE::pthread_mutex_unlock(&counter_lock); break; } - __llvm_libc::pthread_mutex_unlock(&counter_lock); + LIBC_NAMESPACE::pthread_mutex_unlock(&counter_lock); } - __llvm_libc::pthread_mutex_unlock(&multiple_waiter_lock); + LIBC_NAMESPACE::pthread_mutex_unlock(&multiple_waiter_lock); void *retval; for (int i = 0; i < THREAD_COUNT; ++i) { - __llvm_libc::pthread_join(waiters[i], &retval); + LIBC_NAMESPACE::pthread_join(waiters[i], &retval); } ASSERT_EQ(wait_count, 0); - __llvm_libc::pthread_mutex_destroy(&multiple_waiter_lock); - __llvm_libc::pthread_mutex_destroy(&counter_lock); + LIBC_NAMESPACE::pthread_mutex_destroy(&multiple_waiter_lock); + LIBC_NAMESPACE::pthread_mutex_destroy(&counter_lock); } TEST_MAIN() { diff --git a/libc/test/integration/src/pthread/pthread_name_test.cpp b/libc/test/integration/src/pthread/pthread_name_test.cpp index fa227b3074988b2da4545e3e6d5065a73582bb46..d341792d11d6cbc9a26e727a7a6ff8dbe3b43e0b 100644 --- a/libc/test/integration/src/pthread/pthread_name_test.cpp +++ b/libc/test/integration/src/pthread/pthread_name_test.cpp @@ -23,60 +23,64 @@ #include #include // uintptr_t -using string_view = __llvm_libc::cpp::string_view; +using string_view = LIBC_NAMESPACE::cpp::string_view; char child_thread_name_buffer[16]; pthread_mutex_t mutex; static void *child_func(void *) { - __llvm_libc::pthread_mutex_lock(&mutex); - auto self = __llvm_libc::pthread_self(); - __llvm_libc::pthread_getname_np(self, child_thread_name_buffer, 16); - __llvm_libc::pthread_mutex_unlock(&mutex); + LIBC_NAMESPACE::pthread_mutex_lock(&mutex); + auto self = LIBC_NAMESPACE::pthread_self(); + LIBC_NAMESPACE::pthread_getname_np(self, child_thread_name_buffer, 16); + LIBC_NAMESPACE::pthread_mutex_unlock(&mutex); return nullptr; } TEST_MAIN() { // We init and lock the mutex so that we guarantee that the child thread is // waiting after startup. - ASSERT_EQ(__llvm_libc::pthread_mutex_init(&mutex, nullptr), 0); - ASSERT_EQ(__llvm_libc::pthread_mutex_lock(&mutex), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_init(&mutex, nullptr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_lock(&mutex), 0); - auto main_thread = __llvm_libc::pthread_self(); + auto main_thread = LIBC_NAMESPACE::pthread_self(); const char MAIN_THREAD_NAME[] = "main_thread"; char thread_name_buffer[16]; - ASSERT_EQ(__llvm_libc::pthread_setname_np(main_thread, MAIN_THREAD_NAME), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_setname_np(main_thread, MAIN_THREAD_NAME), + 0); ASSERT_EQ( - __llvm_libc::pthread_getname_np(main_thread, thread_name_buffer, 16), 0); + LIBC_NAMESPACE::pthread_getname_np(main_thread, thread_name_buffer, 16), + 0); ASSERT_EQ(string_view(MAIN_THREAD_NAME), string_view(reinterpret_cast(thread_name_buffer))); pthread_t th; - ASSERT_EQ(__llvm_libc::pthread_create(&th, nullptr, child_func, nullptr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_create(&th, nullptr, child_func, nullptr), + 0); // This new thread should of course not be equal to the main thread. const char CHILD_THREAD_NAME[] = "child_thread"; - ASSERT_EQ(__llvm_libc::pthread_setname_np(th, CHILD_THREAD_NAME), 0); - ASSERT_EQ(__llvm_libc::pthread_getname_np(th, thread_name_buffer, 16), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_setname_np(th, CHILD_THREAD_NAME), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_getname_np(th, thread_name_buffer, 16), 0); ASSERT_EQ(string_view(CHILD_THREAD_NAME), string_view(reinterpret_cast(thread_name_buffer))); - ASSERT_EQ(__llvm_libc::pthread_mutex_unlock(&mutex), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_unlock(&mutex), 0); void *retval; - ASSERT_EQ(__llvm_libc::pthread_join(th, &retval), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_join(th, &retval), 0); ASSERT_EQ(uintptr_t(retval), uintptr_t(nullptr)); // Make sure that the child thread saw it name correctly. ASSERT_EQ( string_view(CHILD_THREAD_NAME), string_view(reinterpret_cast(child_thread_name_buffer))); - __llvm_libc::pthread_mutex_destroy(&mutex); + LIBC_NAMESPACE::pthread_mutex_destroy(&mutex); - ASSERT_EQ(__llvm_libc::pthread_setname_np(main_thread, - "a really long name for a thread"), + ASSERT_EQ(LIBC_NAMESPACE::pthread_setname_np( + main_thread, "a really long name for a thread"), ERANGE); char smallbuf[1]; - ASSERT_EQ(__llvm_libc::pthread_getname_np(main_thread, smallbuf, 1), ERANGE); + ASSERT_EQ(LIBC_NAMESPACE::pthread_getname_np(main_thread, smallbuf, 1), + ERANGE); return 0; } diff --git a/libc/test/integration/src/pthread/pthread_once_test.cpp b/libc/test/integration/src/pthread/pthread_once_test.cpp index 201982460c5ea29306d2de9d560c662e0795445b..8e0f234ee8c6b13962e6170db9974e7f41d29662 100644 --- a/libc/test/integration/src/pthread/pthread_once_test.cpp +++ b/libc/test/integration/src/pthread/pthread_once_test.cpp @@ -21,14 +21,14 @@ #include // uintptr_t static constexpr unsigned int NUM_THREADS = 5; -static __llvm_libc::cpp::Atomic thread_count; +static LIBC_NAMESPACE::cpp::Atomic thread_count; static unsigned int call_count; static void pthread_once_func() { ++call_count; } static void *func(void *) { static pthread_once_t flag = PTHREAD_ONCE_INIT; - ASSERT_EQ(__llvm_libc::pthread_once(&flag, pthread_once_func), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_once(&flag, pthread_once_func), 0); thread_count.fetch_add(1); @@ -42,13 +42,13 @@ void call_from_5_threads() { pthread_t threads[NUM_THREADS]; for (unsigned int i = 0; i < NUM_THREADS; ++i) { - ASSERT_EQ(__llvm_libc::pthread_create(threads + i, nullptr, func, nullptr), - 0); + ASSERT_EQ( + LIBC_NAMESPACE::pthread_create(threads + i, nullptr, func, nullptr), 0); } for (unsigned int i = 0; i < NUM_THREADS; ++i) { void *retval; - ASSERT_EQ(__llvm_libc::pthread_join(threads[i], &retval), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_join(threads[i], &retval), 0); ASSERT_EQ(uintptr_t(retval), uintptr_t(0)); } @@ -58,16 +58,16 @@ void call_from_5_threads() { static pthread_mutex_t once_func_blocker; static void blocking_once_func() { - __llvm_libc::pthread_mutex_lock(&once_func_blocker); - __llvm_libc::pthread_mutex_unlock(&once_func_blocker); + LIBC_NAMESPACE::pthread_mutex_lock(&once_func_blocker); + LIBC_NAMESPACE::pthread_mutex_unlock(&once_func_blocker); } -static __llvm_libc::cpp::Atomic start_count; -static __llvm_libc::cpp::Atomic done_count; +static LIBC_NAMESPACE::cpp::Atomic start_count; +static LIBC_NAMESPACE::cpp::Atomic done_count; static void *once_func_caller(void *) { static pthread_once_t flag; start_count.fetch_add(1); - __llvm_libc::pthread_once(&flag, blocking_once_func); + LIBC_NAMESPACE::pthread_once(&flag, blocking_once_func); done_count.fetch_add(1); return nullptr; } @@ -79,15 +79,17 @@ void test_synchronization() { start_count = 0; done_count = 0; - ASSERT_EQ(__llvm_libc::pthread_mutex_init(&once_func_blocker, nullptr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_init(&once_func_blocker, nullptr), 0); // Lock the blocking mutex so that the once func blocks. - ASSERT_EQ(__llvm_libc::pthread_mutex_lock(&once_func_blocker), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_lock(&once_func_blocker), 0); pthread_t t1, t2; ASSERT_EQ( - __llvm_libc::pthread_create(&t1, nullptr, once_func_caller, nullptr), 0); + LIBC_NAMESPACE::pthread_create(&t1, nullptr, once_func_caller, nullptr), + 0); ASSERT_EQ( - __llvm_libc::pthread_create(&t2, nullptr, once_func_caller, nullptr), 0); + LIBC_NAMESPACE::pthread_create(&t2, nullptr, once_func_caller, nullptr), + 0); while (start_count.load() != 2) ; // Spin until both threads start. @@ -96,17 +98,17 @@ void test_synchronization() { EXPECT_EQ(done_count.val, 0U); // Unlock the blocking mutex so that the once func blocks. - ASSERT_EQ(__llvm_libc::pthread_mutex_unlock(&once_func_blocker), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_mutex_unlock(&once_func_blocker), 0); void *retval; - ASSERT_EQ(__llvm_libc::pthread_join(t1, &retval), uintptr_t(0)); + ASSERT_EQ(LIBC_NAMESPACE::pthread_join(t1, &retval), uintptr_t(0)); ASSERT_EQ(uintptr_t(retval), 0); - ASSERT_EQ(__llvm_libc::pthread_join(t2, &retval), uintptr_t(0)); + ASSERT_EQ(LIBC_NAMESPACE::pthread_join(t2, &retval), uintptr_t(0)); ASSERT_EQ(uintptr_t(retval), 0); ASSERT_EQ(done_count.val, 2U); - __llvm_libc::pthread_mutex_destroy(&once_func_blocker); + LIBC_NAMESPACE::pthread_mutex_destroy(&once_func_blocker); } TEST_MAIN() { diff --git a/libc/test/integration/src/pthread/pthread_test.cpp b/libc/test/integration/src/pthread/pthread_test.cpp index fa6a828d9208b956fa2efeeef74cca49801c3817..3565a7cb08685ace13c6e3cfd552e23074ff5ab5 100644 --- a/libc/test/integration/src/pthread/pthread_test.cpp +++ b/libc/test/integration/src/pthread/pthread_test.cpp @@ -25,11 +25,12 @@ void create_and_join() { pthread_t thread; int old_counter_val = counter; ASSERT_EQ( - __llvm_libc::pthread_create(&thread, nullptr, thread_func, nullptr), 0); + LIBC_NAMESPACE::pthread_create(&thread, nullptr, thread_func, nullptr), + 0); // Start with a retval we dont expect. void *retval = reinterpret_cast(thread_count + 1); - ASSERT_EQ(__llvm_libc::pthread_join(thread, &retval), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_join(thread, &retval), 0); ASSERT_EQ(uintptr_t(retval), uintptr_t(nullptr)); ASSERT_EQ(counter, old_counter_val + 1); } @@ -43,15 +44,15 @@ void spawn_and_join() { for (int i = 0; i < thread_count; ++i) { args[i] = i; - ASSERT_EQ(__llvm_libc::pthread_create(thread_list + i, nullptr, return_arg, - args + i), + ASSERT_EQ(LIBC_NAMESPACE::pthread_create(thread_list + i, nullptr, + return_arg, args + i), 0); } for (int i = 0; i < thread_count; ++i) { // Start with a retval we dont expect. void *retval = reinterpret_cast(thread_count + 1); - ASSERT_EQ(__llvm_libc::pthread_join(thread_list[i], &retval), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_join(thread_list[i], &retval), 0); ASSERT_EQ(*reinterpret_cast(retval), i); } } diff --git a/libc/test/integration/src/pthread/pthread_tss_test.cpp b/libc/test/integration/src/pthread/pthread_tss_test.cpp index b5843d226ff10ffb3865939d9533eea21836540b..c90525a0000ee158f8bcba119f4ea0da23fb4ff9 100644 --- a/libc/test/integration/src/pthread/pthread_tss_test.cpp +++ b/libc/test/integration/src/pthread/pthread_tss_test.cpp @@ -34,8 +34,8 @@ static void dtor(void *data) { static void dtor_failure(void *) { ASSERT_TRUE(false); } static void *func(void *obj) { - ASSERT_EQ(__llvm_libc::pthread_setspecific(key, &child_thread_data), 0); - int *d = reinterpret_cast(__llvm_libc::pthread_getspecific(key)); + ASSERT_EQ(LIBC_NAMESPACE::pthread_setspecific(key, &child_thread_data), 0); + int *d = reinterpret_cast(LIBC_NAMESPACE::pthread_getspecific(key)); ASSERT_TRUE(d != nullptr); ASSERT_EQ(&child_thread_data, d); ASSERT_EQ(*d, THREAD_DATA_INITVAL); @@ -45,37 +45,37 @@ static void *func(void *obj) { static void *func_null_val(void *) { // null value, we should not call dtor - ASSERT_EQ(__llvm_libc::pthread_setspecific(key, nullptr), 0); - ASSERT_EQ(__llvm_libc::pthread_getspecific(key), nullptr); + ASSERT_EQ(LIBC_NAMESPACE::pthread_setspecific(key, nullptr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_getspecific(key), nullptr); return nullptr; } static void standard_usage_test() { - ASSERT_EQ(__llvm_libc::pthread_key_create(&key, &dtor), 0); - ASSERT_EQ(__llvm_libc::pthread_setspecific(key, &main_thread_data), 0); - int *d = reinterpret_cast(__llvm_libc::pthread_getspecific(key)); + ASSERT_EQ(LIBC_NAMESPACE::pthread_key_create(&key, &dtor), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_setspecific(key, &main_thread_data), 0); + int *d = reinterpret_cast(LIBC_NAMESPACE::pthread_getspecific(key)); ASSERT_TRUE(d != nullptr); ASSERT_EQ(&main_thread_data, d); ASSERT_EQ(*d, THREAD_DATA_INITVAL); pthread_t th; int arg = 0xBAD; - ASSERT_EQ(__llvm_libc::pthread_create(&th, nullptr, &func, &arg), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_create(&th, nullptr, &func, &arg), 0); void *retval = &child_thread_data; // Init to some non-nullptr val. - ASSERT_EQ(__llvm_libc::pthread_join(th, &retval), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_join(th, &retval), 0); ASSERT_EQ(retval, nullptr); ASSERT_EQ(arg, THREAD_RUN_VAL); ASSERT_EQ(child_thread_data, THREAD_DATA_FINIVAL); - ASSERT_EQ(__llvm_libc::pthread_key_delete(key), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_key_delete(key), 0); } static void null_value_test() { pthread_t th; - ASSERT_EQ(__llvm_libc::pthread_key_create(&key, &dtor_failure), 0); - ASSERT_EQ(__llvm_libc::pthread_create(&th, nullptr, &func_null_val, nullptr), - 0); - ASSERT_EQ(__llvm_libc::pthread_join(th, nullptr), 0); - ASSERT_EQ(__llvm_libc::pthread_key_delete(key), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_key_create(&key, &dtor_failure), 0); + ASSERT_EQ( + LIBC_NAMESPACE::pthread_create(&th, nullptr, &func_null_val, nullptr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_join(th, nullptr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_key_delete(key), 0); } TEST_MAIN() { diff --git a/libc/test/integration/src/spawn/posix_spawn_test.cpp b/libc/test/integration/src/spawn/posix_spawn_test.cpp index 69b60a4138762a943d9701ea93bd53b9087f67a3..104096c40c3abecb98860b8eddc21450dcba3741 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 117a059ecfe0906bc39c764c8aad31c4dc70b01b..833159436d49cbeb05384500a0f56bbf71f21e16 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 9c292bfaebf1f3f50c01d4c7d50c07dbe818a0c2..82a9b89533d2eb5ccfb83223ad7abd5c3396f569 100644 --- a/libc/test/integration/src/stdlib/getenv_test.cpp +++ b/libc/test/integration/src/stdlib/getenv_test.cpp @@ -28,19 +28,21 @@ static bool my_streq(const char *lhs, const char *rhs) { } TEST_MAIN(int argc, char **argv, char **envp) { - ASSERT_TRUE(my_streq(__llvm_libc::getenv(""), static_cast(nullptr))); - ASSERT_TRUE(my_streq(__llvm_libc::getenv("="), static_cast(nullptr))); - ASSERT_TRUE(my_streq(__llvm_libc::getenv("MISSING ENV VARIABLE"), + ASSERT_TRUE( + my_streq(LIBC_NAMESPACE::getenv(""), static_cast(nullptr))); + ASSERT_TRUE( + my_streq(LIBC_NAMESPACE::getenv("="), static_cast(nullptr))); + ASSERT_TRUE(my_streq(LIBC_NAMESPACE::getenv("MISSING ENV VARIABLE"), static_cast(nullptr))); ASSERT_FALSE( - my_streq(__llvm_libc::getenv("PATH"), static_cast(nullptr))); - ASSERT_TRUE(my_streq(__llvm_libc::getenv("FRANCE"), "Paris")); - ASSERT_FALSE(my_streq(__llvm_libc::getenv("FRANCE"), "Berlin")); - ASSERT_TRUE(my_streq(__llvm_libc::getenv("GERMANY"), "Berlin")); + my_streq(LIBC_NAMESPACE::getenv("PATH"), static_cast(nullptr))); + ASSERT_TRUE(my_streq(LIBC_NAMESPACE::getenv("FRANCE"), "Paris")); + ASSERT_FALSE(my_streq(LIBC_NAMESPACE::getenv("FRANCE"), "Berlin")); + ASSERT_TRUE(my_streq(LIBC_NAMESPACE::getenv("GERMANY"), "Berlin")); ASSERT_TRUE( - my_streq(__llvm_libc::getenv("FRANC"), static_cast(nullptr))); - ASSERT_TRUE( - my_streq(__llvm_libc::getenv("FRANCE1"), static_cast(nullptr))); + my_streq(LIBC_NAMESPACE::getenv("FRANC"), static_cast(nullptr))); + ASSERT_TRUE(my_streq(LIBC_NAMESPACE::getenv("FRANCE1"), + static_cast(nullptr))); return 0; } diff --git a/libc/test/integration/src/threads/call_once_test.cpp b/libc/test/integration/src/threads/call_once_test.cpp index a84eca2e5b0bb4d291fdc7bff7927b6407dfb243..efb920d00723a4d9d0ea12cc859393cd2c53c757 100644 --- a/libc/test/integration/src/threads/call_once_test.cpp +++ b/libc/test/integration/src/threads/call_once_test.cpp @@ -20,14 +20,14 @@ #include static constexpr unsigned int NUM_THREADS = 5; -static __llvm_libc::cpp::Atomic thread_count; +static LIBC_NAMESPACE::cpp::Atomic thread_count; static unsigned int call_count; static void call_once_func() { ++call_count; } static int func(void *) { static once_flag flag = ONCE_FLAG_INIT; - __llvm_libc::call_once(&flag, call_once_func); + LIBC_NAMESPACE::call_once(&flag, call_once_func); thread_count.fetch_add(1); @@ -41,13 +41,13 @@ void call_from_5_threads() { thrd_t threads[NUM_THREADS]; for (unsigned int i = 0; i < NUM_THREADS; ++i) { - ASSERT_EQ(__llvm_libc::thrd_create(threads + i, func, nullptr), + ASSERT_EQ(LIBC_NAMESPACE::thrd_create(threads + i, func, nullptr), static_cast(thrd_success)); } for (unsigned int i = 0; i < NUM_THREADS; ++i) { int retval; - ASSERT_EQ(__llvm_libc::thrd_join(threads[i], &retval), + ASSERT_EQ(LIBC_NAMESPACE::thrd_join(threads[i], &retval), static_cast(thrd_success)); ASSERT_EQ(retval, 0); } @@ -58,16 +58,16 @@ void call_from_5_threads() { static mtx_t once_func_blocker; static void blocking_once_func() { - __llvm_libc::mtx_lock(&once_func_blocker); - __llvm_libc::mtx_unlock(&once_func_blocker); + LIBC_NAMESPACE::mtx_lock(&once_func_blocker); + LIBC_NAMESPACE::mtx_unlock(&once_func_blocker); } -static __llvm_libc::cpp::Atomic start_count; -static __llvm_libc::cpp::Atomic done_count; +static LIBC_NAMESPACE::cpp::Atomic start_count; +static LIBC_NAMESPACE::cpp::Atomic done_count; static int once_func_caller(void *) { static once_flag flag; start_count.fetch_add(1); - __llvm_libc::call_once(&flag, blocking_once_func); + LIBC_NAMESPACE::call_once(&flag, blocking_once_func); done_count.fetch_add(1); return 0; } @@ -79,16 +79,16 @@ void test_synchronization() { start_count = 0; done_count = 0; - ASSERT_EQ(__llvm_libc::mtx_init(&once_func_blocker, mtx_plain), + ASSERT_EQ(LIBC_NAMESPACE::mtx_init(&once_func_blocker, mtx_plain), static_cast(thrd_success)); // Lock the blocking mutex so that the once func blocks. - ASSERT_EQ(__llvm_libc::mtx_lock(&once_func_blocker), + ASSERT_EQ(LIBC_NAMESPACE::mtx_lock(&once_func_blocker), static_cast(thrd_success)); thrd_t t1, t2; - ASSERT_EQ(__llvm_libc::thrd_create(&t1, once_func_caller, nullptr), + ASSERT_EQ(LIBC_NAMESPACE::thrd_create(&t1, once_func_caller, nullptr), static_cast(thrd_success)); - ASSERT_EQ(__llvm_libc::thrd_create(&t2, once_func_caller, nullptr), + ASSERT_EQ(LIBC_NAMESPACE::thrd_create(&t2, once_func_caller, nullptr), static_cast(thrd_success)); while (start_count.load() != 2) @@ -98,20 +98,20 @@ void test_synchronization() { EXPECT_EQ(done_count.val, 0U); // Unlock the blocking mutex so that the once func blocks. - ASSERT_EQ(__llvm_libc::mtx_unlock(&once_func_blocker), + ASSERT_EQ(LIBC_NAMESPACE::mtx_unlock(&once_func_blocker), static_cast(thrd_success)); int retval; - ASSERT_EQ(__llvm_libc::thrd_join(t1, &retval), + ASSERT_EQ(LIBC_NAMESPACE::thrd_join(t1, &retval), static_cast(thrd_success)); ASSERT_EQ(retval, 0); - ASSERT_EQ(__llvm_libc::thrd_join(t2, &retval), + ASSERT_EQ(LIBC_NAMESPACE::thrd_join(t2, &retval), static_cast(thrd_success)); ASSERT_EQ(retval, 0); ASSERT_EQ(done_count.val, 2U); - __llvm_libc::mtx_destroy(&once_func_blocker); + LIBC_NAMESPACE::mtx_destroy(&once_func_blocker); } TEST_MAIN() { diff --git a/libc/test/integration/src/threads/cnd_test.cpp b/libc/test/integration/src/threads/cnd_test.cpp index ecc04ffa780eb479a7d92a1050434db1fd55066a..8791c6adbaa69f3e80a430d93521181c4d229fb1 100644 --- a/libc/test/integration/src/threads/cnd_test.cpp +++ b/libc/test/integration/src/threads/cnd_test.cpp @@ -37,56 +37,56 @@ namespace wait_notify_broadcast_test { constexpr unsigned int THRD_COUNT = 1000; -static __llvm_libc::cpp::Atomic broadcast_count(0); +static LIBC_NAMESPACE::cpp::Atomic broadcast_count(0); static cnd_t broadcast_cnd, threads_ready_cnd; static mtx_t broadcast_mtx, threads_ready_mtx; int broadcast_thread_func(void *) { - __llvm_libc::mtx_lock(&broadcast_mtx); + LIBC_NAMESPACE::mtx_lock(&broadcast_mtx); unsigned oldval = broadcast_count.fetch_add(1); if (oldval == THRD_COUNT - 1) { - __llvm_libc::mtx_lock(&threads_ready_mtx); - __llvm_libc::cnd_signal(&threads_ready_cnd); - __llvm_libc::mtx_unlock(&threads_ready_mtx); + LIBC_NAMESPACE::mtx_lock(&threads_ready_mtx); + LIBC_NAMESPACE::cnd_signal(&threads_ready_cnd); + LIBC_NAMESPACE::mtx_unlock(&threads_ready_mtx); } - __llvm_libc::cnd_wait(&broadcast_cnd, &broadcast_mtx); - __llvm_libc::mtx_unlock(&broadcast_mtx); + LIBC_NAMESPACE::cnd_wait(&broadcast_cnd, &broadcast_mtx); + LIBC_NAMESPACE::mtx_unlock(&broadcast_mtx); broadcast_count.fetch_sub(1); return 0; } void wait_notify_broadcast_test() { - __llvm_libc::cnd_init(&broadcast_cnd); - __llvm_libc::cnd_init(&threads_ready_cnd); - __llvm_libc::mtx_init(&broadcast_mtx, mtx_plain); - __llvm_libc::mtx_init(&threads_ready_mtx, mtx_plain); + LIBC_NAMESPACE::cnd_init(&broadcast_cnd); + LIBC_NAMESPACE::cnd_init(&threads_ready_cnd); + LIBC_NAMESPACE::mtx_init(&broadcast_mtx, mtx_plain); + LIBC_NAMESPACE::mtx_init(&threads_ready_mtx, mtx_plain); - __llvm_libc::mtx_lock(&threads_ready_mtx); + LIBC_NAMESPACE::mtx_lock(&threads_ready_mtx); thrd_t threads[THRD_COUNT]; for (unsigned int i = 0; i < THRD_COUNT; ++i) - __llvm_libc::thrd_create(&threads[i], broadcast_thread_func, nullptr); + LIBC_NAMESPACE::thrd_create(&threads[i], broadcast_thread_func, nullptr); - __llvm_libc::cnd_wait(&threads_ready_cnd, &threads_ready_mtx); - __llvm_libc::mtx_unlock(&threads_ready_mtx); + LIBC_NAMESPACE::cnd_wait(&threads_ready_cnd, &threads_ready_mtx); + LIBC_NAMESPACE::mtx_unlock(&threads_ready_mtx); - __llvm_libc::mtx_lock(&broadcast_mtx); + LIBC_NAMESPACE::mtx_lock(&broadcast_mtx); ASSERT_EQ(broadcast_count.val, THRD_COUNT); - __llvm_libc::cnd_broadcast(&broadcast_cnd); - __llvm_libc::mtx_unlock(&broadcast_mtx); + LIBC_NAMESPACE::cnd_broadcast(&broadcast_cnd); + LIBC_NAMESPACE::mtx_unlock(&broadcast_mtx); for (unsigned int i = 0; i < THRD_COUNT; ++i) { int retval = 0xBAD; - __llvm_libc::thrd_join(threads[i], &retval); + LIBC_NAMESPACE::thrd_join(threads[i], &retval); ASSERT_EQ(retval, 0); } ASSERT_EQ(broadcast_count.val, 0U); - __llvm_libc::cnd_destroy(&broadcast_cnd); - __llvm_libc::cnd_destroy(&threads_ready_cnd); - __llvm_libc::mtx_destroy(&broadcast_mtx); - __llvm_libc::mtx_destroy(&threads_ready_mtx); + LIBC_NAMESPACE::cnd_destroy(&broadcast_cnd); + LIBC_NAMESPACE::cnd_destroy(&threads_ready_cnd); + LIBC_NAMESPACE::mtx_destroy(&broadcast_mtx); + LIBC_NAMESPACE::mtx_destroy(&threads_ready_mtx); } } // namespace wait_notify_broadcast_test @@ -101,46 +101,47 @@ mtx_t waiter_mtx, main_thread_mtx; cnd_t waiter_cnd, main_thread_cnd; int waiter_thread_func(void *unused) { - __llvm_libc::mtx_lock(&waiter_mtx); + LIBC_NAMESPACE::mtx_lock(&waiter_mtx); - __llvm_libc::mtx_lock(&main_thread_mtx); - __llvm_libc::cnd_signal(&main_thread_cnd); - __llvm_libc::mtx_unlock(&main_thread_mtx); + LIBC_NAMESPACE::mtx_lock(&main_thread_mtx); + LIBC_NAMESPACE::cnd_signal(&main_thread_cnd); + LIBC_NAMESPACE::mtx_unlock(&main_thread_mtx); - __llvm_libc::cnd_wait(&waiter_cnd, &waiter_mtx); - __llvm_libc::mtx_unlock(&waiter_mtx); + LIBC_NAMESPACE::cnd_wait(&waiter_cnd, &waiter_mtx); + LIBC_NAMESPACE::mtx_unlock(&waiter_mtx); return 0x600D; } void single_waiter_test() { - ASSERT_EQ(__llvm_libc::mtx_init(&waiter_mtx, mtx_plain), int(thrd_success)); - ASSERT_EQ(__llvm_libc::mtx_init(&main_thread_mtx, mtx_plain), + ASSERT_EQ(LIBC_NAMESPACE::mtx_init(&waiter_mtx, mtx_plain), int(thrd_success)); - ASSERT_EQ(__llvm_libc::cnd_init(&waiter_cnd), int(thrd_success)); - ASSERT_EQ(__llvm_libc::cnd_init(&main_thread_cnd), int(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::mtx_init(&main_thread_mtx, mtx_plain), + int(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::cnd_init(&waiter_cnd), int(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::cnd_init(&main_thread_cnd), int(thrd_success)); - ASSERT_EQ(__llvm_libc::mtx_lock(&main_thread_mtx), int(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::mtx_lock(&main_thread_mtx), int(thrd_success)); thrd_t waiter_thread; - __llvm_libc::thrd_create(&waiter_thread, waiter_thread_func, nullptr); + LIBC_NAMESPACE::thrd_create(&waiter_thread, waiter_thread_func, nullptr); - ASSERT_EQ(__llvm_libc::cnd_wait(&main_thread_cnd, &main_thread_mtx), + ASSERT_EQ(LIBC_NAMESPACE::cnd_wait(&main_thread_cnd, &main_thread_mtx), int(thrd_success)); - ASSERT_EQ(__llvm_libc::mtx_unlock(&main_thread_mtx), int(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::mtx_unlock(&main_thread_mtx), int(thrd_success)); - ASSERT_EQ(__llvm_libc::mtx_lock(&waiter_mtx), int(thrd_success)); - ASSERT_EQ(__llvm_libc::cnd_signal(&waiter_cnd), int(thrd_success)); - ASSERT_EQ(__llvm_libc::mtx_unlock(&waiter_mtx), int(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::mtx_lock(&waiter_mtx), int(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::cnd_signal(&waiter_cnd), int(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::mtx_unlock(&waiter_mtx), int(thrd_success)); int retval; - __llvm_libc::thrd_join(waiter_thread, &retval); + LIBC_NAMESPACE::thrd_join(waiter_thread, &retval); ASSERT_EQ(retval, 0x600D); - __llvm_libc::mtx_destroy(&waiter_mtx); - __llvm_libc::mtx_destroy(&main_thread_mtx); - __llvm_libc::cnd_destroy(&waiter_cnd); - __llvm_libc::cnd_destroy(&main_thread_cnd); + LIBC_NAMESPACE::mtx_destroy(&waiter_mtx); + LIBC_NAMESPACE::mtx_destroy(&main_thread_mtx); + LIBC_NAMESPACE::cnd_destroy(&waiter_cnd); + LIBC_NAMESPACE::cnd_destroy(&main_thread_cnd); } } // namespace single_waiter_test diff --git a/libc/test/integration/src/threads/mtx_test.cpp b/libc/test/integration/src/threads/mtx_test.cpp index 5887e1132f56b12d3961b7f035f43296c0dc1800..82b0350af97afc9191a47f3a436a014814f9f881 100644 --- a/libc/test/integration/src/threads/mtx_test.cpp +++ b/libc/test/integration/src/threads/mtx_test.cpp @@ -26,12 +26,12 @@ static int shared_int = START; int counter(void *arg) { int last_count = START; while (true) { - __llvm_libc::mtx_lock(&mutex); + LIBC_NAMESPACE::mtx_lock(&mutex); if (shared_int == last_count + 1) { shared_int++; last_count = shared_int; } - __llvm_libc::mtx_unlock(&mutex); + LIBC_NAMESPACE::mtx_unlock(&mutex); if (last_count >= MAX) break; } @@ -39,17 +39,17 @@ int counter(void *arg) { } void relay_counter() { - ASSERT_EQ(__llvm_libc::mtx_init(&mutex, mtx_plain), + ASSERT_EQ(LIBC_NAMESPACE::mtx_init(&mutex, mtx_plain), static_cast(thrd_success)); // The idea of this test is that two competing threads will update // a counter only if the other thread has updated it. thrd_t thread; - __llvm_libc::thrd_create(&thread, counter, nullptr); + LIBC_NAMESPACE::thrd_create(&thread, counter, nullptr); int last_count = START; while (true) { - ASSERT_EQ(__llvm_libc::mtx_lock(&mutex), static_cast(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::mtx_lock(&mutex), static_cast(thrd_success)); if (shared_int == START) { ++shared_int; last_count = shared_int; @@ -58,36 +58,37 @@ void relay_counter() { ++shared_int; last_count = shared_int; } - ASSERT_EQ(__llvm_libc::mtx_unlock(&mutex), static_cast(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::mtx_unlock(&mutex), + static_cast(thrd_success)); if (last_count > MAX) break; } int retval = 123; - __llvm_libc::thrd_join(thread, &retval); + LIBC_NAMESPACE::thrd_join(thread, &retval); ASSERT_EQ(retval, 0); - __llvm_libc::mtx_destroy(&mutex); + LIBC_NAMESPACE::mtx_destroy(&mutex); } mtx_t start_lock, step_lock; bool started, step; int stepper(void *arg) { - __llvm_libc::mtx_lock(&start_lock); + LIBC_NAMESPACE::mtx_lock(&start_lock); started = true; - __llvm_libc::mtx_unlock(&start_lock); + LIBC_NAMESPACE::mtx_unlock(&start_lock); - __llvm_libc::mtx_lock(&step_lock); + LIBC_NAMESPACE::mtx_lock(&step_lock); step = true; - __llvm_libc::mtx_unlock(&step_lock); + LIBC_NAMESPACE::mtx_unlock(&step_lock); return 0; } void wait_and_step() { - ASSERT_EQ(__llvm_libc::mtx_init(&start_lock, mtx_plain), + ASSERT_EQ(LIBC_NAMESPACE::mtx_init(&start_lock, mtx_plain), static_cast(thrd_success)); - ASSERT_EQ(__llvm_libc::mtx_init(&step_lock, mtx_plain), + ASSERT_EQ(LIBC_NAMESPACE::mtx_init(&step_lock, mtx_plain), static_cast(thrd_success)); // In this test, we start a new thread but block it before it can make a @@ -95,17 +96,18 @@ void wait_and_step() { // After unblocking, we then verify that the thread was indeed unblocked. step = false; started = false; - ASSERT_EQ(__llvm_libc::mtx_lock(&step_lock), static_cast(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::mtx_lock(&step_lock), + static_cast(thrd_success)); thrd_t thread; - __llvm_libc::thrd_create(&thread, stepper, nullptr); + LIBC_NAMESPACE::thrd_create(&thread, stepper, nullptr); while (true) { // Make sure the thread actually started. - ASSERT_EQ(__llvm_libc::mtx_lock(&start_lock), + ASSERT_EQ(LIBC_NAMESPACE::mtx_lock(&start_lock), static_cast(thrd_success)); bool s = started; - ASSERT_EQ(__llvm_libc::mtx_unlock(&start_lock), + ASSERT_EQ(LIBC_NAMESPACE::mtx_unlock(&start_lock), static_cast(thrd_success)); if (s) break; @@ -115,25 +117,25 @@ void wait_and_step() { ASSERT_FALSE(step); // Unlock the step lock and wait until the step is made. - ASSERT_EQ(__llvm_libc::mtx_unlock(&step_lock), + ASSERT_EQ(LIBC_NAMESPACE::mtx_unlock(&step_lock), static_cast(thrd_success)); while (true) { - ASSERT_EQ(__llvm_libc::mtx_lock(&step_lock), + ASSERT_EQ(LIBC_NAMESPACE::mtx_lock(&step_lock), static_cast(thrd_success)); bool current_step_value = step; - ASSERT_EQ(__llvm_libc::mtx_unlock(&step_lock), + ASSERT_EQ(LIBC_NAMESPACE::mtx_unlock(&step_lock), static_cast(thrd_success)); if (current_step_value) break; } int retval = 123; - __llvm_libc::thrd_join(thread, &retval); + LIBC_NAMESPACE::thrd_join(thread, &retval); ASSERT_EQ(retval, 0); - __llvm_libc::mtx_destroy(&start_lock); - __llvm_libc::mtx_destroy(&step_lock); + LIBC_NAMESPACE::mtx_destroy(&start_lock); + LIBC_NAMESPACE::mtx_destroy(&step_lock); } static constexpr int THREAD_COUNT = 10; @@ -142,54 +144,54 @@ static mtx_t counter_lock; static int wait_count = 0; int waiter_func(void *) { - __llvm_libc::mtx_lock(&counter_lock); + LIBC_NAMESPACE::mtx_lock(&counter_lock); ++wait_count; - __llvm_libc::mtx_unlock(&counter_lock); + LIBC_NAMESPACE::mtx_unlock(&counter_lock); // Block on the waiter lock until the main // thread unblocks. - __llvm_libc::mtx_lock(&multiple_waiter_lock); - __llvm_libc::mtx_unlock(&multiple_waiter_lock); + LIBC_NAMESPACE::mtx_lock(&multiple_waiter_lock); + LIBC_NAMESPACE::mtx_unlock(&multiple_waiter_lock); - __llvm_libc::mtx_lock(&counter_lock); + LIBC_NAMESPACE::mtx_lock(&counter_lock); --wait_count; - __llvm_libc::mtx_unlock(&counter_lock); + LIBC_NAMESPACE::mtx_unlock(&counter_lock); return 0; } void multiple_waiters() { - __llvm_libc::mtx_init(&multiple_waiter_lock, mtx_plain); - __llvm_libc::mtx_init(&counter_lock, mtx_plain); + LIBC_NAMESPACE::mtx_init(&multiple_waiter_lock, mtx_plain); + LIBC_NAMESPACE::mtx_init(&counter_lock, mtx_plain); - __llvm_libc::mtx_lock(&multiple_waiter_lock); + LIBC_NAMESPACE::mtx_lock(&multiple_waiter_lock); thrd_t waiters[THREAD_COUNT]; for (int i = 0; i < THREAD_COUNT; ++i) { - __llvm_libc::thrd_create(waiters + i, waiter_func, nullptr); + LIBC_NAMESPACE::thrd_create(waiters + i, waiter_func, nullptr); } // Spin until the counter is incremented to the desired // value. while (true) { - __llvm_libc::mtx_lock(&counter_lock); + LIBC_NAMESPACE::mtx_lock(&counter_lock); if (wait_count == THREAD_COUNT) { - __llvm_libc::mtx_unlock(&counter_lock); + LIBC_NAMESPACE::mtx_unlock(&counter_lock); break; } - __llvm_libc::mtx_unlock(&counter_lock); + LIBC_NAMESPACE::mtx_unlock(&counter_lock); } - __llvm_libc::mtx_unlock(&multiple_waiter_lock); + LIBC_NAMESPACE::mtx_unlock(&multiple_waiter_lock); int retval; for (int i = 0; i < THREAD_COUNT; ++i) { - __llvm_libc::thrd_join(waiters[i], &retval); + LIBC_NAMESPACE::thrd_join(waiters[i], &retval); } ASSERT_EQ(wait_count, 0); - __llvm_libc::mtx_destroy(&multiple_waiter_lock); - __llvm_libc::mtx_destroy(&counter_lock); + LIBC_NAMESPACE::mtx_destroy(&multiple_waiter_lock); + LIBC_NAMESPACE::mtx_destroy(&counter_lock); } TEST_MAIN() { diff --git a/libc/test/integration/src/threads/thrd_equal_test.cpp b/libc/test/integration/src/threads/thrd_equal_test.cpp index 8b4a00dff323138a648bb4f9d4e621cb05265902..4f8866f088b925398a5e175c315418c9d0ead072 100644 --- a/libc/test/integration/src/threads/thrd_equal_test.cpp +++ b/libc/test/integration/src/threads/thrd_equal_test.cpp @@ -23,21 +23,21 @@ thrd_t child_thread; mtx_t mutex; static int child_func(void *arg) { - __llvm_libc::mtx_lock(&mutex); + LIBC_NAMESPACE::mtx_lock(&mutex); int *ret = reinterpret_cast(arg); - auto self = __llvm_libc::thrd_current(); - *ret = __llvm_libc::thrd_equal(child_thread, self); - __llvm_libc::mtx_unlock(&mutex); + auto self = LIBC_NAMESPACE::thrd_current(); + *ret = LIBC_NAMESPACE::thrd_equal(child_thread, self); + LIBC_NAMESPACE::mtx_unlock(&mutex); return 0; } TEST_MAIN() { // We init and lock the mutex so that we guarantee that the child thread is // waiting after startup. - ASSERT_EQ(__llvm_libc::mtx_init(&mutex, mtx_plain), int(thrd_success)); - ASSERT_EQ(__llvm_libc::mtx_lock(&mutex), int(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::mtx_init(&mutex, mtx_plain), int(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::mtx_lock(&mutex), int(thrd_success)); - auto main_thread = __llvm_libc::thrd_current(); + auto main_thread = LIBC_NAMESPACE::thrd_current(); // The idea here is that, we start a child thread which will immediately // wait on |mutex|. The main thread will update the global |child_thread| var @@ -46,23 +46,23 @@ TEST_MAIN() { // comparison is returned in the thread arg. int result = 0; thrd_t th; - ASSERT_EQ(__llvm_libc::thrd_create(&th, child_func, &result), + ASSERT_EQ(LIBC_NAMESPACE::thrd_create(&th, child_func, &result), int(thrd_success)); // This new thread should of course not be equal to the main thread. - ASSERT_EQ(__llvm_libc::thrd_equal(th, main_thread), 0); + ASSERT_EQ(LIBC_NAMESPACE::thrd_equal(th, main_thread), 0); // Set the |child_thread| global var and unlock to allow the child to perform // the comparison. child_thread = th; - ASSERT_EQ(__llvm_libc::mtx_unlock(&mutex), int(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::mtx_unlock(&mutex), int(thrd_success)); int retval; - ASSERT_EQ(__llvm_libc::thrd_join(th, &retval), int(thrd_success)); + ASSERT_EQ(LIBC_NAMESPACE::thrd_join(th, &retval), int(thrd_success)); ASSERT_EQ(retval, 0); // The child thread should see that thrd_current return value is the same as // |child_thread|. ASSERT_NE(result, 0); - __llvm_libc::mtx_destroy(&mutex); + LIBC_NAMESPACE::mtx_destroy(&mutex); return 0; } diff --git a/libc/test/integration/src/threads/thrd_exit_test.cpp b/libc/test/integration/src/threads/thrd_exit_test.cpp index 6e7baa9d0da670b8f7eef18a73b77b5dadcf624d..0939a7621f443c4042f4a5b93babab0fdb352f49 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 33d230c1ec028b0a14e4cbcbae3d96c63a8c2e01..58728366b53ee6c2ccfdbd60929149207f1ca762 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 df0954d5e2e461b102b800b100e0d78cf110927a..c1c91c810bdf2dc99d90fa4472bdcdd89f68dc13 100644 --- a/libc/test/integration/src/threads/tss_test.cpp +++ b/libc/test/integration/src/threads/tss_test.cpp @@ -31,8 +31,8 @@ void dtor(void *data) { } int func(void *obj) { - ASSERT_EQ(__llvm_libc::tss_set(key, &child_thread_data), thrd_success); - int *d = reinterpret_cast(__llvm_libc::tss_get(key)); + ASSERT_EQ(LIBC_NAMESPACE::tss_set(key, &child_thread_data), thrd_success); + int *d = reinterpret_cast(LIBC_NAMESPACE::tss_get(key)); ASSERT_TRUE(d != nullptr); ASSERT_EQ(&child_thread_data, d); ASSERT_EQ(*d, THREAD_DATA_INITVAL); @@ -41,23 +41,23 @@ int func(void *obj) { } TEST_MAIN() { - ASSERT_EQ(__llvm_libc::tss_create(&key, &dtor), thrd_success); - ASSERT_EQ(__llvm_libc::tss_set(key, &main_thread_data), thrd_success); - int *d = reinterpret_cast(__llvm_libc::tss_get(key)); + ASSERT_EQ(LIBC_NAMESPACE::tss_create(&key, &dtor), thrd_success); + ASSERT_EQ(LIBC_NAMESPACE::tss_set(key, &main_thread_data), thrd_success); + int *d = reinterpret_cast(LIBC_NAMESPACE::tss_get(key)); ASSERT_TRUE(d != nullptr); ASSERT_EQ(&main_thread_data, d); ASSERT_EQ(*d, THREAD_DATA_INITVAL); thrd_t th; int arg = 0xBAD; - ASSERT_EQ(__llvm_libc::thrd_create(&th, &func, &arg), thrd_success); + ASSERT_EQ(LIBC_NAMESPACE::thrd_create(&th, &func, &arg), thrd_success); int retval = THREAD_DATA_INITVAL; // Init to some non-zero val. - ASSERT_EQ(__llvm_libc::thrd_join(th, &retval), thrd_success); + ASSERT_EQ(LIBC_NAMESPACE::thrd_join(th, &retval), thrd_success); ASSERT_EQ(retval, 0); ASSERT_EQ(arg, THREAD_RUN_VAL); ASSERT_EQ(child_thread_data, THREAD_DATA_FINIVAL); - __llvm_libc::tss_delete(key); + LIBC_NAMESPACE::tss_delete(key); return 0; } diff --git a/libc/test/integration/src/unistd/execv_test.cpp b/libc/test/integration/src/unistd/execv_test.cpp index 4a3969058485d6329b41d49f231452fc7b1c411b..254ef955f2720e08b81cc6f35c1de8fa1d5f704a 100644 --- a/libc/test/integration/src/unistd/execv_test.cpp +++ b/libc/test/integration/src/unistd/execv_test.cpp @@ -16,36 +16,36 @@ #include void fork_and_execv_normal_exit() { - pid_t pid = __llvm_libc::fork(); + pid_t pid = LIBC_NAMESPACE::fork(); if (pid == 0) { const char *path = "libc_execv_test_normal_exit"; char *const argv[] = { const_cast("execv_test_normal_exit"), nullptr, }; - __llvm_libc::execv(path, argv); + LIBC_NAMESPACE::execv(path, argv); } ASSERT_TRUE(pid > 0); int status; - pid_t cpid = __llvm_libc::waitpid(pid, &status, 0); + pid_t cpid = LIBC_NAMESPACE::waitpid(pid, &status, 0); ASSERT_TRUE(cpid > 0); ASSERT_EQ(cpid, pid); ASSERT_TRUE(WIFEXITED(status)); } void fork_and_execv_signal_exit() { - pid_t pid = __llvm_libc::fork(); + pid_t pid = LIBC_NAMESPACE::fork(); if (pid == 0) { const char *path = "libc_execv_test_signal_exit"; char *const argv[] = { const_cast("execv_test_normal_exit"), nullptr, }; - __llvm_libc::execv(path, argv); + LIBC_NAMESPACE::execv(path, argv); } ASSERT_TRUE(pid > 0); int status; - pid_t cpid = __llvm_libc::waitpid(pid, &status, 0); + pid_t cpid = LIBC_NAMESPACE::waitpid(pid, &status, 0); ASSERT_TRUE(cpid > 0); ASSERT_EQ(cpid, pid); ASSERT_FALSE(WIFEXITED(status)); diff --git a/libc/test/integration/src/unistd/execve_test.cpp b/libc/test/integration/src/unistd/execve_test.cpp index 409fec74f4d8dfd26dfc9fb35939d696b13ead4b..fb1a83da6385667b83baf927903a079844b949f8 100644 --- a/libc/test/integration/src/unistd/execve_test.cpp +++ b/libc/test/integration/src/unistd/execve_test.cpp @@ -16,36 +16,36 @@ #include void fork_and_execv_normal_exit(char **envp) { - pid_t pid = __llvm_libc::fork(); + pid_t pid = LIBC_NAMESPACE::fork(); if (pid == 0) { const char *path = "libc_execv_test_normal_exit"; char *const argv[] = { const_cast("execv_test_normal_exit"), nullptr, }; - __llvm_libc::execve(path, argv, envp); + LIBC_NAMESPACE::execve(path, argv, envp); } ASSERT_TRUE(pid > 0); int status; - pid_t cpid = __llvm_libc::waitpid(pid, &status, 0); + pid_t cpid = LIBC_NAMESPACE::waitpid(pid, &status, 0); ASSERT_TRUE(cpid > 0); ASSERT_EQ(cpid, pid); ASSERT_TRUE(WIFEXITED(status)); } void fork_and_execv_signal_exit(char **envp) { - pid_t pid = __llvm_libc::fork(); + pid_t pid = LIBC_NAMESPACE::fork(); if (pid == 0) { const char *path = "libc_execv_test_signal_exit"; char *const argv[] = { const_cast("execv_test_normal_exit"), nullptr, }; - __llvm_libc::execve(path, argv, envp); + LIBC_NAMESPACE::execve(path, argv, envp); } ASSERT_TRUE(pid > 0); int status; - pid_t cpid = __llvm_libc::waitpid(pid, &status, 0); + pid_t cpid = LIBC_NAMESPACE::waitpid(pid, &status, 0); ASSERT_TRUE(cpid > 0); ASSERT_EQ(cpid, pid); ASSERT_FALSE(WIFEXITED(status)); diff --git a/libc/test/integration/src/unistd/fork_test.cpp b/libc/test/integration/src/unistd/fork_test.cpp index 16798627ad9ab61d646583cb13aaaa2ee032eb10..9c9213ed46316d228c32b50614cb0981cab106ca 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 3214ebf7085cf0473897c9366184bc3e3d1e11fc..3d8f5821a69efcb58eb077d67ff287dc71e4eac9 100644 --- a/libc/test/integration/src/unistd/getcwd_test.cpp +++ b/libc/test/integration/src/unistd/getcwd_test.cpp @@ -15,26 +15,26 @@ #include // For malloc and free -using __llvm_libc::cpp::string_view; +using LIBC_NAMESPACE::cpp::string_view; TEST_MAIN(int argc, char **argv, char **envp) { char buffer[1024]; - ASSERT_TRUE(string_view(__llvm_libc::getenv("PWD")) == - __llvm_libc::getcwd(buffer, 1024)); + ASSERT_TRUE(string_view(LIBC_NAMESPACE::getenv("PWD")) == + LIBC_NAMESPACE::getcwd(buffer, 1024)); // nullptr buffer - char *cwd = __llvm_libc::getcwd(nullptr, 0); - ASSERT_TRUE(string_view(__llvm_libc::getenv("PWD")) == cwd); + char *cwd = LIBC_NAMESPACE::getcwd(nullptr, 0); + ASSERT_TRUE(string_view(LIBC_NAMESPACE::getenv("PWD")) == cwd); free(cwd); // Bad size - cwd = __llvm_libc::getcwd(buffer, 0); + cwd = LIBC_NAMESPACE::getcwd(buffer, 0); ASSERT_TRUE(cwd == nullptr); ASSERT_EQ(libc_errno, EINVAL); libc_errno = 0; // Insufficient size - cwd = __llvm_libc::getcwd(buffer, 2); + cwd = LIBC_NAMESPACE::getcwd(buffer, 2); ASSERT_TRUE(cwd == nullptr); int err = libc_errno; ASSERT_EQ(err, ERANGE); diff --git a/libc/test/integration/startup/gpu/rpc_interface_test.cpp b/libc/test/integration/startup/gpu/rpc_interface_test.cpp index 3aa1346e940c91dd63116126d698ee7cd56df920..674e2cc1ed7499f93271b8afbd81ea7e448f88d8 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 afde3dd863db129ffdf50c48ce673eebec5fc654..09a4ae67256e3a6f47dfead03d56fc7f80500cda 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 75e9574e613dabbcfee2024f83c3776b81762b24..4032d890c53ec89c47fa39560e84ae49f7f633a6 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 d8315af6b987ac0a2bebe45968a601e1a17b97cc..5f235a96006d6515319d139f1502678a6026faef 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 16408f7ad1467bfbae6938f1c3b75dcc96e63b49..5b105c8eb3d56cf755d74975b147e292ac159808 100644 --- a/libc/test/src/__support/CPP/atomic_test.cpp +++ b/libc/test/src/__support/CPP/atomic_test.cpp @@ -13,22 +13,22 @@ // threads, at which point it becomes a chicken and egg problem. TEST(LlvmLibcAtomicTest, LoadStore) { - __llvm_libc::cpp::Atomic aint(123); - ASSERT_EQ(aint.load(__llvm_libc::cpp::MemoryOrder::RELAXED), 123); + LIBC_NAMESPACE::cpp::Atomic aint(123); + ASSERT_EQ(aint.load(LIBC_NAMESPACE::cpp::MemoryOrder::RELAXED), 123); - aint.store(100, __llvm_libc::cpp::MemoryOrder::RELAXED); - ASSERT_EQ(aint.load(__llvm_libc::cpp::MemoryOrder::RELAXED), 100); + aint.store(100, LIBC_NAMESPACE::cpp::MemoryOrder::RELAXED); + ASSERT_EQ(aint.load(LIBC_NAMESPACE::cpp::MemoryOrder::RELAXED), 100); aint = 1234; // Equivalent of store - ASSERT_EQ(aint.load(__llvm_libc::cpp::MemoryOrder::RELAXED), 1234); + ASSERT_EQ(aint.load(LIBC_NAMESPACE::cpp::MemoryOrder::RELAXED), 1234); } TEST(LlvmLibcAtomicTest, CompareExchangeStrong) { int desired = 123; - __llvm_libc::cpp::Atomic aint(desired); + LIBC_NAMESPACE::cpp::Atomic aint(desired); ASSERT_TRUE(aint.compare_exchange_strong(desired, 100)); - ASSERT_EQ(aint.load(__llvm_libc::cpp::MemoryOrder::RELAXED), 100); + ASSERT_EQ(aint.load(LIBC_NAMESPACE::cpp::MemoryOrder::RELAXED), 100); ASSERT_FALSE(aint.compare_exchange_strong(desired, 100)); - ASSERT_EQ(aint.load(__llvm_libc::cpp::MemoryOrder::RELAXED), 100); + ASSERT_EQ(aint.load(LIBC_NAMESPACE::cpp::MemoryOrder::RELAXED), 100); } diff --git a/libc/test/src/__support/CPP/bitset_test.cpp b/libc/test/src/__support/CPP/bitset_test.cpp index 9983cfc8bbbd489eeeca927d2df80f095ed28922..f1d4e4c2f9636448fbd16200dee78e473eee2c1e 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 ffae423f4fd00304941ae1379b97aabf607d439d..8337081345a02d6da5209eeeff3bf0fea44d1038 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 1d040e6bc3e3c3efb2868124c9d5688bc6120fa1..fe378522b446b90e958aac5ed1393486c93d4c1a 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 fea428e66eff85bbc6896270b192c2b73664d687..12641b7b51b6ce8d8a05f94b30bea93820484ade 100644 --- a/libc/test/src/__support/CPP/limits_test.cpp +++ b/libc/test/src/__support/CPP/limits_test.cpp @@ -10,7 +10,7 @@ #include "src/__support/UInt.h" #include "test/UnitTest/Test.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // This just checks against the C spec, almost all implementations will surpass // this. @@ -32,14 +32,14 @@ TEST(LlvmLibcLimitsTest, LimitsFollowSpec) { } TEST(LlvmLibcLimitsTest, UInt128Limits) { - auto umax128 = cpp::numeric_limits<__llvm_libc::cpp::UInt<128>>::max(); + auto umax128 = cpp::numeric_limits>::max(); auto umax64 = - __llvm_libc::cpp::UInt<128>(cpp::numeric_limits::max()); + LIBC_NAMESPACE::cpp::UInt<128>(cpp::numeric_limits::max()); EXPECT_GT(umax128, umax64); - ASSERT_EQ(~__llvm_libc::cpp::UInt<128>(0), umax128); + ASSERT_EQ(~LIBC_NAMESPACE::cpp::UInt<128>(0), umax128); #ifdef __SIZEOF_INT128__ ASSERT_EQ(~__uint128_t(0), cpp::numeric_limits<__uint128_t>::max()); #endif } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/src/__support/CPP/optional_test.cpp b/libc/test/src/__support/CPP/optional_test.cpp index c59175d59a2c43f59b94f9298e7dabfa5d4d77bc..f9254d42c9a9ea838f916f09048c99a01167e9ec 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 4476f4e98b94ea0c6ddc22c697c4fc3be8845d96..6da06c31e7adfd1d6a81ce3dcdf8cdc3ddd05b33 100644 --- a/libc/test/src/__support/CPP/span_test.cpp +++ b/libc/test/src/__support/CPP/span_test.cpp @@ -10,8 +10,8 @@ #include "src/__support/CPP/span.h" #include "test/UnitTest/Test.h" -using __llvm_libc::cpp::array; -using __llvm_libc::cpp::span; +using LIBC_NAMESPACE::cpp::array; +using LIBC_NAMESPACE::cpp::span; TEST(LlvmLibcSpanTest, InitializeEmpty) { span s; diff --git a/libc/test/src/__support/CPP/string_test.cpp b/libc/test/src/__support/CPP/string_test.cpp index 928277fe2e9cc769b15f1309e34770b482bbd310..e606ab127adc2133539a84efb2c7b5d67fe3669e 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 c6bfd775e3460b434852aa2cc51f90d269b70d99..e285fc5715bce2e0598a337e014b63a09d2dae77 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 59a0d396095d0a3b12ec275d7f894236c6e3ffe9..33eb8ab4765728af6a55c121d6e27a35ce7730a3 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 4e1eb41b73992071b84fe436ea6ee9c0f9b64fc2..0e5f4a1f738b7aaf62971d12c8bde49daf141e5e 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 b1ef7111867fc841addca76300298bb65307ce5b..8fafa767ae38e34520ae2a310649ca2ece0851c5 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 f910eb1d8763791674a5029b426e4d33da992138..916523e2826693595968701c561d1349d8b6bccc 100644 --- a/libc/test/src/__support/FPUtil/fpbits_test.cpp +++ b/libc/test/src/__support/FPUtil/fpbits_test.cpp @@ -10,14 +10,15 @@ #include "src/__support/FPUtil/fpbits_str.h" #include "test/UnitTest/Test.h" -using __llvm_libc::fputil::FPBits; +using LIBC_NAMESPACE::fputil::FPBits; TEST(LlvmLibcFPBitsTest, FloatType) { - EXPECT_STREQ(__llvm_libc::str(FPBits::inf()).c_str(), "(+Infinity)"); - EXPECT_STREQ(__llvm_libc::str(FPBits::neg_inf()).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits::inf()).c_str(), + "(+Infinity)"); + EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits::neg_inf()).c_str(), "(-Infinity)"); EXPECT_STREQ( - __llvm_libc::str(FPBits(FPBits::build_nan(1))).c_str(), + LIBC_NAMESPACE::str(FPBits(FPBits::build_nan(1))).c_str(), "(NaN)"); FPBits zero(0.0f); @@ -25,7 +26,7 @@ TEST(LlvmLibcFPBitsTest, FloatType) { EXPECT_EQ(zero.get_unbiased_exponent(), static_cast(0)); EXPECT_EQ(zero.get_mantissa(), static_cast(0)); EXPECT_EQ(zero.uintval(), static_cast(0x00000000)); - EXPECT_STREQ(__llvm_libc::str(zero).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(zero).c_str(), "0x00000000 = (S: 0, E: 0x0000, M: 0x00000000)"); FPBits negzero(-0.0f); @@ -33,7 +34,7 @@ TEST(LlvmLibcFPBitsTest, FloatType) { EXPECT_EQ(negzero.get_unbiased_exponent(), static_cast(0)); EXPECT_EQ(negzero.get_mantissa(), static_cast(0)); EXPECT_EQ(negzero.uintval(), static_cast(0x80000000)); - EXPECT_STREQ(__llvm_libc::str(negzero).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(negzero).c_str(), "0x80000000 = (S: 1, E: 0x0000, M: 0x00000000)"); FPBits one(1.0f); @@ -41,7 +42,7 @@ TEST(LlvmLibcFPBitsTest, FloatType) { EXPECT_EQ(one.get_unbiased_exponent(), static_cast(0x7F)); EXPECT_EQ(one.get_mantissa(), static_cast(0)); EXPECT_EQ(one.uintval(), static_cast(0x3F800000)); - EXPECT_STREQ(__llvm_libc::str(one).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(one).c_str(), "0x3F800000 = (S: 0, E: 0x007F, M: 0x00000000)"); FPBits negone(-1.0f); @@ -49,7 +50,7 @@ TEST(LlvmLibcFPBitsTest, FloatType) { EXPECT_EQ(negone.get_unbiased_exponent(), static_cast(0x7F)); EXPECT_EQ(negone.get_mantissa(), static_cast(0)); EXPECT_EQ(negone.uintval(), static_cast(0xBF800000)); - EXPECT_STREQ(__llvm_libc::str(negone).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(negone).c_str(), "0xBF800000 = (S: 1, E: 0x007F, M: 0x00000000)"); FPBits num(1.125f); @@ -57,7 +58,7 @@ TEST(LlvmLibcFPBitsTest, FloatType) { EXPECT_EQ(num.get_unbiased_exponent(), static_cast(0x7F)); EXPECT_EQ(num.get_mantissa(), static_cast(0x00100000)); EXPECT_EQ(num.uintval(), static_cast(0x3F900000)); - EXPECT_STREQ(__llvm_libc::str(num).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(num).c_str(), "0x3F900000 = (S: 0, E: 0x007F, M: 0x00100000)"); FPBits negnum(-1.125f); @@ -65,16 +66,17 @@ TEST(LlvmLibcFPBitsTest, FloatType) { EXPECT_EQ(negnum.get_unbiased_exponent(), static_cast(0x7F)); EXPECT_EQ(negnum.get_mantissa(), static_cast(0x00100000)); EXPECT_EQ(negnum.uintval(), static_cast(0xBF900000)); - EXPECT_STREQ(__llvm_libc::str(negnum).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(negnum).c_str(), "0xBF900000 = (S: 1, E: 0x007F, M: 0x00100000)"); } TEST(LlvmLibcFPBitsTest, DoubleType) { - EXPECT_STREQ(__llvm_libc::str(FPBits::inf()).c_str(), "(+Infinity)"); - EXPECT_STREQ(__llvm_libc::str(FPBits::neg_inf()).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits::inf()).c_str(), + "(+Infinity)"); + EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits::neg_inf()).c_str(), "(-Infinity)"); EXPECT_STREQ( - __llvm_libc::str(FPBits(FPBits::build_nan(1))).c_str(), + LIBC_NAMESPACE::str(FPBits(FPBits::build_nan(1))).c_str(), "(NaN)"); FPBits zero(0.0); @@ -82,7 +84,7 @@ TEST(LlvmLibcFPBitsTest, DoubleType) { EXPECT_EQ(zero.get_unbiased_exponent(), static_cast(0x0000)); EXPECT_EQ(zero.get_mantissa(), static_cast(0x0000000000000000)); EXPECT_EQ(zero.uintval(), static_cast(0x0000000000000000)); - EXPECT_STREQ(__llvm_libc::str(zero).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(zero).c_str(), "0x0000000000000000 = (S: 0, E: 0x0000, M: 0x0000000000000000)"); FPBits negzero(-0.0); @@ -90,7 +92,7 @@ TEST(LlvmLibcFPBitsTest, DoubleType) { EXPECT_EQ(negzero.get_unbiased_exponent(), static_cast(0x0000)); EXPECT_EQ(negzero.get_mantissa(), static_cast(0x0000000000000000)); EXPECT_EQ(negzero.uintval(), static_cast(0x8000000000000000)); - EXPECT_STREQ(__llvm_libc::str(negzero).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(negzero).c_str(), "0x8000000000000000 = (S: 1, E: 0x0000, M: 0x0000000000000000)"); FPBits one(1.0); @@ -98,7 +100,7 @@ TEST(LlvmLibcFPBitsTest, DoubleType) { EXPECT_EQ(one.get_unbiased_exponent(), static_cast(0x03FF)); EXPECT_EQ(one.get_mantissa(), static_cast(0x0000000000000000)); EXPECT_EQ(one.uintval(), static_cast(0x3FF0000000000000)); - EXPECT_STREQ(__llvm_libc::str(one).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(one).c_str(), "0x3FF0000000000000 = (S: 0, E: 0x03FF, M: 0x0000000000000000)"); FPBits negone(-1.0); @@ -106,7 +108,7 @@ TEST(LlvmLibcFPBitsTest, DoubleType) { EXPECT_EQ(negone.get_unbiased_exponent(), static_cast(0x03FF)); EXPECT_EQ(negone.get_mantissa(), static_cast(0x0000000000000000)); EXPECT_EQ(negone.uintval(), static_cast(0xBFF0000000000000)); - EXPECT_STREQ(__llvm_libc::str(negone).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(negone).c_str(), "0xBFF0000000000000 = (S: 1, E: 0x03FF, M: 0x0000000000000000)"); FPBits num(1.125); @@ -114,7 +116,7 @@ TEST(LlvmLibcFPBitsTest, DoubleType) { EXPECT_EQ(num.get_unbiased_exponent(), static_cast(0x03FF)); EXPECT_EQ(num.get_mantissa(), static_cast(0x0002000000000000)); EXPECT_EQ(num.uintval(), static_cast(0x3FF2000000000000)); - EXPECT_STREQ(__llvm_libc::str(num).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(num).c_str(), "0x3FF2000000000000 = (S: 0, E: 0x03FF, M: 0x0002000000000000)"); FPBits negnum(-1.125); @@ -122,7 +124,7 @@ TEST(LlvmLibcFPBitsTest, DoubleType) { EXPECT_EQ(negnum.get_unbiased_exponent(), static_cast(0x03FF)); EXPECT_EQ(negnum.get_mantissa(), static_cast(0x0002000000000000)); EXPECT_EQ(negnum.uintval(), static_cast(0xBFF2000000000000)); - EXPECT_STREQ(__llvm_libc::str(negnum).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(negnum).c_str(), "0xBFF2000000000000 = (S: 1, E: 0x03FF, M: 0x0002000000000000)"); } @@ -131,14 +133,14 @@ TEST(LlvmLibcFPBitsTest, X86LongDoubleType) { if constexpr (sizeof(long double) == sizeof(double)) return; // The tests for the "double" type cover for this case. - EXPECT_STREQ(__llvm_libc::str(FPBits::inf()).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits::inf()).c_str(), "(+Infinity)"); - EXPECT_STREQ(__llvm_libc::str(FPBits::neg_inf()).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits::neg_inf()).c_str(), "(-Infinity)"); - EXPECT_STREQ( - __llvm_libc::str(FPBits(FPBits::build_nan(1))) - .c_str(), - "(NaN)"); + EXPECT_STREQ(LIBC_NAMESPACE::str( + FPBits(FPBits::build_nan(1))) + .c_str(), + "(NaN)"); FPBits zero(0.0l); EXPECT_EQ(zero.get_sign(), false); @@ -147,7 +149,7 @@ TEST(LlvmLibcFPBitsTest, X86LongDoubleType) { << 64); EXPECT_EQ(zero.uintval(), static_cast(0x0000000000000000) << 64); EXPECT_STREQ( - __llvm_libc::str(zero).c_str(), + LIBC_NAMESPACE::str(zero).c_str(), "0x00000000000000000000000000000000 = " "(S: 0, E: 0x0000, I: 0, M: 0x00000000000000000000000000000000)"); @@ -158,7 +160,7 @@ TEST(LlvmLibcFPBitsTest, X86LongDoubleType) { << 64); EXPECT_EQ(negzero.uintval(), static_cast(0x1) << 79); EXPECT_STREQ( - __llvm_libc::str(negzero).c_str(), + LIBC_NAMESPACE::str(negzero).c_str(), "0x00000000000080000000000000000000 = " "(S: 1, E: 0x0000, I: 0, M: 0x00000000000000000000000000000000)"); @@ -168,7 +170,7 @@ TEST(LlvmLibcFPBitsTest, X86LongDoubleType) { EXPECT_EQ(one.get_mantissa(), static_cast(0x0000000000000000) << 64); EXPECT_EQ(one.uintval(), static_cast(0x3FFF8) << 60); EXPECT_STREQ( - __llvm_libc::str(one).c_str(), + LIBC_NAMESPACE::str(one).c_str(), "0x0000000000003FFF8000000000000000 = " "(S: 0, E: 0x3FFF, I: 1, M: 0x00000000000000000000000000000000)"); @@ -179,7 +181,7 @@ TEST(LlvmLibcFPBitsTest, X86LongDoubleType) { << 64); EXPECT_EQ(negone.uintval(), static_cast(0xBFFF8) << 60); EXPECT_STREQ( - __llvm_libc::str(negone).c_str(), + LIBC_NAMESPACE::str(negone).c_str(), "0x000000000000BFFF8000000000000000 = " "(S: 1, E: 0x3FFF, I: 1, M: 0x00000000000000000000000000000000)"); @@ -189,7 +191,7 @@ TEST(LlvmLibcFPBitsTest, X86LongDoubleType) { EXPECT_EQ(num.get_mantissa(), static_cast(0x1) << 60); EXPECT_EQ(num.uintval(), static_cast(0x3FFF9) << 60); EXPECT_STREQ( - __llvm_libc::str(num).c_str(), + LIBC_NAMESPACE::str(num).c_str(), "0x0000000000003FFF9000000000000000 = " "(S: 0, E: 0x3FFF, I: 1, M: 0x00000000000000001000000000000000)"); @@ -199,7 +201,7 @@ TEST(LlvmLibcFPBitsTest, X86LongDoubleType) { EXPECT_EQ(negnum.get_mantissa(), static_cast(0x1) << 60); EXPECT_EQ(negnum.uintval(), static_cast(0xBFFF9) << 60); EXPECT_STREQ( - __llvm_libc::str(negnum).c_str(), + LIBC_NAMESPACE::str(negnum).c_str(), "0x000000000000BFFF9000000000000000 = " "(S: 1, E: 0x3FFF, I: 1, M: 0x00000000000000001000000000000000)"); } @@ -208,14 +210,14 @@ TEST(LlvmLibcFPBitsTest, LongDoubleType) { #if defined(LONG_DOUBLE_IS_DOUBLE) return; // The tests for the "double" type cover for this case. #else - EXPECT_STREQ(__llvm_libc::str(FPBits::inf()).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits::inf()).c_str(), "(+Infinity)"); - EXPECT_STREQ(__llvm_libc::str(FPBits::neg_inf()).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(FPBits::neg_inf()).c_str(), "(-Infinity)"); - EXPECT_STREQ( - __llvm_libc::str(FPBits(FPBits::build_nan(1))) - .c_str(), - "(NaN)"); + EXPECT_STREQ(LIBC_NAMESPACE::str( + FPBits(FPBits::build_nan(1))) + .c_str(), + "(NaN)"); FPBits zero(0.0l); EXPECT_EQ(zero.get_sign(), false); @@ -223,7 +225,7 @@ TEST(LlvmLibcFPBitsTest, LongDoubleType) { EXPECT_EQ(zero.get_mantissa(), static_cast(0x0000000000000000) << 64); EXPECT_EQ(zero.uintval(), static_cast(0x0000000000000000) << 64); - EXPECT_STREQ(__llvm_libc::str(zero).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(zero).c_str(), "0x00000000000000000000000000000000 = " "(S: 0, E: 0x0000, M: 0x00000000000000000000000000000000)"); @@ -233,7 +235,7 @@ TEST(LlvmLibcFPBitsTest, LongDoubleType) { EXPECT_EQ(negzero.get_mantissa(), static_cast(0x0000000000000000) << 64); EXPECT_EQ(negzero.uintval(), static_cast(0x1) << 127); - EXPECT_STREQ(__llvm_libc::str(negzero).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(negzero).c_str(), "0x80000000000000000000000000000000 = " "(S: 1, E: 0x0000, M: 0x00000000000000000000000000000000)"); @@ -242,7 +244,7 @@ TEST(LlvmLibcFPBitsTest, LongDoubleType) { EXPECT_EQ(one.get_unbiased_exponent(), static_cast(0x3FFF)); EXPECT_EQ(one.get_mantissa(), static_cast(0x0000000000000000) << 64); EXPECT_EQ(one.uintval(), static_cast(0x3FFF) << 112); - EXPECT_STREQ(__llvm_libc::str(one).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(one).c_str(), "0x3FFF0000000000000000000000000000 = " "(S: 0, E: 0x3FFF, M: 0x00000000000000000000000000000000)"); @@ -252,7 +254,7 @@ TEST(LlvmLibcFPBitsTest, LongDoubleType) { EXPECT_EQ(negone.get_mantissa(), static_cast(0x0000000000000000) << 64); EXPECT_EQ(negone.uintval(), static_cast(0xBFFF) << 112); - EXPECT_STREQ(__llvm_libc::str(negone).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(negone).c_str(), "0xBFFF0000000000000000000000000000 = " "(S: 1, E: 0x3FFF, M: 0x00000000000000000000000000000000)"); @@ -261,7 +263,7 @@ TEST(LlvmLibcFPBitsTest, LongDoubleType) { EXPECT_EQ(num.get_unbiased_exponent(), static_cast(0x3FFF)); EXPECT_EQ(num.get_mantissa(), static_cast(0x2) << 108); EXPECT_EQ(num.uintval(), static_cast(0x3FFF2) << 108); - EXPECT_STREQ(__llvm_libc::str(num).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(num).c_str(), "0x3FFF2000000000000000000000000000 = " "(S: 0, E: 0x3FFF, M: 0x00002000000000000000000000000000)"); @@ -270,7 +272,7 @@ TEST(LlvmLibcFPBitsTest, LongDoubleType) { EXPECT_EQ(negnum.get_unbiased_exponent(), static_cast(0x3FFF)); EXPECT_EQ(negnum.get_mantissa(), static_cast(0x2) << 108); EXPECT_EQ(negnum.uintval(), static_cast(0xBFFF2) << 108); - EXPECT_STREQ(__llvm_libc::str(negnum).c_str(), + EXPECT_STREQ(LIBC_NAMESPACE::str(negnum).c_str(), "0xBFFF2000000000000000000000000000 = " "(S: 1, E: 0x3FFF, M: 0x00002000000000000000000000000000)"); #endif diff --git a/libc/test/src/__support/FPUtil/rounding_mode_test.cpp b/libc/test/src/__support/FPUtil/rounding_mode_test.cpp index 01c1b3c2a9ffaf411d474a5f9d7d4238875c225f..e73d10d9658841c2de62d71fa21462017bce533a 100644 --- a/libc/test/src/__support/FPUtil/rounding_mode_test.cpp +++ b/libc/test/src/__support/FPUtil/rounding_mode_test.cpp @@ -12,11 +12,11 @@ #include -using __llvm_libc::testing::mpfr::ForceRoundingMode; -using __llvm_libc::testing::mpfr::RoundingMode; +using LIBC_NAMESPACE::testing::mpfr::ForceRoundingMode; +using LIBC_NAMESPACE::testing::mpfr::RoundingMode; TEST(LlvmLibcFEnvImplTest, QuickRoundingUpTest) { - using __llvm_libc::fputil::fenv_is_round_up; + using LIBC_NAMESPACE::fputil::fenv_is_round_up; { ForceRoundingMode __r(RoundingMode::Upward); if (__r.success) @@ -40,7 +40,7 @@ TEST(LlvmLibcFEnvImplTest, QuickRoundingUpTest) { } TEST(LlvmLibcFEnvImplTest, QuickRoundingDownTest) { - using __llvm_libc::fputil::fenv_is_round_down; + using LIBC_NAMESPACE::fputil::fenv_is_round_down; { ForceRoundingMode __r(RoundingMode::Upward); if (__r.success) @@ -64,7 +64,7 @@ TEST(LlvmLibcFEnvImplTest, QuickRoundingDownTest) { } TEST(LlvmLibcFEnvImplTest, QuickRoundingNearestTest) { - using __llvm_libc::fputil::fenv_is_round_to_nearest; + using LIBC_NAMESPACE::fputil::fenv_is_round_to_nearest; { ForceRoundingMode __r(RoundingMode::Upward); if (__r.success) @@ -88,7 +88,7 @@ TEST(LlvmLibcFEnvImplTest, QuickRoundingNearestTest) { } TEST(LlvmLibcFEnvImplTest, QuickRoundingTowardZeroTest) { - using __llvm_libc::fputil::fenv_is_round_to_zero; + using LIBC_NAMESPACE::fputil::fenv_is_round_to_zero; { ForceRoundingMode __r(RoundingMode::Upward); if (__r.success) @@ -112,7 +112,7 @@ TEST(LlvmLibcFEnvImplTest, QuickRoundingTowardZeroTest) { } TEST(LlvmLibcFEnvImplTest, QuickGetRoundTest) { - using __llvm_libc::fputil::quick_get_round; + using LIBC_NAMESPACE::fputil::quick_get_round; { ForceRoundingMode __r(RoundingMode::Upward); if (__r.success) diff --git a/libc/test/src/__support/File/file_test.cpp b/libc/test/src/__support/File/file_test.cpp index 1a67ebdd5015430f4ecf086e8ee6d7440fddc854..fbcedc163de10a8dc7af92a87e1a5522a4cc2e44 100644 --- a/libc/test/src/__support/File/file_test.cpp +++ b/libc/test/src/__support/File/file_test.cpp @@ -15,11 +15,11 @@ #include #include -using ModeFlags = __llvm_libc::File::ModeFlags; -using MemoryView = __llvm_libc::testing::MemoryView; -using __llvm_libc::ErrorOr; -using __llvm_libc::File; -using __llvm_libc::FileIOResult; +using ModeFlags = LIBC_NAMESPACE::File::ModeFlags; +using MemoryView = LIBC_NAMESPACE::testing::MemoryView; +using LIBC_NAMESPACE::ErrorOr; +using LIBC_NAMESPACE::File; +using LIBC_NAMESPACE::FileIOResult; class StringFile : public File { static constexpr size_t SIZE = 512; @@ -28,11 +28,12 @@ class StringFile : public File { size_t eof_marker; bool write_append; - static FileIOResult str_read(__llvm_libc::File *f, void *data, size_t len); - static FileIOResult str_write(__llvm_libc::File *f, const void *data, + static FileIOResult str_read(LIBC_NAMESPACE::File *f, void *data, size_t len); + static FileIOResult str_write(LIBC_NAMESPACE::File *f, const void *data, size_t len); - static ErrorOr str_seek(__llvm_libc::File *f, long offset, int whence); - static int str_close(__llvm_libc::File *f) { + static ErrorOr str_seek(LIBC_NAMESPACE::File *f, long offset, + int whence); + static int str_close(LIBC_NAMESPACE::File *f) { delete reinterpret_cast(f); return 0; } @@ -40,11 +41,12 @@ class StringFile : public File { public: explicit StringFile(char *buffer, size_t buflen, int bufmode, bool owned, ModeFlags modeflags) - : __llvm_libc::File(&str_write, &str_read, &str_seek, &str_close, - reinterpret_cast(buffer), buflen, bufmode, - owned, modeflags), + : LIBC_NAMESPACE::File(&str_write, &str_read, &str_seek, &str_close, + reinterpret_cast(buffer), buflen, + bufmode, owned, modeflags), pos(0), eof_marker(0), write_append(false) { - if (modeflags & static_cast(__llvm_libc::File::OpenMode::APPEND)) + if (modeflags & + static_cast(LIBC_NAMESPACE::File::OpenMode::APPEND)) write_append = true; } @@ -63,7 +65,7 @@ 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(f); if (sf->pos >= sf->eof_marker) @@ -75,7 +77,7 @@ FileIOResult StringFile::str_read(__llvm_libc::File *f, void *data, return i; } -FileIOResult StringFile::str_write(__llvm_libc::File *f, const void *data, +FileIOResult StringFile::str_write(LIBC_NAMESPACE::File *f, const void *data, size_t len) { StringFile *sf = static_cast(f); if (sf->write_append) @@ -91,7 +93,7 @@ FileIOResult StringFile::str_write(__llvm_libc::File *f, const void *data, return i; } -ErrorOr StringFile::str_seek(__llvm_libc::File *f, long offset, +ErrorOr StringFile::str_seek(LIBC_NAMESPACE::File *f, long offset, int whence) { StringFile *sf = static_cast(f); if (whence == SEEK_SET) @@ -105,11 +107,11 @@ ErrorOr StringFile::str_seek(__llvm_libc::File *f, long offset, StringFile *new_string_file(char *buffer, size_t buflen, int bufmode, bool owned, const char *mode) { - __llvm_libc::AllocChecker ac; + LIBC_NAMESPACE::AllocChecker ac; // We will just assume the allocation succeeds. We cannot test anything // otherwise. return new (ac) StringFile(buffer, buflen, bufmode, owned, - __llvm_libc::File::mode_flags(mode)); + LIBC_NAMESPACE::File::mode_flags(mode)); } TEST(LlvmLibcFileTest, WriteOnly) { diff --git a/libc/test/src/__support/File/platform_file_test.cpp b/libc/test/src/__support/File/platform_file_test.cpp index 022c8afa44109b39a75ef6c85a61b551b4a6c455..469d7500032b93114af95a6c744d17ec1b9ff345 100644 --- a/libc/test/src/__support/File/platform_file_test.cpp +++ b/libc/test/src/__support/File/platform_file_test.cpp @@ -11,12 +11,12 @@ #include // For SEEK_* macros -using File = __llvm_libc::File; +using File = LIBC_NAMESPACE::File; constexpr char TEXT[] = "Hello, File"; constexpr size_t TEXT_SIZE = sizeof(TEXT) - 1; // Ignore the null terminator LIBC_INLINE File *openfile(const char *file_name, const char *mode) { - auto error_or_file = __llvm_libc::openfile(file_name, mode); + auto error_or_file = LIBC_NAMESPACE::openfile(file_name, mode); return error_or_file.has_value() ? error_or_file.value() : nullptr; } diff --git a/libc/test/src/__support/File/platform_stderr_test.cpp b/libc/test/src/__support/File/platform_stderr_test.cpp index ac79572fdb82f203c19557664c489f0116b421ba..1311d729026ef816233f11b4cdc9d40fbf648934 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 c0c41d54c399569f1fdc07817a41a9d1e52c192c..2fdf71623ae460f0aae618e657be76c488e22c57 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 a47281a7532d8ffa3e2d22b2d01f1d00ab61ae09..b479e8d287f79458c38548bed502fb6e2ef49897 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 84e750a1b9d509b81656a75a762b672e23577316..9dd1a6ad9ef23633cc945f3e5fc481958440880a 100644 --- a/libc/test/src/__support/OSUtil/linux/x86_64/syscall_test.cpp +++ b/libc/test/src/__support/OSUtil/linux/x86_64/syscall_test.cpp @@ -14,32 +14,34 @@ TEST(LlvmLibcX86_64_SyscallTest, APITest) { // We only do a signature test here. Actual functionality tests are // done by the unit tests of the syscall wrappers like mmap. - using __llvm_libc::cpp::function; + using LIBC_NAMESPACE::cpp::function; function f( - [](long n) { return __llvm_libc::syscall_impl(n); }); - function f1( - [](long n, long a1) { return __llvm_libc::syscall_impl(n, a1); }); + [](long n) { return LIBC_NAMESPACE::syscall_impl(n); }); + function f1([](long n, long a1) { + return LIBC_NAMESPACE::syscall_impl(n, a1); + }); function f2([](long n, long a1, long a2) { - return __llvm_libc::syscall_impl(n, a1, a2); + return LIBC_NAMESPACE::syscall_impl(n, a1, a2); }); function f3( [](long n, long a1, long a2, long a3) { - return __llvm_libc::syscall_impl(n, a1, a2, a3); + return LIBC_NAMESPACE::syscall_impl(n, a1, a2, a3); }); function f4( [](long n, long a1, long a2, long a3, long a4) { - return __llvm_libc::syscall_impl(n, a1, a2, a3, a4); + return LIBC_NAMESPACE::syscall_impl(n, a1, a2, a3, a4); }); function f5( [](long n, long a1, long a2, long a3, long a4, long a5) { - return __llvm_libc::syscall_impl(n, a1, a2, a3, a4, a5); + return LIBC_NAMESPACE::syscall_impl(n, a1, a2, a3, a4, a5); }); function f6( [](long n, long a1, long a2, long a3, long a4, long a5, long a6) { - return __llvm_libc::syscall_impl(n, a1, a2, a3, a4, a5, a6); + return LIBC_NAMESPACE::syscall_impl(n, a1, a2, a3, a4, a5, a6); }); - function not_long_type( - [](long n, void *a1) { return __llvm_libc::syscall_impl(n, a1); }); + function not_long_type([](long n, void *a1) { + return LIBC_NAMESPACE::syscall_impl(n, a1); + }); } diff --git a/libc/test/src/__support/RPC/rpc_smoke_test.cpp b/libc/test/src/__support/RPC/rpc_smoke_test.cpp index b575e01bcb9ba0c48100ed057a0560a884b76fc0..54821e21f9ccf71029159578a9e20f2bc7eb6ed8 100644 --- a/libc/test/src/__support/RPC/rpc_smoke_test.cpp +++ b/libc/test/src/__support/RPC/rpc_smoke_test.cpp @@ -17,8 +17,8 @@ struct Packet { uint64_t unused; }; -using ProcAType = __llvm_libc::rpc::Process; -using ProcBType = __llvm_libc::rpc::Process; +using ProcAType = LIBC_NAMESPACE::rpc::Process; +using ProcBType = LIBC_NAMESPACE::rpc::Process; static_assert(ProcAType::inbox_offset(port_count) == ProcBType::outbox_offset(port_count)); diff --git a/libc/test/src/__support/arg_list_test.cpp b/libc/test/src/__support/arg_list_test.cpp index f266ccfdd1ff684d9186280096eee3b74323323a..1876cf7f70b4b8187ef78b988029efcf2753d186 100644 --- a/libc/test/src/__support/arg_list_test.cpp +++ b/libc/test/src/__support/arg_list_test.cpp @@ -13,7 +13,7 @@ int get_nth_int(int n, ...) { va_list vlist; va_start(vlist, n); - __llvm_libc::internal::ArgList v(vlist); + LIBC_NAMESPACE::internal::ArgList v(vlist); va_end(vlist); for (int i = 0; i < n; ++i) { @@ -29,10 +29,10 @@ TEST(LlvmLibcArgListTest, BasicUsage) { int sum_two_nums(int first, int second, ...) { va_list vlist; va_start(vlist, second); - __llvm_libc::internal::ArgList v1(vlist); + LIBC_NAMESPACE::internal::ArgList v1(vlist); va_end(vlist); - __llvm_libc::internal::ArgList v2 = v1; + LIBC_NAMESPACE::internal::ArgList v2 = v1; int first_val; for (int i = 0; i < first; ++i) { @@ -60,7 +60,7 @@ TEST(LlvmLibcArgListTest, CopyConstructor) { long int check_primitives(int first, ...) { va_list vlist; va_start(vlist, first); - __llvm_libc::internal::ArgList args(vlist); + LIBC_NAMESPACE::internal::ArgList args(vlist); va_end(vlist); long int count = 0; @@ -106,7 +106,7 @@ struct S { long int check_struct_type(int first, ...) { va_list vlist; va_start(vlist, first); - __llvm_libc::internal::ArgList args(vlist); + LIBC_NAMESPACE::internal::ArgList args(vlist); va_end(vlist); S s = args.next_var(); @@ -130,7 +130,7 @@ using int4 = int __attribute__((ext_vector_type(4))); int check_vector_type(int first, ...) { va_list vlist; va_start(vlist, first); - __llvm_libc::internal::ArgList args(vlist); + LIBC_NAMESPACE::internal::ArgList args(vlist); va_end(vlist); int1 v1 = args.next_var(); diff --git a/libc/test/src/__support/blockstore_test.cpp b/libc/test/src/__support/blockstore_test.cpp index 10277af49116d6ef03a64ed7961deff85666671c..f62857275fe4c908137a49dd0e094879a5daa0fc 100644 --- a/libc/test/src/__support/blockstore_test.cpp +++ b/libc/test/src/__support/blockstore_test.cpp @@ -15,11 +15,11 @@ struct Element { unsigned c; }; -class LlvmLibcBlockStoreTest : public __llvm_libc::testing::Test { +class LlvmLibcBlockStoreTest : public LIBC_NAMESPACE::testing::Test { public: template void populate_and_iterate() { - __llvm_libc::cpp::BlockStore block_store; + LIBC_NAMESPACE::cpp::BlockStore block_store; for (int i = 0; i < int(ELEMENT_COUNT); ++i) ASSERT_TRUE(block_store.push_back({i, 2 * i, 3 * unsigned(i)})); auto end = block_store.end(); @@ -38,12 +38,12 @@ public: } } ASSERT_EQ(i, int(ELEMENT_COUNT)); - __llvm_libc::cpp::BlockStore::destroy( + LIBC_NAMESPACE::cpp::BlockStore::destroy( &block_store); } template void back_test() { - using __llvm_libc::cpp::BlockStore; + using LIBC_NAMESPACE::cpp::BlockStore; BlockStore block_store; for (int i = 0; i < 20; i++) ASSERT_TRUE(block_store.push_back(i)); @@ -53,7 +53,7 @@ public: } template void empty_test() { - using __llvm_libc::cpp::BlockStore; + using LIBC_NAMESPACE::cpp::BlockStore; BlockStore block_store; ASSERT_TRUE(block_store.empty()); diff --git a/libc/test/src/__support/char_vector_test.cpp b/libc/test/src/__support/char_vector_test.cpp index 3d60092b504ef43237784cbd7405a9ac7e72b3f4..ea41d534e64cc6ab495803884dd30c06dfdbe3d7 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 42296a68240207bc72f8166be48773ef61df6f6d..4d95c03cf1398d5ba1129050949a815295e52645 100644 --- a/libc/test/src/__support/endian_test.cpp +++ b/libc/test/src/__support/endian_test.cpp @@ -9,7 +9,7 @@ #include "src/__support/endian.h" #include "test/UnitTest/Test.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { struct LlvmLibcEndian : testing::Test { template void check(const T original, const T swapped) { @@ -52,4 +52,4 @@ TEST_F(LlvmLibcEndian, uint64_t) { check(original, swapped); } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/src/__support/fixedvector_test.cpp b/libc/test/src/__support/fixedvector_test.cpp index bc1ee3819c4793a6801ae57b3340cd2269ca5fb8..a70ebfabed227009f9d4da30b133d6290a32f6d8 100644 --- a/libc/test/src/__support/fixedvector_test.cpp +++ b/libc/test/src/__support/fixedvector_test.cpp @@ -10,7 +10,7 @@ #include "test/UnitTest/Test.h" TEST(LlvmLibcFixedVectorTest, PushAndPop) { - __llvm_libc::FixedVector fixed_vector; + LIBC_NAMESPACE::FixedVector fixed_vector; ASSERT_TRUE(fixed_vector.empty()); for (int i = 0; i < 20; i++) ASSERT_TRUE(fixed_vector.push_back(i)); @@ -25,7 +25,7 @@ TEST(LlvmLibcFixedVectorTest, PushAndPop) { } TEST(LlvmLibcFixedVectorTest, Reset) { - __llvm_libc::FixedVector fixed_vector; + LIBC_NAMESPACE::FixedVector fixed_vector; ASSERT_TRUE(fixed_vector.empty()); for (int i = 0; i < 20; i++) ASSERT_TRUE(fixed_vector.push_back(i)); @@ -35,11 +35,11 @@ TEST(LlvmLibcFixedVectorTest, Reset) { } TEST(LlvmLibcFixedVectorTest, Destroy) { - __llvm_libc::FixedVector fixed_vector; + LIBC_NAMESPACE::FixedVector fixed_vector; ASSERT_TRUE(fixed_vector.empty()); for (int i = 0; i < 20; i++) ASSERT_TRUE(fixed_vector.push_back(i)); ASSERT_FALSE(fixed_vector.empty()); - __llvm_libc::FixedVector::destroy(&fixed_vector); + LIBC_NAMESPACE::FixedVector::destroy(&fixed_vector); ASSERT_TRUE(fixed_vector.empty()); } diff --git a/libc/test/src/__support/high_precision_decimal_test.cpp b/libc/test/src/__support/high_precision_decimal_test.cpp index abe4a604b4a390998dc2e04978eeaec10dcba662..a9c039e45774e9b1fe1830ff6b405de1e3ce8fe6 100644 --- a/libc/test/src/__support/high_precision_decimal_test.cpp +++ b/libc/test/src/__support/high_precision_decimal_test.cpp @@ -12,8 +12,8 @@ #include "test/UnitTest/Test.h" TEST(LlvmLibcHighPrecisionDecimalTest, BasicInit) { - __llvm_libc::internal::HighPrecisionDecimal hpd = - __llvm_libc::internal::HighPrecisionDecimal("1.2345"); + LIBC_NAMESPACE::internal::HighPrecisionDecimal hpd = + LIBC_NAMESPACE::internal::HighPrecisionDecimal("1.2345"); uint8_t *digits = hpd.get_digits(); EXPECT_EQ(digits[0], uint8_t(1)); @@ -26,8 +26,8 @@ TEST(LlvmLibcHighPrecisionDecimalTest, BasicInit) { } TEST(LlvmLibcHighPrecisionDecimalTest, BasicShift) { - __llvm_libc::internal::HighPrecisionDecimal hpd = - __llvm_libc::internal::HighPrecisionDecimal("1"); + LIBC_NAMESPACE::internal::HighPrecisionDecimal hpd = + LIBC_NAMESPACE::internal::HighPrecisionDecimal("1"); uint8_t *digits = hpd.get_digits(); hpd.shift(1); // shift left 1, equal to multiplying by 2. @@ -38,8 +38,8 @@ TEST(LlvmLibcHighPrecisionDecimalTest, BasicShift) { } TEST(LlvmLibcHighPrecisionDecimalTest, ShouldRoundup) { - __llvm_libc::internal::HighPrecisionDecimal hpd = - __llvm_libc::internal::HighPrecisionDecimal(".5"); + LIBC_NAMESPACE::internal::HighPrecisionDecimal hpd = + LIBC_NAMESPACE::internal::HighPrecisionDecimal(".5"); uint8_t *digits = hpd.get_digits(); EXPECT_EQ(digits[0], uint8_t(5)); @@ -49,8 +49,8 @@ TEST(LlvmLibcHighPrecisionDecimalTest, ShouldRoundup) { } TEST(LlvmLibcHighPrecisionDecimalTest, SmallShift) { - __llvm_libc::internal::HighPrecisionDecimal hpd = - __llvm_libc::internal::HighPrecisionDecimal("1.2345"); + LIBC_NAMESPACE::internal::HighPrecisionDecimal hpd = + LIBC_NAMESPACE::internal::HighPrecisionDecimal("1.2345"); uint8_t *digits = hpd.get_digits(); hpd.shift(-1); // shift right one, equal to dividing by 2 @@ -98,8 +98,8 @@ TEST(LlvmLibcHighPrecisionDecimalTest, SmallShift) { } TEST(LlvmLibcHighPrecisionDecimalTest, MediumShift) { - __llvm_libc::internal::HighPrecisionDecimal hpd = - __llvm_libc::internal::HighPrecisionDecimal(".299792458"); + LIBC_NAMESPACE::internal::HighPrecisionDecimal hpd = + LIBC_NAMESPACE::internal::HighPrecisionDecimal(".299792458"); uint8_t *digits = hpd.get_digits(); hpd.shift(-3); // shift right three, equal to dividing by 8 @@ -135,8 +135,8 @@ TEST(LlvmLibcHighPrecisionDecimalTest, MediumShift) { } TEST(LlvmLibcHighPrecisionDecimalTest, BigShift) { - __llvm_libc::internal::HighPrecisionDecimal hpd = - __llvm_libc::internal::HighPrecisionDecimal(".299792458"); + LIBC_NAMESPACE::internal::HighPrecisionDecimal hpd = + LIBC_NAMESPACE::internal::HighPrecisionDecimal(".299792458"); uint8_t *digits = hpd.get_digits(); hpd.shift(-29); // shift right 29, equal to dividing by 536,870,912 @@ -190,8 +190,8 @@ TEST(LlvmLibcHighPrecisionDecimalTest, BigShift) { } TEST(LlvmLibcHighPrecisionDecimalTest, BigShiftInSteps) { - __llvm_libc::internal::HighPrecisionDecimal hpd = - __llvm_libc::internal::HighPrecisionDecimal("1"); + LIBC_NAMESPACE::internal::HighPrecisionDecimal hpd = + LIBC_NAMESPACE::internal::HighPrecisionDecimal("1"); uint8_t *digits = hpd.get_digits(); hpd.shift(60); // shift left 60, equal to multiplying by @@ -287,8 +287,8 @@ TEST(LlvmLibcHighPrecisionDecimalTest, BigShiftInSteps) { } TEST(LlvmLibcHighPrecisionDecimalTest, VeryBigShift) { - __llvm_libc::internal::HighPrecisionDecimal hpd = - __llvm_libc::internal::HighPrecisionDecimal("1"); + LIBC_NAMESPACE::internal::HighPrecisionDecimal hpd = + LIBC_NAMESPACE::internal::HighPrecisionDecimal("1"); uint8_t *digits = hpd.get_digits(); hpd.shift(100); // shift left 100, equal to multiplying by @@ -340,8 +340,8 @@ TEST(LlvmLibcHighPrecisionDecimalTest, VeryBigShift) { } TEST(LlvmLibcHighPrecisionDecimalTest, RoundingTest) { - __llvm_libc::internal::HighPrecisionDecimal hpd = - __llvm_libc::internal::HighPrecisionDecimal("1.2345"); + LIBC_NAMESPACE::internal::HighPrecisionDecimal hpd = + LIBC_NAMESPACE::internal::HighPrecisionDecimal("1.2345"); EXPECT_EQ(hpd.round_to_integer_type(), uint32_t(1)); EXPECT_EQ(hpd.round_to_integer_type(), uint64_t(1)); @@ -360,7 +360,7 @@ TEST(LlvmLibcHighPrecisionDecimalTest, RoundingTest) { EXPECT_EQ(hpd.round_to_integer_type(), UInt128(5)); // 2.5 is right between two integers, so we round to even (2) - hpd = __llvm_libc::internal::HighPrecisionDecimal("2.5"); + hpd = LIBC_NAMESPACE::internal::HighPrecisionDecimal("2.5"); EXPECT_EQ(hpd.round_to_integer_type(), uint32_t(2)); EXPECT_EQ(hpd.round_to_integer_type(), uint64_t(2)); @@ -378,13 +378,13 @@ TEST(LlvmLibcHighPrecisionDecimalTest, RoundingTest) { // handled, so int types that are too small are ignored for this test.) // 1099511627776 = 2^40 - hpd = __llvm_libc::internal::HighPrecisionDecimal("1099511627776"); + hpd = LIBC_NAMESPACE::internal::HighPrecisionDecimal("1099511627776"); EXPECT_EQ(hpd.round_to_integer_type(), uint64_t(1099511627776)); EXPECT_EQ(hpd.round_to_integer_type(), UInt128(1099511627776)); // 1267650600228229401496703205376 = 2^100 - hpd = __llvm_libc::internal::HighPrecisionDecimal( + hpd = LIBC_NAMESPACE::internal::HighPrecisionDecimal( "1267650600228229401496703205376"); UInt128 result = UInt128(1) << 100; @@ -393,15 +393,15 @@ TEST(LlvmLibcHighPrecisionDecimalTest, RoundingTest) { } TEST(LlvmLibcHighPrecisionDecimalTest, BigExpTest) { - __llvm_libc::internal::HighPrecisionDecimal big_hpd = - __llvm_libc::internal::HighPrecisionDecimal("1e123456789"); + LIBC_NAMESPACE::internal::HighPrecisionDecimal big_hpd = + LIBC_NAMESPACE::internal::HighPrecisionDecimal("1e123456789"); // We need to add one to handle the digit before the decimal point in our // number. EXPECT_EQ(big_hpd.get_decimal_point(), 123456789 + 1); - __llvm_libc::internal::HighPrecisionDecimal big_negative_hpd = - __llvm_libc::internal::HighPrecisionDecimal("1e-123456789"); + LIBC_NAMESPACE::internal::HighPrecisionDecimal big_negative_hpd = + LIBC_NAMESPACE::internal::HighPrecisionDecimal("1e-123456789"); // Same, but since the number is negative the net result is -123456788 EXPECT_EQ(big_negative_hpd.get_decimal_point(), -123456789 + 1); diff --git a/libc/test/src/__support/integer_to_string_test.cpp b/libc/test/src/__support/integer_to_string_test.cpp index 991582e896d2fedf0f89c914323f1cdfc67b830e..c8913bf461bb36077dd6e5ba96bd53bda1ec1c7c 100644 --- a/libc/test/src/__support/integer_to_string_test.cpp +++ b/libc/test/src/__support/integer_to_string_test.cpp @@ -16,14 +16,14 @@ #include "limits.h" -using __llvm_libc::IntegerToString; -using __llvm_libc::cpp::span; -using __llvm_libc::cpp::string_view; -using __llvm_libc::radix::Bin; -using __llvm_libc::radix::Custom; -using __llvm_libc::radix::Dec; -using __llvm_libc::radix::Hex; -using __llvm_libc::radix::Oct; +using LIBC_NAMESPACE::IntegerToString; +using LIBC_NAMESPACE::cpp::span; +using LIBC_NAMESPACE::cpp::string_view; +using LIBC_NAMESPACE::radix::Bin; +using LIBC_NAMESPACE::radix::Custom; +using LIBC_NAMESPACE::radix::Dec; +using LIBC_NAMESPACE::radix::Hex; +using LIBC_NAMESPACE::radix::Oct; #define EXPECT(type, value, string_value) \ { \ @@ -225,7 +225,7 @@ TEST(LlvmLibcIntegerToStringTest, UINT64_Base_36) { } TEST(LlvmLibcIntegerToStringTest, UINT256_Base_16) { - using UInt256 = __llvm_libc::cpp::UInt<256>; + using UInt256 = LIBC_NAMESPACE::cpp::UInt<256>; using type = IntegerToString>; EXPECT(type, static_cast(0), "0000000000000000000000000000000000000000000000000000000000000000"); diff --git a/libc/test/src/__support/str_to_float_test.cpp b/libc/test/src/__support/str_to_float_test.cpp index 4ebdb33549ef621bc86df93365f08a9282e3615b..ae729418ebe363906b70592442318c53adde7d8d 100644 --- a/libc/test/src/__support/str_to_float_test.cpp +++ b/libc/test/src/__support/str_to_float_test.cpp @@ -13,20 +13,20 @@ #include "test/UnitTest/Test.h" -class LlvmLibcStrToFloatTest : public __llvm_libc::testing::Test { +class LlvmLibcStrToFloatTest : public LIBC_NAMESPACE::testing::Test { public: template void clinger_fast_path_test( - const typename __llvm_libc::fputil::FPBits::UIntType inputMantissa, + const typename LIBC_NAMESPACE::fputil::FPBits::UIntType inputMantissa, const int32_t inputExp10, - const typename __llvm_libc::fputil::FPBits::UIntType + const typename LIBC_NAMESPACE::fputil::FPBits::UIntType expectedOutputMantissa, const uint32_t expectedOutputExp2) { - typename __llvm_libc::fputil::FPBits::UIntType actual_output_mantissa = - 0; + typename LIBC_NAMESPACE::fputil::FPBits::UIntType + actual_output_mantissa = 0; uint32_t actual_output_exp2 = 0; - auto result = __llvm_libc::internal::clinger_fast_path( + auto result = LIBC_NAMESPACE::internal::clinger_fast_path( {inputMantissa, inputExp10}); ASSERT_TRUE(result.has_value()); @@ -40,26 +40,26 @@ public: template void clinger_fast_path_fails_test( - const typename __llvm_libc::fputil::FPBits::UIntType inputMantissa, + const typename LIBC_NAMESPACE::fputil::FPBits::UIntType inputMantissa, const int32_t inputExp10) { - ASSERT_FALSE( - __llvm_libc::internal::clinger_fast_path({inputMantissa, inputExp10}) - .has_value()); + ASSERT_FALSE(LIBC_NAMESPACE::internal::clinger_fast_path( + {inputMantissa, inputExp10}) + .has_value()); } template void eisel_lemire_test( - const typename __llvm_libc::fputil::FPBits::UIntType inputMantissa, + const typename LIBC_NAMESPACE::fputil::FPBits::UIntType inputMantissa, const int32_t inputExp10, - const typename __llvm_libc::fputil::FPBits::UIntType + const typename LIBC_NAMESPACE::fputil::FPBits::UIntType expectedOutputMantissa, const uint32_t expectedOutputExp2) { - typename __llvm_libc::fputil::FPBits::UIntType actual_output_mantissa = - 0; + typename LIBC_NAMESPACE::fputil::FPBits::UIntType + actual_output_mantissa = 0; uint32_t actual_output_exp2 = 0; auto result = - __llvm_libc::internal::eisel_lemire({inputMantissa, inputExp10}); + LIBC_NAMESPACE::internal::eisel_lemire({inputMantissa, inputExp10}); ASSERT_TRUE(result.has_value()); @@ -73,15 +73,16 @@ public: template void simple_decimal_conversion_test( const char *__restrict numStart, - const typename __llvm_libc::fputil::FPBits::UIntType + const typename LIBC_NAMESPACE::fputil::FPBits::UIntType expectedOutputMantissa, const uint32_t expectedOutputExp2, const int expectedErrno = 0) { - typename __llvm_libc::fputil::FPBits::UIntType actual_output_mantissa = - 0; + typename LIBC_NAMESPACE::fputil::FPBits::UIntType + actual_output_mantissa = 0; uint32_t actual_output_exp2 = 0; libc_errno = 0; - auto result = __llvm_libc::internal::simple_decimal_conversion(numStart); + auto result = + LIBC_NAMESPACE::internal::simple_decimal_conversion(numStart); actual_output_mantissa = result.num.mantissa; actual_output_exp2 = result.num.exponent; @@ -95,39 +96,40 @@ public: TEST(LlvmLibcStrToFloatTest, LeadingZeroes) { uint64_t test_num64 = 1; uint32_t num_of_zeroes = 63; - EXPECT_EQ(__llvm_libc::internal::leading_zeroes(0), 64u); + EXPECT_EQ(LIBC_NAMESPACE::internal::leading_zeroes(0), 64u); for (; num_of_zeroes < 64; test_num64 <<= 1, num_of_zeroes--) { - EXPECT_EQ(__llvm_libc::internal::leading_zeroes(test_num64), + EXPECT_EQ(LIBC_NAMESPACE::internal::leading_zeroes(test_num64), num_of_zeroes); } test_num64 = 3; num_of_zeroes = 62; for (; num_of_zeroes > 63; test_num64 <<= 1, num_of_zeroes--) { - EXPECT_EQ(__llvm_libc::internal::leading_zeroes(test_num64), + EXPECT_EQ(LIBC_NAMESPACE::internal::leading_zeroes(test_num64), num_of_zeroes); } - EXPECT_EQ(__llvm_libc::internal::leading_zeroes(0xffffffffffffffff), - 0u); + EXPECT_EQ( + LIBC_NAMESPACE::internal::leading_zeroes(0xffffffffffffffff), + 0u); test_num64 = 1; num_of_zeroes = 63; for (; num_of_zeroes > 63; test_num64 = (test_num64 << 1) + 1, num_of_zeroes--) { - EXPECT_EQ(__llvm_libc::internal::leading_zeroes(test_num64), + EXPECT_EQ(LIBC_NAMESPACE::internal::leading_zeroes(test_num64), num_of_zeroes); } uint64_t test_num32 = 1; num_of_zeroes = 31; - EXPECT_EQ(__llvm_libc::internal::leading_zeroes(0), 32u); + EXPECT_EQ(LIBC_NAMESPACE::internal::leading_zeroes(0), 32u); for (; num_of_zeroes < 32; test_num32 <<= 1, num_of_zeroes--) { - EXPECT_EQ(__llvm_libc::internal::leading_zeroes(test_num32), + EXPECT_EQ(LIBC_NAMESPACE::internal::leading_zeroes(test_num32), num_of_zeroes); } - EXPECT_EQ(__llvm_libc::internal::leading_zeroes(0xffffffff), 0u); + EXPECT_EQ(LIBC_NAMESPACE::internal::leading_zeroes(0xffffffff), 0u); } TEST_F(LlvmLibcStrToFloatTest, ClingerFastPathFloat64Simple) { @@ -188,11 +190,11 @@ TEST_F(LlvmLibcStrToFloatTest, EiselLemireFallbackStates) { // from both of its closest floating point approximations // (12345678901234548736 and 12345678901234550784) ASSERT_FALSE( - __llvm_libc::internal::eisel_lemire({12345678901234549760u, 0}) + LIBC_NAMESPACE::internal::eisel_lemire({12345678901234549760u, 0}) .has_value()); ASSERT_FALSE( - __llvm_libc::internal::eisel_lemire({20040229, 0}).has_value()); + LIBC_NAMESPACE::internal::eisel_lemire({20040229, 0}).has_value()); } TEST_F(LlvmLibcStrToFloatTest, SimpleDecimalConversion64BasicWholeNumbers) { @@ -252,8 +254,9 @@ TEST(LlvmLibcStrToFloatTest, SimpleDecimalConversionExtraTypes) { uint32_t output_exp2 = 0; libc_errno = 0; - auto float_result = __llvm_libc::internal::simple_decimal_conversion( - "123456789012345678900"); + auto float_result = + LIBC_NAMESPACE::internal::simple_decimal_conversion( + "123456789012345678900"); float_output_mantissa = float_result.num.mantissa; output_exp2 = float_result.num.exponent; EXPECT_EQ(float_output_mantissa, uint32_t(0xd629d4)); @@ -264,8 +267,9 @@ TEST(LlvmLibcStrToFloatTest, SimpleDecimalConversionExtraTypes) { output_exp2 = 0; libc_errno = 0; - auto double_result = __llvm_libc::internal::simple_decimal_conversion( - "123456789012345678900"); + auto double_result = + LIBC_NAMESPACE::internal::simple_decimal_conversion( + "123456789012345678900"); double_output_mantissa = double_result.num.mantissa; output_exp2 = double_result.num.exponent; @@ -314,16 +318,16 @@ TEST_F(LlvmLibcStrToFloatTest, EiselLemireFloat80TableLimits) { TEST_F(LlvmLibcStrToFloatTest, EiselLemireFloat80Fallback) { // This number is halfway between two possible results, and the algorithm // can't determine which is correct. - ASSERT_FALSE(__llvm_libc::internal::eisel_lemire( + ASSERT_FALSE(LIBC_NAMESPACE::internal::eisel_lemire( {12345678901234567890u, 1}) .has_value()); // These numbers' exponents are out of range for the current powers of ten // table. - ASSERT_FALSE( - __llvm_libc::internal::eisel_lemire({1, 1000}).has_value()); - ASSERT_FALSE( - __llvm_libc::internal::eisel_lemire({1, -1000}).has_value()); + ASSERT_FALSE(LIBC_NAMESPACE::internal::eisel_lemire({1, 1000}) + .has_value()); + ASSERT_FALSE(LIBC_NAMESPACE::internal::eisel_lemire({1, -1000}) + .has_value()); } #else // Quad precision long double TEST_F(LlvmLibcStrToFloatTest, EiselLemireFloat128Simple) { @@ -348,7 +352,7 @@ TEST_F(LlvmLibcStrToFloatTest, EiselLemireFloat128LongerMantissa) { TEST_F(LlvmLibcStrToFloatTest, EiselLemireFloat128Fallback) { ASSERT_FALSE( - __llvm_libc::internal::eisel_lemire( + LIBC_NAMESPACE::internal::eisel_lemire( {(UInt128(0x5ce0e9a56015fec5) << 64) + UInt128(0xaadfa328ae39b333), 1}) .has_value()); diff --git a/libc/test/src/__support/uint_test.cpp b/libc/test/src/__support/uint_test.cpp index 3fe9b26bc425603b755f5ccf5cc2a112b136cf15..971bac55bd9d3f1c00fccac8bbffd1c2fbd7fe67 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 8a896494e29f74ad36f0ee1e9ea4ad638563184c..d5d25506053405c3641ae9b03d233eeed7e30c19 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 d44263a6ea7d15d63f24ab13f8cc888c35a44e6c..b71d36111d725603699094c995073022e379ec76 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 916aae3ecd05e553426af355101bb6bb4366ee79..10cdb962ee2ee5f2df495a57c6684c58127ad07b 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 80b0b1c162675fccdb1671033ab975c7294ba3d5..646756eb0861b59e1e2acf42b4b12e1736b22a43 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 f34e0cb37be97b72139a3c5ce7476bd1a9aabaca..97041fbc8fd863755514a49929369f82ca8caaf6 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 89b0c9a1490791b63934fafdfeca74b8d76ce082..f8a0804cefbd2f84b14be724602275512173d55c 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 fd49475f5bc0c9c6318fa4012cb6133679604814..a9f84db3ef7e879e8f9102428ddfc39a3c8a62f5 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 7c3ed36d9ec9e2cabb063f93944274cc4372ea34..4d57d677fc4ba5c97996f77f127aa6aa8d22e080 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 c399cc4e6d59adfcbc68c737b947da1fd48535ac..ba7caf65b6fd39bf02b0ab8c225474b838948f82 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 08963209c1d4cb0a9cc705530709f26b5e0dbee6..48378c45e1ef986d2c5bf79a6799cd4f1abba869 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 3b82e1958d768a5ef60cb97906d54a35cfcfd600..ecf78e1eb9b4693c27de10b5c8be25de63ecc491 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 9777bb24fc1a7a35fa70348058a4a1402bf08dee..6e11919100ec98430350b557525954588e873df0 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 5407c763528e725d70d850b1492c8a145cfe6391..05b2fd069ef069220e48dece119612f27525cef0 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 b98d3bde6d064a462234eb5aa9ee784178a531cc..b8f27a968540cbc02bb940934dda3d4fbb4b6b64 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 d5dde8c85d6176289089142c3c2e3bbe9ee66833..92f807242617728e0409cae632f95d4f15c39822 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 2c2b7d966202afea00066c84cdb6f212d69bf7b9..3770ce4ea68b697241f8229f172c880a0b142038 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 d0879d48e77fdedf4b3df7063d13b8497dc6fe26..0413b43fb6009b4265bfacdab50150083f163c8b 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 72f9f4632c8dc7fe574d1dc0127683d5594a7383..ff1a30a2639fe252c7b1df3d58056a3d44fd6a54 100644 --- a/libc/test/src/dirent/dirent_test.cpp +++ b/libc/test/src/dirent/dirent_test.cpp @@ -17,20 +17,20 @@ #include -using string_view = __llvm_libc::cpp::string_view; +using string_view = LIBC_NAMESPACE::cpp::string_view; TEST(LlvmLibcDirentTest, SimpleOpenAndRead) { - ::DIR *dir = __llvm_libc::opendir("testdata"); + ::DIR *dir = LIBC_NAMESPACE::opendir("testdata"); ASSERT_TRUE(dir != nullptr); // The file descriptors 0, 1 and 2 are reserved for standard streams. // So, the file descriptor for the newly opened directory should be // greater than 2. - ASSERT_GT(__llvm_libc::dirfd(dir), 2); + ASSERT_GT(LIBC_NAMESPACE::dirfd(dir), 2); struct ::dirent *file1 = nullptr, *file2 = nullptr, *dir1 = nullptr, *dir2 = nullptr; while (true) { - struct ::dirent *d = __llvm_libc::readdir(dir); + struct ::dirent *d = LIBC_NAMESPACE::readdir(dir); if (d == nullptr) break; if (string_view(&d->d_name[0]) == "file1.txt") @@ -51,12 +51,12 @@ TEST(LlvmLibcDirentTest, SimpleOpenAndRead) { ASSERT_TRUE(dir1 != nullptr); ASSERT_TRUE(dir2 != nullptr); - ASSERT_EQ(__llvm_libc::closedir(dir), 0); + ASSERT_EQ(LIBC_NAMESPACE::closedir(dir), 0); } TEST(LlvmLibcDirentTest, OpenNonExistentDir) { libc_errno = 0; - ::DIR *dir = __llvm_libc::opendir("___xyz123__.non_existent__"); + ::DIR *dir = LIBC_NAMESPACE::opendir("___xyz123__.non_existent__"); ASSERT_TRUE(dir == nullptr); ASSERT_EQ(libc_errno, ENOENT); libc_errno = 0; @@ -64,7 +64,7 @@ TEST(LlvmLibcDirentTest, OpenNonExistentDir) { TEST(LlvmLibcDirentTest, OpenFile) { libc_errno = 0; - ::DIR *dir = __llvm_libc::opendir("testdata/file1.txt"); + ::DIR *dir = LIBC_NAMESPACE::opendir("testdata/file1.txt"); ASSERT_TRUE(dir == nullptr); ASSERT_EQ(libc_errno, ENOTDIR); libc_errno = 0; diff --git a/libc/test/src/fcntl/creat_test.cpp b/libc/test/src/fcntl/creat_test.cpp index 1b0e8cb43a92ff510e0597b69110c0a8dc998917..ca926b30e62faf72134abfaf973d372765fafe3b 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 73cce41563b9092f1be67d599f656071c28de9ed..b95f3f212720116b3abd9f151478b97b8fdb8ad9 100644 --- a/libc/test/src/fcntl/openat_test.cpp +++ b/libc/test/src/fcntl/openat_test.cpp @@ -17,27 +17,27 @@ #include TEST(LlvmLibcUniStd, OpenAndReadTest) { - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; constexpr const char *TEST_DIR = "testdata"; constexpr const char *TEST_FILE = "openat.test"; - int dir_fd = __llvm_libc::open(TEST_DIR, O_DIRECTORY); + int dir_fd = LIBC_NAMESPACE::open(TEST_DIR, O_DIRECTORY); ASSERT_EQ(libc_errno, 0); ASSERT_GT(dir_fd, 0); constexpr const char TEST_MSG[] = "openat test"; constexpr int TEST_MSG_SIZE = sizeof(TEST_MSG) - 1; - int read_fd = __llvm_libc::openat(dir_fd, TEST_FILE, O_RDONLY); + int read_fd = LIBC_NAMESPACE::openat(dir_fd, TEST_FILE, O_RDONLY); ASSERT_EQ(libc_errno, 0); ASSERT_GT(read_fd, 0); char read_buf[TEST_MSG_SIZE]; - ASSERT_THAT(__llvm_libc::read(read_fd, read_buf, TEST_MSG_SIZE), + ASSERT_THAT(LIBC_NAMESPACE::read(read_fd, read_buf, TEST_MSG_SIZE), Succeeds(TEST_MSG_SIZE)); - ASSERT_THAT(__llvm_libc::close(read_fd), Succeeds(0)); - ASSERT_THAT(__llvm_libc::close(dir_fd), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(read_fd), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(dir_fd), Succeeds(0)); } TEST(LlvmLibcUniStd, FailTest) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - EXPECT_THAT(__llvm_libc::openat(AT_FDCWD, "openat.test", O_RDONLY), + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + EXPECT_THAT(LIBC_NAMESPACE::openat(AT_FDCWD, "openat.test", O_RDONLY), Fails(ENOENT)); } diff --git a/libc/test/src/fenv/enabled_exceptions_test.cpp b/libc/test/src/fenv/enabled_exceptions_test.cpp index bb0c572da7541dc467e7cda1c02cde149afac093..f9509202ab680edc90d2957b3cb7d7d1af301ca7 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 9d26fe7b93ba65055d74bafab20a694fae8c6c95..434adc06b1a36a94fdf4f74b4abd6df1255ab2b7 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 3563187c917e04fe2d19e5a57902b1fe1e106efa..e4e2240fc374c83e4038c0d5b6d349096b8b5560 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 80414b2d2cd850c17e46f2054ecc04335904839c..fa3e856d1ba200d58281e56926939584e0556b62 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 c27a2bff6a0387205cc0695de563c315602e3f1c..c891a552d40cfe2235bd8b441ae20c0825b18530 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 40e336ef41af3b1a7d00c74977ae10fa06c802d1..fe23ef23226ad40448c47125601718189e21e1e5 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 1b3884a7337fe7dcc935d1e54d3073a725aa7c4b..96f253f76077a0f24db26c1bcba2aabc23e71482 100644 --- a/libc/test/src/fenv/feupdateenv_test.cpp +++ b/libc/test/src/fenv/feupdateenv_test.cpp @@ -15,13 +15,13 @@ #include TEST(LlvmLibcFEnvTest, UpdateEnvTest) { - __llvm_libc::fputil::disable_except(FE_ALL_EXCEPT); - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); + LIBC_NAMESPACE::fputil::disable_except(FE_ALL_EXCEPT); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); fenv_t env; - ASSERT_EQ(__llvm_libc::fputil::get_env(&env), 0); - __llvm_libc::fputil::set_except(FE_INVALID | FE_INEXACT); - ASSERT_EQ(__llvm_libc::feupdateenv(&env), 0); - ASSERT_EQ(__llvm_libc::fputil::test_except(FE_INVALID | FE_INEXACT), + ASSERT_EQ(LIBC_NAMESPACE::fputil::get_env(&env), 0); + LIBC_NAMESPACE::fputil::set_except(FE_INVALID | FE_INEXACT); + ASSERT_EQ(LIBC_NAMESPACE::feupdateenv(&env), 0); + ASSERT_EQ(LIBC_NAMESPACE::fputil::test_except(FE_INVALID | FE_INEXACT), FE_INVALID | FE_INEXACT); } diff --git a/libc/test/src/fenv/getenv_and_setenv_test.cpp b/libc/test/src/fenv/getenv_and_setenv_test.cpp index 5fe21325e1e791227813dd52e88fe83e18798b89..8184a5c3bb9997a0c2799ad6ab81bbce25580489 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 0f03b5f50cf915aece59a7069f28eecef48963f1..4560160e8e2e9b06f34ea908243cc8a63f331459 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 7c9870495c35a4b6b263028c9c0f6fb4bc8b2b71..8d3a8a2984bb4678061fe2e5faeb73f381fb8395 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 321aad5d0ebc51c5aa1e83891784232c327f3da3..59eb1d71158d092c4111583727db4896d6d9160b 100644 --- a/libc/test/src/inttypes/imaxdiv_test.cpp +++ b/libc/test/src/inttypes/imaxdiv_test.cpp @@ -12,4 +12,4 @@ #include -LIST_DIV_TESTS(intmax_t, imaxdiv_t, __llvm_libc::imaxdiv) +LIST_DIV_TESTS(intmax_t, imaxdiv_t, LIBC_NAMESPACE::imaxdiv) diff --git a/libc/test/src/inttypes/strtoimax_test.cpp b/libc/test/src/inttypes/strtoimax_test.cpp index 3947e684fbbcab3149fe43d7c9bfef3e279506eb..de76d621d268dcafff787acc60daccd41c44b07d 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 77c6dedf6b98d1413db661c11f05958a0d803564..82d7be92bb1d35ee5e6180f6fd5fb2d79ba5315e 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 78c1a08b9c82eaa333440d10e633862701f2e974..d1e2b2e6fd17d4f8bf9a8e7af57d60b0a6f715cd 100644 --- a/libc/test/src/math/CeilTest.h +++ b/libc/test/src/math/CeilTest.h @@ -12,9 +12,9 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template class CeilTest : public __llvm_libc::testing::Test { +template class CeilTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/CopySignTest.h b/libc/test/src/math/CopySignTest.h index 3d1eed1b066242b500303e7d1b8b48a20894eb19..aecd012d1d524a17a6f4436e0f5c700487b0f819 100644 --- a/libc/test/src/math/CopySignTest.h +++ b/libc/test/src/math/CopySignTest.h @@ -12,9 +12,10 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template class CopySignTest : public __llvm_libc::testing::Test { +template +class CopySignTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/FAbsTest.h b/libc/test/src/math/FAbsTest.h index 38b09cff19e2ddaf092ee9a9223d7342d2c1d9dc..3342926142ff1fb2e889c2689f261a63ab55010f 100644 --- a/libc/test/src/math/FAbsTest.h +++ b/libc/test/src/math/FAbsTest.h @@ -12,9 +12,9 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template class FAbsTest : public __llvm_libc::testing::Test { +template class FAbsTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/FDimTest.h b/libc/test/src/math/FDimTest.h index c0dbda10b318b9744147de1c5bff137526979827..3118c3661013e7cf97101e8cdb28adba09145972 100644 --- a/libc/test/src/math/FDimTest.h +++ b/libc/test/src/math/FDimTest.h @@ -13,10 +13,10 @@ #include template -class FDimTestTemplate : public __llvm_libc::testing::Test { +class FDimTestTemplate : public LIBC_NAMESPACE::testing::Test { public: using FuncPtr = T (*)(T, T); - using FPBits = __llvm_libc::fputil::FPBits; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; using UIntType = typename FPBits::UIntType; void test_na_n_arg(FuncPtr func) { @@ -74,9 +74,9 @@ 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::build_quiet_nan(1)); - const T inf = T(__llvm_libc::fputil::FPBits::inf()); - const T neg_inf = T(__llvm_libc::fputil::FPBits::neg_inf()); - const T zero = T(__llvm_libc::fputil::FPBits::zero()); - const T neg_zero = T(__llvm_libc::fputil::FPBits::neg_zero()); + const T nan = T(LIBC_NAMESPACE::fputil::FPBits::build_quiet_nan(1)); + const T inf = T(LIBC_NAMESPACE::fputil::FPBits::inf()); + const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits::neg_inf()); + const T zero = T(LIBC_NAMESPACE::fputil::FPBits::zero()); + const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits::neg_zero()); }; diff --git a/libc/test/src/math/FMaxTest.h b/libc/test/src/math/FMaxTest.h index 0a6c767588c11d71a784379a0eaf578f0dcbb1cb..e371086274acf7c71b8c45f451d9254775ee4e4e 100644 --- a/libc/test/src/math/FMaxTest.h +++ b/libc/test/src/math/FMaxTest.h @@ -12,9 +12,9 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template class FMaxTest : public __llvm_libc::testing::Test { +template class FMaxTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/FMinTest.h b/libc/test/src/math/FMinTest.h index 10c87f9d6a102d4e23723da83ec4ac469558fc5e..7f8393ac2b5e91011781fc8a2e0160458a595322 100644 --- a/libc/test/src/math/FMinTest.h +++ b/libc/test/src/math/FMinTest.h @@ -12,9 +12,9 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template class FMinTest : public __llvm_libc::testing::Test { +template class FMinTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/FModTest.h b/libc/test/src/math/FModTest.h index 6bff888294d2b0fa5c2522bf87df10967c247ad9..5fc0ebf6d33e40787a335e071b2236b823269f0a 100644 --- a/libc/test/src/math/FModTest.h +++ b/libc/test/src/math/FModTest.h @@ -21,11 +21,11 @@ EXPECT_FP_EQ(expected, f(x, y)); \ EXPECT_MATH_ERRNO((dom_err) ? EDOM : 0); \ EXPECT_FP_EXCEPTION(expected_exception); \ - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT) + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT) #define TEST_REGULAR(x, y, expected) TEST_SPECIAL(x, y, expected, false, 0) -template class FmodTest : public __llvm_libc::testing::Test { +template class FmodTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/FloorTest.h b/libc/test/src/math/FloorTest.h index ce1075af76995739dddc0a0f68de8007f0847195..843c70ba2baeb37a6ce773148083eab4780fb96d 100644 --- a/libc/test/src/math/FloorTest.h +++ b/libc/test/src/math/FloorTest.h @@ -12,9 +12,9 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template class FloorTest : public __llvm_libc::testing::Test { +template class FloorTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/FmaTest.h b/libc/test/src/math/FmaTest.h index 3a5ed2bf3e53bfceaa425debe233e73ed48465e5..c2573d03792692fa9d27481176c2bc96fad46dea 100644 --- a/libc/test/src/math/FmaTest.h +++ b/libc/test/src/math/FmaTest.h @@ -15,25 +15,25 @@ #include "test/src/math/RandUtils.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; template -class FmaTestTemplate : public __llvm_libc::testing::Test { +class FmaTestTemplate : public LIBC_NAMESPACE::testing::Test { private: using Func = T (*)(T, T, T); - using FPBits = __llvm_libc::fputil::FPBits; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; using UIntType = typename FPBits::UIntType; - const T nan = T(__llvm_libc::fputil::FPBits::build_quiet_nan(1)); - const T inf = T(__llvm_libc::fputil::FPBits::inf()); - const T neg_inf = T(__llvm_libc::fputil::FPBits::neg_inf()); - const T zero = T(__llvm_libc::fputil::FPBits::zero()); - const T neg_zero = T(__llvm_libc::fputil::FPBits::neg_zero()); + const T nan = T(LIBC_NAMESPACE::fputil::FPBits::build_quiet_nan(1)); + const T inf = T(LIBC_NAMESPACE::fputil::FPBits::inf()); + const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits::neg_inf()); + const T zero = T(LIBC_NAMESPACE::fputil::FPBits::zero()); + const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits::neg_zero()); UIntType get_random_bit_pattern() { UIntType bits{0}; for (UIntType i = 0; i < sizeof(UIntType) / 2; ++i) { - bits = - (bits << 2) + static_cast(__llvm_libc::testutils::rand()); + bits = (bits << 2) + + static_cast(LIBC_NAMESPACE::testutils::rand()); } return bits; } diff --git a/libc/test/src/math/FrexpTest.h b/libc/test/src/math/FrexpTest.h index 6bfb4d276e9854b75bfcbe4af028c3f0bac6e914..19c98872e0411671bf445d22f1dee1442ab543c6 100644 --- a/libc/test/src/math/FrexpTest.h +++ b/libc/test/src/math/FrexpTest.h @@ -13,14 +13,14 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template class FrexpTest : public __llvm_libc::testing::Test { +template class FrexpTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) static constexpr UIntType HIDDEN_BIT = - UIntType(1) << __llvm_libc::fputil::MantissaWidth::VALUE; + UIntType(1) << LIBC_NAMESPACE::fputil::MantissaWidth::VALUE; public: typedef T (*FrexpFunc)(T, int *); @@ -103,8 +103,8 @@ public: mpfr::BinaryOutput result; result.f = func(x, &result.i); - ASSERT_TRUE(__llvm_libc::fputil::abs(result.f) < 1.0); - ASSERT_TRUE(__llvm_libc::fputil::abs(result.f) >= 0.5); + ASSERT_TRUE(LIBC_NAMESPACE::fputil::abs(result.f) < 1.0); + ASSERT_TRUE(LIBC_NAMESPACE::fputil::abs(result.f) >= 0.5); ASSERT_MPFR_MATCH(mpfr::Operation::Frexp, x, result, 0.0); } } diff --git a/libc/test/src/math/HypotTest.h b/libc/test/src/math/HypotTest.h index d1409265c6709a1021053bede8e1aa1f9aff1a60..c01a771b9505fae054f25f09d384c87b2bfdcde3 100644 --- a/libc/test/src/math/HypotTest.h +++ b/libc/test/src/math/HypotTest.h @@ -16,13 +16,13 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; template -class HypotTestTemplate : public __llvm_libc::testing::Test { +class HypotTestTemplate : public LIBC_NAMESPACE::testing::Test { private: using Func = T (*)(T, T); - using FPBits = __llvm_libc::fputil::FPBits; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; using UIntType = typename FPBits::UIntType; const T nan = T(FPBits::build_quiet_nan(1)); const T inf = T(FPBits::inf()); diff --git a/libc/test/src/math/ILogbTest.h b/libc/test/src/math/ILogbTest.h index 6ad5eb065c8aa4475f57b27b5a88efcdc55179af..e51a5d7a2544cdc3877c8a93cb7c49d10563ddfd 100644 --- a/libc/test/src/math/ILogbTest.h +++ b/libc/test/src/math/ILogbTest.h @@ -16,7 +16,7 @@ #include -class LlvmLibcILogbTest : public __llvm_libc::testing::Test { +class LlvmLibcILogbTest : public LIBC_NAMESPACE::testing::Test { public: template struct ILogbFunc { typedef int (*Func)(T); @@ -24,14 +24,15 @@ public: template void test_special_numbers(typename ILogbFunc::Func func) { - EXPECT_EQ(FP_ILOGB0, func(T(__llvm_libc::fputil::FPBits::zero()))); - EXPECT_EQ(FP_ILOGB0, func(T(__llvm_libc::fputil::FPBits::neg_zero()))); + EXPECT_EQ(FP_ILOGB0, func(T(LIBC_NAMESPACE::fputil::FPBits::zero()))); + EXPECT_EQ(FP_ILOGB0, + func(T(LIBC_NAMESPACE::fputil::FPBits::neg_zero()))); EXPECT_EQ(FP_ILOGBNAN, - func(T(__llvm_libc::fputil::FPBits::build_quiet_nan(1)))); + func(T(LIBC_NAMESPACE::fputil::FPBits::build_quiet_nan(1)))); - EXPECT_EQ(INT_MAX, func(T(__llvm_libc::fputil::FPBits::inf()))); - EXPECT_EQ(INT_MAX, func(T(__llvm_libc::fputil::FPBits::neg_inf()))); + EXPECT_EQ(INT_MAX, func(T(LIBC_NAMESPACE::fputil::FPBits::inf()))); + EXPECT_EQ(INT_MAX, func(T(LIBC_NAMESPACE::fputil::FPBits::neg_inf()))); } template @@ -75,7 +76,7 @@ public: template void test_subnormal_range(typename ILogbFunc::Func func) { - using FPBits = __llvm_libc::fputil::FPBits; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; using UIntType = typename FPBits::UIntType; constexpr UIntType COUNT = 10'001; constexpr UIntType STEP = @@ -88,14 +89,14 @@ public: continue; int exponent; - __llvm_libc::fputil::frexp(x, exponent); + LIBC_NAMESPACE::fputil::frexp(x, exponent); ASSERT_EQ(exponent, func(x) + 1); } } template void test_normal_range(typename ILogbFunc::Func func) { - using FPBits = __llvm_libc::fputil::FPBits; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; using UIntType = typename FPBits::UIntType; constexpr UIntType COUNT = 10'001; constexpr UIntType STEP = @@ -106,7 +107,7 @@ 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 2e592995ae792e9b97e02434717e8bf77164bd3b..bffa7335fb25b17f206535adc602e83401dfc265 100644 --- a/libc/test/src/math/LdExpTest.h +++ b/libc/test/src/math/LdExpTest.h @@ -19,20 +19,20 @@ #include template -class LdExpTestTemplate : public __llvm_libc::testing::Test { - using FPBits = __llvm_libc::fputil::FPBits; - using NormalFloat = __llvm_libc::fputil::NormalFloat; +class LdExpTestTemplate : public LIBC_NAMESPACE::testing::Test { + using FPBits = LIBC_NAMESPACE::fputil::FPBits; + using NormalFloat = LIBC_NAMESPACE::fputil::NormalFloat; using UIntType = typename FPBits::UIntType; static constexpr UIntType MANTISSA_WIDTH = - __llvm_libc::fputil::MantissaWidth::VALUE; + LIBC_NAMESPACE::fputil::MantissaWidth::VALUE; // A normalized mantissa to be used with tests. static constexpr UIntType MANTISSA = NormalFloat::ONE + 0x1234; - const T zero = T(__llvm_libc::fputil::FPBits::zero()); - const T neg_zero = T(__llvm_libc::fputil::FPBits::neg_zero()); - const T inf = T(__llvm_libc::fputil::FPBits::inf()); - const T neg_inf = T(__llvm_libc::fputil::FPBits::neg_inf()); - const T nan = T(__llvm_libc::fputil::FPBits::build_quiet_nan(1)); + const T zero = T(LIBC_NAMESPACE::fputil::FPBits::zero()); + const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits::neg_zero()); + const T inf = T(LIBC_NAMESPACE::fputil::FPBits::inf()); + const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits::neg_inf()); + const T nan = T(LIBC_NAMESPACE::fputil::FPBits::build_quiet_nan(1)); public: typedef T (*LdExpFunc)(T, int); diff --git a/libc/test/src/math/LogbTest.h b/libc/test/src/math/LogbTest.h index b4a17fd9b0c34fa128901e5768d2736a4d62aab4..c2cf4f1f1483336cd34106c4529c614868e4276e 100644 --- a/libc/test/src/math/LogbTest.h +++ b/libc/test/src/math/LogbTest.h @@ -13,14 +13,14 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template class LogbTest : public __llvm_libc::testing::Test { +template class LogbTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) static constexpr UIntType HIDDEN_BIT = - UIntType(1) << __llvm_libc::fputil::MantissaWidth::VALUE; + UIntType(1) << LIBC_NAMESPACE::fputil::MantissaWidth::VALUE; public: typedef T (*LogbFunc)(T); @@ -80,7 +80,7 @@ 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 e4596c232287a37913bd48f714f43c439066ed58..21adef8a08d8d4948dfb3f369934cf4709d1d1c3 100644 --- a/libc/test/src/math/ModfTest.h +++ b/libc/test/src/math/ModfTest.h @@ -14,9 +14,9 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template class ModfTest : public __llvm_libc::testing::Test { +template class ModfTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) @@ -93,8 +93,8 @@ 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 e6de9419d9904019175bf1684f994934219314cb..4e450cf5bc1e9e79cd97709b29c68b5b0596f761 100644 --- a/libc/test/src/math/NextAfterTest.h +++ b/libc/test/src/math/NextAfterTest.h @@ -18,13 +18,13 @@ #include template -class NextAfterTestTemplate : public __llvm_libc::testing::Test { - using FPBits = __llvm_libc::fputil::FPBits; - using MantissaWidth = __llvm_libc::fputil::MantissaWidth; +class NextAfterTestTemplate : public LIBC_NAMESPACE::testing::Test { + using FPBits = LIBC_NAMESPACE::fputil::FPBits; + using MantissaWidth = LIBC_NAMESPACE::fputil::MantissaWidth; using UIntType = typename FPBits::UIntType; static constexpr int BIT_WIDTH_OF_TYPE = - __llvm_libc::fputil::FloatProperties::BIT_WIDTH; + LIBC_NAMESPACE::fputil::FloatProperties::BIT_WIDTH; const T zero = T(FPBits::zero()); const T neg_zero = T(FPBits::neg_zero()); @@ -52,54 +52,54 @@ public: T x = zero; T result = func(x, T(1)); UIntType expected_bits = 1; - T expected = __llvm_libc::cpp::bit_cast(expected_bits); + T expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); result = func(x, T(-1)); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + 1; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); x = neg_zero; result = func(x, 1); expected_bits = 1; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); result = func(x, -1); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + 1; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); // 'from' is max subnormal value. - x = __llvm_libc::cpp::bit_cast(max_subnormal); + x = LIBC_NAMESPACE::cpp::bit_cast(max_subnormal); result = func(x, 1); - expected = __llvm_libc::cpp::bit_cast(min_normal); + expected = LIBC_NAMESPACE::cpp::bit_cast(min_normal); ASSERT_FP_EQ(result, expected); result = func(x, 0); expected_bits = max_subnormal - 1; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); x = -x; result = func(x, -1); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + min_normal; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); result = func(x, 0); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + max_subnormal - 1; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); // 'from' is min subnormal value. - x = __llvm_libc::cpp::bit_cast(min_subnormal); + x = LIBC_NAMESPACE::cpp::bit_cast(min_subnormal); result = func(x, 1); expected_bits = min_subnormal + 1; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); ASSERT_FP_EQ(func(x, 0), 0); @@ -107,35 +107,35 @@ public: result = func(x, -1); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + min_subnormal + 1; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); ASSERT_FP_EQ(func(x, 0), T(-0.0)); // 'from' is min normal. - x = __llvm_libc::cpp::bit_cast(min_normal); + x = LIBC_NAMESPACE::cpp::bit_cast(min_normal); result = func(x, 0); expected_bits = max_subnormal; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); result = func(x, inf); expected_bits = min_normal + 1; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); x = -x; result = func(x, 0); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + max_subnormal; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); result = func(x, -inf); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + min_normal + 1; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); // 'from' is max normal and 'to' is infinity. - x = __llvm_libc::cpp::bit_cast(max_normal); + x = LIBC_NAMESPACE::cpp::bit_cast(max_normal); result = func(x, inf); ASSERT_FP_EQ(result, inf); @@ -146,14 +146,14 @@ public: x = inf; result = func(x, 0); expected_bits = max_normal; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); ASSERT_FP_EQ(func(x, inf), inf); x = neg_inf; result = func(x, 0); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + max_normal; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); ASSERT_FP_EQ(func(x, neg_inf), neg_inf); diff --git a/libc/test/src/math/RIntTest.h b/libc/test/src/math/RIntTest.h index b18123139d8cac11abd4ece3ed6e6d4f42d0f83c..272112142e21e0f3fb90e4fb856ea585846b22d2 100644 --- a/libc/test/src/math/RIntTest.h +++ b/libc/test/src/math/RIntTest.h @@ -19,18 +19,18 @@ #include #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; static constexpr int ROUNDING_MODES[4] = {FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO, FE_TONEAREST}; template -class RIntTestTemplate : public __llvm_libc::testing::Test { +class RIntTestTemplate : public LIBC_NAMESPACE::testing::Test { public: typedef T (*RIntFunc)(T); private: - using FPBits = __llvm_libc::fputil::FPBits; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; using UIntType = typename FPBits::UIntType; const T zero = T(FPBits::zero()); @@ -57,7 +57,7 @@ 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 0ccc62327f05910ae13425139ea90d5dd51c135d..0d09764f6056d6eefaad3f1af0fd45bdba1762ad 100644 --- a/libc/test/src/math/RandUtils.cpp +++ b/libc/test/src/math/RandUtils.cpp @@ -10,10 +10,10 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testutils { int rand() { return std::rand(); } } // namespace testutils -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/src/math/RandUtils.h b/libc/test/src/math/RandUtils.h index b65a98bfed21d953fa9ddb05d962f7ca7ccc0c41..05236ead2aced19287a9e7f949f605ab96815856 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 5766beff2cebacba39ebb5b10d8bb4f7399ddfb2..6da0756c3a1b3de2859970bbe100a6e666cb9c8e 100644 --- a/libc/test/src/math/RemQuoTest.h +++ b/libc/test/src/math/RemQuoTest.h @@ -16,18 +16,18 @@ #include "utils/MPFRWrapper/MPFRUtils.h" #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; template -class RemQuoTestTemplate : public __llvm_libc::testing::Test { - using FPBits = __llvm_libc::fputil::FPBits; +class RemQuoTestTemplate : public LIBC_NAMESPACE::testing::Test { + using FPBits = LIBC_NAMESPACE::fputil::FPBits; using UIntType = typename FPBits::UIntType; - const T zero = T(__llvm_libc::fputil::FPBits::zero()); - const T neg_zero = T(__llvm_libc::fputil::FPBits::neg_zero()); - const T inf = T(__llvm_libc::fputil::FPBits::inf()); - const T neg_inf = T(__llvm_libc::fputil::FPBits::neg_inf()); - const T nan = T(__llvm_libc::fputil::FPBits::build_quiet_nan(1)); + const T zero = T(LIBC_NAMESPACE::fputil::FPBits::zero()); + const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits::neg_zero()); + const T inf = T(LIBC_NAMESPACE::fputil::FPBits::inf()); + const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits::neg_inf()); + const T nan = T(LIBC_NAMESPACE::fputil::FPBits::build_quiet_nan(1)); public: typedef T (*RemQuoFunc)(T, T, int *); diff --git a/libc/test/src/math/RoundTest.h b/libc/test/src/math/RoundTest.h index 0e104e22444b584bf4e7efb44e35a11b2702fd78..e99491ccf380f854a7d01829dadef1a4d24d0d22 100644 --- a/libc/test/src/math/RoundTest.h +++ b/libc/test/src/math/RoundTest.h @@ -12,9 +12,9 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template class RoundTest : public __llvm_libc::testing::Test { +template class RoundTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/RoundToIntegerTest.h b/libc/test/src/math/RoundToIntegerTest.h index a7b85edac63721ccb119a5ec35f21691abb772ca..6b205869e7a7a7a9545614e2f2023ddb9bc4b41a 100644 --- a/libc/test/src/math/RoundToIntegerTest.h +++ b/libc/test/src/math/RoundToIntegerTest.h @@ -18,32 +18,32 @@ #include #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; static constexpr int ROUNDING_MODES[4] = {FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO, FE_TONEAREST}; template -class RoundToIntegerTestTemplate : public __llvm_libc::testing::Test { +class RoundToIntegerTestTemplate : public LIBC_NAMESPACE::testing::Test { public: typedef I (*RoundToIntegerFunc)(F); private: - using FPBits = __llvm_libc::fputil::FPBits; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; using UIntType = typename FPBits::UIntType; - const F zero = F(__llvm_libc::fputil::FPBits::zero()); - const F neg_zero = F(__llvm_libc::fputil::FPBits::neg_zero()); - const F inf = F(__llvm_libc::fputil::FPBits::inf()); - const F neg_inf = F(__llvm_libc::fputil::FPBits::neg_inf()); - const F nan = F(__llvm_libc::fputil::FPBits::build_quiet_nan(1)); + const F zero = F(LIBC_NAMESPACE::fputil::FPBits::zero()); + const F neg_zero = F(LIBC_NAMESPACE::fputil::FPBits::neg_zero()); + const F inf = F(LIBC_NAMESPACE::fputil::FPBits::inf()); + const F neg_inf = F(LIBC_NAMESPACE::fputil::FPBits::neg_inf()); + const F nan = F(LIBC_NAMESPACE::fputil::FPBits::build_quiet_nan(1)); static constexpr I INTEGER_MIN = I(1) << (sizeof(I) * 8 - 1); static constexpr I INTEGER_MAX = -(INTEGER_MIN + 1); void test_one_input(RoundToIntegerFunc func, F input, I expected, bool expectError) { libc_errno = 0; - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); ASSERT_EQ(func(input), expected); @@ -77,7 +77,7 @@ 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::VALUE - 1)); + << (LIBC_NAMESPACE::fputil::MantissaWidth::VALUE - 1)); F x = F(bits); if (TestModes) { for (int m : ROUNDING_MODES) { - __llvm_libc::fputil::set_round(m); + LIBC_NAMESPACE::fputil::set_round(m); long mpfr_long_result; bool erangeflag = mpfr::round_to_long(x, to_mpfr_rounding_mode(m), mpfr_long_result); @@ -226,22 +226,22 @@ 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 f73a14ac4c19d363c606366d695fd9d35a57d8b8..24f14b78d2f0f5d850c3335a61e9e0b2d2b3e1d8 100644 --- a/libc/test/src/math/SqrtTest.h +++ b/libc/test/src/math/SqrtTest.h @@ -13,14 +13,14 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template class SqrtTest : public __llvm_libc::testing::Test { +template class SqrtTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) static constexpr UIntType HIDDEN_BIT = - UIntType(1) << __llvm_libc::fputil::MantissaWidth::VALUE; + UIntType(1) << LIBC_NAMESPACE::fputil::MantissaWidth::VALUE; public: typedef T (*SqrtFunc)(T); @@ -48,7 +48,7 @@ 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(v); + T x = LIBC_NAMESPACE::cpp::bit_cast(v); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sqrt, x, func(x), 0.5); } } @@ -57,7 +57,7 @@ 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(v); + T x = LIBC_NAMESPACE::cpp::bit_cast(v); if (isnan(x) || (x < 0)) { continue; } diff --git a/libc/test/src/math/TruncTest.h b/libc/test/src/math/TruncTest.h index 7d9e1cbb5ae2fc552231d46b432a926c1ad08bf2..fa29ee1ce8c3a4d2245b4e2cc0ef154d09011e64 100644 --- a/libc/test/src/math/TruncTest.h +++ b/libc/test/src/math/TruncTest.h @@ -12,9 +12,9 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -template class TruncTest : public __llvm_libc::testing::Test { +template class TruncTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/acosf_test.cpp b/libc/test/src/math/acosf_test.cpp index 63895ec3e30aefbf50cfee2c3b665907011762e9..cb1a07448b471fc1e2e2766b4562f7507820f212 100644 --- a/libc/test/src/math/acosf_test.cpp +++ b/libc/test/src/math/acosf_test.cpp @@ -17,31 +17,31 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcAcosfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(aNaN)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(inf)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(neg_inf)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(neg_inf)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::acosf(1.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::acosf(1.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(2.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(2.0f)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(-2.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(-2.0f)); EXPECT_MATH_ERRNO(EDOM); } @@ -53,7 +53,7 @@ TEST(LlvmLibcAcosfTest, InFloatRange) { if (isnan(x) || isinf(x)) continue; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Acos, x, - __llvm_libc::acosf(x), 0.5); + LIBC_NAMESPACE::acosf(x), 0.5); } } @@ -78,8 +78,8 @@ TEST(LlvmLibcAcosfTest, SpecificBitPatterns) { for (int i = 0; i < N; ++i) { float x = float(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Acos, x, - __llvm_libc::acosf(x), 0.5); + LIBC_NAMESPACE::acosf(x), 0.5); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Acos, -x, - __llvm_libc::acosf(-x), 0.5); + LIBC_NAMESPACE::acosf(-x), 0.5); } } diff --git a/libc/test/src/math/acoshf_test.cpp b/libc/test/src/math/acoshf_test.cpp index 895503c6bc73cdcb1748a203b228cff9a2cbbbe6..846f5033fb39a09d793c2caf855d5ec614fc7cfa 100644 --- a/libc/test/src/math/acoshf_test.cpp +++ b/libc/test/src/math/acoshf_test.cpp @@ -17,28 +17,28 @@ #include #include -using FPBits_t = __llvm_libc::fputil::FPBits; +using FPBits_t = LIBC_NAMESPACE::fputil::FPBits; -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcAcoshfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acoshf(aNaN)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acoshf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acoshf(0.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acoshf(0.0f)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::acoshf(1.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::acoshf(1.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::acoshf(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(inf, LIBC_NAMESPACE::acoshf(inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acoshf(neg_inf)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acoshf(neg_inf)); EXPECT_MATH_ERRNO(EDOM); } @@ -50,7 +50,7 @@ TEST(LlvmLibcAcoshfTest, InFloatRange) { if (isnan(x) || isinf(x)) continue; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Acosh, x, - __llvm_libc::acoshf(x), 0.5); + LIBC_NAMESPACE::acoshf(x), 0.5); } } @@ -74,6 +74,6 @@ TEST(LlvmLibcAcoshfTest, SpecificBitPatterns) { for (int i = 0; i < N; ++i) { float x = float(FPBits_t(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Acosh, x, - __llvm_libc::acoshf(x), 0.5); + LIBC_NAMESPACE::acoshf(x), 0.5); } } diff --git a/libc/test/src/math/asinf_test.cpp b/libc/test/src/math/asinf_test.cpp index cc99e5b7b6cac8f6402cae2b40031a2404298d2b..49dcd38e82bf59dfb631d8169372a96720ab2760 100644 --- a/libc/test/src/math/asinf_test.cpp +++ b/libc/test/src/math/asinf_test.cpp @@ -18,28 +18,28 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcAsinfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinf(aNaN)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::asinf(0.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::asinf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, __llvm_libc::asinf(-0.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, LIBC_NAMESPACE::asinf(-0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinf(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinf(inf)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinf(neg_inf)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinf(neg_inf)); EXPECT_MATH_ERRNO(EDOM); } @@ -51,7 +51,7 @@ TEST(LlvmLibcAsinfTest, InFloatRange) { if (isnan(x) || isinf(x)) continue; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Asin, x, - __llvm_libc::asinf(x), 0.5); + LIBC_NAMESPACE::asinf(x), 0.5); } } @@ -74,8 +74,8 @@ TEST(LlvmLibcAsinfTest, SpecificBitPatterns) { for (int i = 0; i < N; ++i) { float x = float(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Asin, x, - __llvm_libc::asinf(x), 0.5); + LIBC_NAMESPACE::asinf(x), 0.5); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Asin, -x, - __llvm_libc::asinf(-x), 0.5); + LIBC_NAMESPACE::asinf(-x), 0.5); } } diff --git a/libc/test/src/math/asinhf_test.cpp b/libc/test/src/math/asinhf_test.cpp index cadb9572c372e84dea969550da880ab9abc2592b..0bbd5db031e079fbe92018159ae27d3a964fedd1 100644 --- a/libc/test/src/math/asinhf_test.cpp +++ b/libc/test/src/math/asinhf_test.cpp @@ -17,28 +17,28 @@ #include #include -using FPBits_t = __llvm_libc::fputil::FPBits; +using FPBits_t = LIBC_NAMESPACE::fputil::FPBits; -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcAsinhfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinhf(aNaN)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinhf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::asinhf(0.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::asinhf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, __llvm_libc::asinhf(-0.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, LIBC_NAMESPACE::asinhf(-0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::asinhf(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(inf, LIBC_NAMESPACE::asinhf(inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(neg_inf, __llvm_libc::asinhf(neg_inf)); + EXPECT_FP_EQ_ALL_ROUNDING(neg_inf, LIBC_NAMESPACE::asinhf(neg_inf)); EXPECT_MATH_ERRNO(0); } @@ -50,9 +50,9 @@ TEST(LlvmLibcAsinhfTest, InFloatRange) { if (isnan(x) || isinf(x)) continue; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Asinh, x, - __llvm_libc::asinhf(x), 0.5); + LIBC_NAMESPACE::asinhf(x), 0.5); ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Asinh, -x, - __llvm_libc::asinhf(-x), 0.5); + LIBC_NAMESPACE::asinhf(-x), 0.5); } } @@ -75,8 +75,8 @@ TEST(LlvmLibcAsinhfTest, SpecificBitPatterns) { for (int i = 0; i < N; ++i) { float x = float(FPBits_t(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Asinh, x, - __llvm_libc::asinhf(x), 0.5); + LIBC_NAMESPACE::asinhf(x), 0.5); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Asinh, -x, - __llvm_libc::asinhf(-x), 0.5); + LIBC_NAMESPACE::asinhf(-x), 0.5); } } diff --git a/libc/test/src/math/atanf_test.cpp b/libc/test/src/math/atanf_test.cpp index cd60b8d8a775e6afe818a6b1015aa09798b8106c..c7eab7b6687239684741ccbcdb4d4266af437150 100644 --- a/libc/test/src/math/atanf_test.cpp +++ b/libc/test/src/math/atanf_test.cpp @@ -19,26 +19,26 @@ #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcAtanfTest, SpecialNumbers) { libc_errno = 0; - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanf(aNaN)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanf(aNaN)); EXPECT_FP_EXCEPTION(0); EXPECT_MATH_ERRNO(0); - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::atanf(0.0f)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::atanf(0.0f)); EXPECT_FP_EXCEPTION(0); EXPECT_MATH_ERRNO(0); - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, __llvm_libc::atanf(-0.0f)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, LIBC_NAMESPACE::atanf(-0.0f)); EXPECT_FP_EXCEPTION(0); EXPECT_MATH_ERRNO(0); } @@ -49,9 +49,9 @@ TEST(LlvmLibcAtanfTest, InFloatRange) { for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) { float x = float(FPBits(v)); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Atan, x, - __llvm_libc::atanf(x), 0.5); + LIBC_NAMESPACE::atanf(x), 0.5); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Atan, -x, - __llvm_libc::atanf(-x), 0.5); + LIBC_NAMESPACE::atanf(-x), 0.5); } } @@ -61,6 +61,6 @@ TEST(LlvmLibcAtanfTest, SpecialValues) { 0x7F800000U, 0xFF800000U}) { float x = float(FPBits(v)); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Atan, x, - __llvm_libc::atanf(x), 0.5); + LIBC_NAMESPACE::atanf(x), 0.5); } } diff --git a/libc/test/src/math/atanhf_test.cpp b/libc/test/src/math/atanhf_test.cpp index 021a3f177b821e5fa501af79e8d35ea1f8082cbc..c1a8d1997187728d1db1af639f46c7c551f8668e 100644 --- a/libc/test/src/math/atanhf_test.cpp +++ b/libc/test/src/math/atanhf_test.cpp @@ -17,70 +17,70 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcAtanhfTest, SpecialNumbers) { libc_errno = 0; - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanhf(aNaN)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf(aNaN)); EXPECT_FP_EXCEPTION(0); EXPECT_MATH_ERRNO(0); - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::atanhf(0.0f)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::atanhf(0.0f)); EXPECT_FP_EXCEPTION(0); EXPECT_MATH_ERRNO(0); - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, __llvm_libc::atanhf(-0.0f)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, LIBC_NAMESPACE::atanhf(-0.0f)); EXPECT_FP_EXCEPTION(0); EXPECT_MATH_ERRNO(0); - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::atanhf(1.0f)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(inf, LIBC_NAMESPACE::atanhf(1.0f)); EXPECT_FP_EXCEPTION(FE_DIVBYZERO); EXPECT_MATH_ERRNO(ERANGE); - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(neg_inf, __llvm_libc::atanhf(-1.0f)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(neg_inf, LIBC_NAMESPACE::atanhf(-1.0f)); EXPECT_FP_EXCEPTION(FE_DIVBYZERO); EXPECT_MATH_ERRNO(ERANGE); auto bt = FPBits(1.0f); bt.bits += 1; - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanhf(bt.get_val())); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf(bt.get_val())); EXPECT_FP_EXCEPTION(FE_INVALID); EXPECT_MATH_ERRNO(EDOM); - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); bt.set_sign(true); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanhf(bt.get_val())); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf(bt.get_val())); EXPECT_FP_EXCEPTION(FE_INVALID); EXPECT_MATH_ERRNO(EDOM); - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanhf(2.0f)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf(2.0f)); EXPECT_FP_EXCEPTION(FE_INVALID); EXPECT_MATH_ERRNO(EDOM); - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanhf(-2.0f)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf(-2.0f)); EXPECT_FP_EXCEPTION(FE_INVALID); EXPECT_MATH_ERRNO(EDOM); - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanhf(inf)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf(inf)); EXPECT_FP_EXCEPTION(FE_INVALID); EXPECT_MATH_ERRNO(EDOM); bt.set_sign(true); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanhf(neg_inf)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf(neg_inf)); EXPECT_FP_EXCEPTION(FE_INVALID); EXPECT_MATH_ERRNO(EDOM); } @@ -90,20 +90,22 @@ TEST(LlvmLibcAtanhfTest, InFloatRange) { const uint32_t STEP = FPBits(1.0f).uintval() / COUNT; for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) { float x = float(FPBits(v)); - ASSERT_MPFR_MATCH(mpfr::Operation::Atanh, x, __llvm_libc::atanhf(x), 0.5); - ASSERT_MPFR_MATCH(mpfr::Operation::Atanh, -x, __llvm_libc::atanhf(-x), 0.5); + ASSERT_MPFR_MATCH(mpfr::Operation::Atanh, x, LIBC_NAMESPACE::atanhf(x), + 0.5); + ASSERT_MPFR_MATCH(mpfr::Operation::Atanh, -x, LIBC_NAMESPACE::atanhf(-x), + 0.5); } } // For small values, atanh(x) is x. TEST(LlvmLibcAtanhfTest, SmallValues) { float x = float(FPBits(uint32_t(0x17800000))); - float result = __llvm_libc::atanhf(x); + float result = LIBC_NAMESPACE::atanhf(x); EXPECT_MPFR_MATCH(mpfr::Operation::Atanh, x, result, 0.5); EXPECT_FP_EQ(x, result); x = float(FPBits(uint32_t(0x00400000))); - result = __llvm_libc::atanhf(x); + result = LIBC_NAMESPACE::atanhf(x); EXPECT_MPFR_MATCH(mpfr::Operation::Atanh, x, result, 0.5); EXPECT_FP_EQ(x, result); } diff --git a/libc/test/src/math/ceil_test.cpp b/libc/test/src/math/ceil_test.cpp index 2a592e3ee85b0cc32e3e937bed42c77d92c28986..800452a43426c7c5b477d4721b141f405c2ec034 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 cfa8cb2c5aa6dd4d7e69ab98a426d6eb12b76867..2a2504228adb0ad007af91750e6bf2285ee11450 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 6fe30465edc85744d47b2fea639c07a9e25d77e1..0f766602a0f6d41d0a3144edbc8f244ef5351bd6 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 37bfa0d90c378966c9d511732b8843e1e417cdef..5b3d812c02da4d194fa92147dc9891fbda12e33d 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 fec283ccd0c7acd73d6c01e81cd8723aad2c80ac..344ffee2359ec8b6bbf8db3a19f318d02d5dfc4a 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 d1de911196b62b784e3272377ada928bb7e719c0..bed60678dc161da133a4e22e0a9f27f54fd8db34 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 f93d8699e73025944963c1734f06a6875ff039d7..6d8aeaf2230dae98408df19fee5f37d0f04f11b4 100644 --- a/libc/test/src/math/cos_test.cpp +++ b/libc/test/src/math/cos_test.cpp @@ -13,7 +13,7 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(double) @@ -27,6 +27,6 @@ TEST(LlvmLibccosTest, Range) { if (isnan(x) || isinf(x) || x > _2pi || x < -_2pi) continue; - ASSERT_MPFR_MATCH(mpfr::Operation::Cos, x, __llvm_libc::cos(x), 1.0); + ASSERT_MPFR_MATCH(mpfr::Operation::Cos, x, LIBC_NAMESPACE::cos(x), 1.0); } } diff --git a/libc/test/src/math/cosf_test.cpp b/libc/test/src/math/cosf_test.cpp index e9a7ea5db7429ff0df33aa2d2c9dfcd087e18fdf..7b2fdf9f1b6bffa8a3174f02e7b0e71afd02af9b 100644 --- a/libc/test/src/math/cosf_test.cpp +++ b/libc/test/src/math/cosf_test.cpp @@ -18,29 +18,29 @@ #include #include -using __llvm_libc::testing::SDCOMP26094_VALUES; -using FPBits = __llvm_libc::fputil::FPBits; +using LIBC_NAMESPACE::testing::SDCOMP26094_VALUES; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcCosfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ(aNaN, __llvm_libc::cosf(aNaN)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::cosf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(1.0f, __llvm_libc::cosf(0.0f)); + EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::cosf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(1.0f, __llvm_libc::cosf(-0.0f)); + EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::cosf(-0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(aNaN, __llvm_libc::cosf(inf)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::cosf(inf)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ(aNaN, __llvm_libc::cosf(neg_inf)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::cosf(neg_inf)); EXPECT_MATH_ERRNO(EDOM); } @@ -52,7 +52,7 @@ TEST(LlvmLibcCosfTest, InFloatRange) { if (isnan(x) || isinf(x)) continue; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Cos, x, - __llvm_libc::cosf(x), 0.5); + LIBC_NAMESPACE::cosf(x), 0.5); } } @@ -106,9 +106,9 @@ TEST(LlvmLibcCosfTest, SpecificBitPatterns) { for (int i = 0; i < N; ++i) { float x = float(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Cos, x, - __llvm_libc::cosf(x), 0.5); + LIBC_NAMESPACE::cosf(x), 0.5); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Cos, -x, - __llvm_libc::cosf(-x), 0.5); + LIBC_NAMESPACE::cosf(-x), 0.5); } } @@ -117,6 +117,6 @@ TEST(LlvmLibcCosfTest, SpecificBitPatterns) { TEST(LlvmLibcCosfTest, SDCOMP_26094) { for (uint32_t v : SDCOMP26094_VALUES) { float x = float(FPBits(v)); - ASSERT_MPFR_MATCH(mpfr::Operation::Cos, x, __llvm_libc::cosf(x), 0.5); + ASSERT_MPFR_MATCH(mpfr::Operation::Cos, x, LIBC_NAMESPACE::cosf(x), 0.5); } } diff --git a/libc/test/src/math/coshf_test.cpp b/libc/test/src/math/coshf_test.cpp index 90ce3044b2c11c5fdbd7468b6d2728eb41c6720d..f45f35ad3ea05856655c53a318855db8ad6e6606 100644 --- a/libc/test/src/math/coshf_test.cpp +++ b/libc/test/src/math/coshf_test.cpp @@ -18,43 +18,43 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcCoshfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ(aNaN, __llvm_libc::coshf(aNaN)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::coshf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(inf, __llvm_libc::coshf(inf)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::coshf(inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(inf, __llvm_libc::coshf(neg_inf)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::coshf(neg_inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(1.0f, __llvm_libc::coshf(0.0f)); + EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::coshf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(1.0f, __llvm_libc::coshf(-0.0f)); + EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::coshf(-0.0f)); EXPECT_MATH_ERRNO(0); } TEST(LlvmLibcCoshfTest, Overflow) { libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::coshf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::coshf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::coshf(float(FPBits(0x42cffff8U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::coshf(float(FPBits(0x42cffff8U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::coshf(float(FPBits(0x42d00008U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::coshf(float(FPBits(0x42d00008U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); } @@ -65,18 +65,18 @@ TEST(LlvmLibcCoshfTest, InFloatRange) { float x = float(FPBits(v)); if (isnan(x) || isinf(x)) continue; - ASSERT_MPFR_MATCH(mpfr::Operation::Cosh, x, __llvm_libc::coshf(x), 0.5); + ASSERT_MPFR_MATCH(mpfr::Operation::Cosh, x, LIBC_NAMESPACE::coshf(x), 0.5); } } TEST(LlvmLibcCoshfTest, SmallValues) { float x = float(FPBits(0x17800000U)); - float result = __llvm_libc::coshf(x); + float result = LIBC_NAMESPACE::coshf(x); EXPECT_MPFR_MATCH(mpfr::Operation::Cosh, x, result, 0.5); EXPECT_FP_EQ(1.0f, result); x = float(FPBits(0x0040000U)); - result = __llvm_libc::coshf(x); + result = LIBC_NAMESPACE::coshf(x); EXPECT_MPFR_MATCH(mpfr::Operation::Cosh, x, result, 0.5); EXPECT_FP_EQ(1.0f, result); } diff --git a/libc/test/src/math/differential_testing/BinaryOpSingleOutputDiff.h b/libc/test/src/math/differential_testing/BinaryOpSingleOutputDiff.h index ccab38e5287909b45f5d5d4964eab6daa1388162..1ea50deccb7eaf840c91af981a2df03881126a14 100644 --- a/libc/test/src/math/differential_testing/BinaryOpSingleOutputDiff.h +++ b/libc/test/src/math/differential_testing/BinaryOpSingleOutputDiff.h @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { template class BinaryOpSingleOutputDiff { @@ -141,18 +141,18 @@ 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::run_diff( \ + LIBC_NAMESPACE::testing::BinaryOpSingleOutputDiff::run_diff( \ &myFunc, &otherFunc, filename); \ return 0; \ } #define BINARY_OP_SINGLE_OUTPUT_PERF(T, myFunc, otherFunc, filename) \ int main() { \ - __llvm_libc::testing::BinaryOpSingleOutputDiff::run_perf( \ + LIBC_NAMESPACE::testing::BinaryOpSingleOutputDiff::run_perf( \ &myFunc, &otherFunc, filename); \ return 0; \ } diff --git a/libc/test/src/math/differential_testing/SingleInputSingleOutputDiff.h b/libc/test/src/math/differential_testing/SingleInputSingleOutputDiff.h index 4805e1acac20029958fee5bc929dde6023570624..c20cf3152f622009274836ab2cccd0fcda28fbfb 100644 --- a/libc/test/src/math/differential_testing/SingleInputSingleOutputDiff.h +++ b/libc/test/src/math/differential_testing/SingleInputSingleOutputDiff.h @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { template class SingleInputSingleOutputDiff { @@ -100,18 +100,18 @@ 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::runDiff( \ + LIBC_NAMESPACE::testing::SingleInputSingleOutputDiff::runDiff( \ &myFunc, &otherFunc, filename); \ return 0; \ } #define SINGLE_INPUT_SINGLE_OUTPUT_PERF(T, myFunc, otherFunc, filename) \ int main() { \ - __llvm_libc::testing::SingleInputSingleOutputDiff::runPerf( \ + LIBC_NAMESPACE::testing::SingleInputSingleOutputDiff::runPerf( \ &myFunc, &otherFunc, filename); \ return 0; \ } diff --git a/libc/test/src/math/differential_testing/Timer.cpp b/libc/test/src/math/differential_testing/Timer.cpp index 6780389d5322d8c16ddc2cddc16686be1cb6d4ab..979196ae6b8359946fe68916e3b91b177ac30139 100644 --- a/libc/test/src/math/differential_testing/Timer.cpp +++ b/libc/test/src/math/differential_testing/Timer.cpp @@ -11,7 +11,7 @@ #include #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { struct TimerImplementation { @@ -39,4 +39,4 @@ uint64_t Timer::nanoseconds() const { } } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/src/math/differential_testing/Timer.h b/libc/test/src/math/differential_testing/Timer.h index 9df13a0d4074603b717773992397c0065cb0547c..d4acff7ba0eb1835bd45061cdeb9bedc9583ad7a 100644 --- a/libc/test/src/math/differential_testing/Timer.h +++ b/libc/test/src/math/differential_testing/Timer.h @@ -11,7 +11,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { class Timer { @@ -28,6 +28,6 @@ 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 af911b4cc26228affc590cb77e4c1fa269fa24ce..7c0bb1e95a03fd69c7e6f3301bb7430ea41dcd93 100644 --- a/libc/test/src/math/differential_testing/ceilf_diff.cpp +++ b/libc/test/src/math/differential_testing/ceilf_diff.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::ceilf, ::ceilf, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::ceilf, ::ceilf, "ceilf_diff.log") diff --git a/libc/test/src/math/differential_testing/ceilf_perf.cpp b/libc/test/src/math/differential_testing/ceilf_perf.cpp index 23420390d15346bb419339581fdff62165ff466a..c304231e0678dee4e75b0697c956c6914b1cc591 100644 --- a/libc/test/src/math/differential_testing/ceilf_perf.cpp +++ b/libc/test/src/math/differential_testing/ceilf_perf.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::ceilf, ::ceilf, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::ceilf, ::ceilf, "ceilf_perf.log") diff --git a/libc/test/src/math/differential_testing/cosf_diff.cpp b/libc/test/src/math/differential_testing/cosf_diff.cpp index 232a3ceb11418b50a07596d81b45248d605d51bb..ee3102384a8e6b79bf1c71a761a4dcc9cac39bf3 100644 --- a/libc/test/src/math/differential_testing/cosf_diff.cpp +++ b/libc/test/src/math/differential_testing/cosf_diff.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::cosf, ::cosf, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::cosf, ::cosf, "cosf_diff.log") diff --git a/libc/test/src/math/differential_testing/cosf_perf.cpp b/libc/test/src/math/differential_testing/cosf_perf.cpp index 3107d199431033b40e35629026c8545c8302db1b..981a94133b8040641c2cdca8804a5e32b38170fe 100644 --- a/libc/test/src/math/differential_testing/cosf_perf.cpp +++ b/libc/test/src/math/differential_testing/cosf_perf.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::cosf, ::cosf, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::cosf, ::cosf, "cosf_perf.log") diff --git a/libc/test/src/math/differential_testing/exp2f_diff.cpp b/libc/test/src/math/differential_testing/exp2f_diff.cpp index c1f279a2b466d3b94d5a2c34a5b9c0673bd35729..545c6de320fc7c48d44752e32c12f385581dc7d8 100644 --- a/libc/test/src/math/differential_testing/exp2f_diff.cpp +++ b/libc/test/src/math/differential_testing/exp2f_diff.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::exp2f, ::exp2f, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::exp2f, ::exp2f, "exp2f_diff.log") diff --git a/libc/test/src/math/differential_testing/exp2f_perf.cpp b/libc/test/src/math/differential_testing/exp2f_perf.cpp index 2ffa593c9f6e448280a0bd70ce7bf294a1bc90c4..4aae5220e6a51671a9bff2732e1cf89df30034bd 100644 --- a/libc/test/src/math/differential_testing/exp2f_perf.cpp +++ b/libc/test/src/math/differential_testing/exp2f_perf.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::exp2f, ::exp2f, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::exp2f, ::exp2f, "exp2f_perf.log") diff --git a/libc/test/src/math/differential_testing/expf_diff.cpp b/libc/test/src/math/differential_testing/expf_diff.cpp index a69efde44c1cabfd799045e87086d67e27d7a8f7..7c2e90744bc915692dd60af7e8bc7351819fa58f 100644 --- a/libc/test/src/math/differential_testing/expf_diff.cpp +++ b/libc/test/src/math/differential_testing/expf_diff.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::expf, ::expf, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::expf, ::expf, "expf_diff.log") diff --git a/libc/test/src/math/differential_testing/expf_perf.cpp b/libc/test/src/math/differential_testing/expf_perf.cpp index 1a28fd125af071ff9daaea321b650a9a651f5b95..c34173b21b4f60aec0e6a6f67416cc755afadddc 100644 --- a/libc/test/src/math/differential_testing/expf_perf.cpp +++ b/libc/test/src/math/differential_testing/expf_perf.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::expf, ::expf, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::expf, ::expf, "expf_perf.log") diff --git a/libc/test/src/math/differential_testing/expm1f_diff.cpp b/libc/test/src/math/differential_testing/expm1f_diff.cpp index e12072efec57ddff70f46c92d213e2f8e6cc479d..3cbd8a99690fb4933cd6ed959d88afc6deed5ff3 100644 --- a/libc/test/src/math/differential_testing/expm1f_diff.cpp +++ b/libc/test/src/math/differential_testing/expm1f_diff.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::expm1f, ::expm1f, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::expm1f, ::expm1f, "expm1f_diff.log") diff --git a/libc/test/src/math/differential_testing/expm1f_perf.cpp b/libc/test/src/math/differential_testing/expm1f_perf.cpp index 9e8e2dfb8cd92af8a8b330ccf76ceccd5190411e..3c25ef81d4808c351844ebebf185beae8b94d852 100644 --- a/libc/test/src/math/differential_testing/expm1f_perf.cpp +++ b/libc/test/src/math/differential_testing/expm1f_perf.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::expm1f, ::expm1f, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::expm1f, ::expm1f, "expm1f_perf.log") diff --git a/libc/test/src/math/differential_testing/fabsf_diff.cpp b/libc/test/src/math/differential_testing/fabsf_diff.cpp index 6bf11f654c71cd096879daf8a79192c55c37016c..9bf9eff888fb51aff8880625f0f5adb396c55468 100644 --- a/libc/test/src/math/differential_testing/fabsf_diff.cpp +++ b/libc/test/src/math/differential_testing/fabsf_diff.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::fabsf, ::fabsf, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::fabsf, ::fabsf, "fabsf_diff.log") diff --git a/libc/test/src/math/differential_testing/fabsf_perf.cpp b/libc/test/src/math/differential_testing/fabsf_perf.cpp index 2fcf72de348e2363af244fcbad0b8e7831f36b76..f9f9cea72c6dae822c7b159517edcddbd205c3ca 100644 --- a/libc/test/src/math/differential_testing/fabsf_perf.cpp +++ b/libc/test/src/math/differential_testing/fabsf_perf.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::fabsf, ::fabsf, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::fabsf, ::fabsf, "fabsf_perf.log") diff --git a/libc/test/src/math/differential_testing/floorf_diff.cpp b/libc/test/src/math/differential_testing/floorf_diff.cpp index 788214fb26407dd5e7e69de642125071260bc3f3..6d72927b5010c575c0f5960a7ee5c0fce36f6a13 100644 --- a/libc/test/src/math/differential_testing/floorf_diff.cpp +++ b/libc/test/src/math/differential_testing/floorf_diff.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::floorf, ::floorf, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::floorf, ::floorf, "floorf_diff.log") diff --git a/libc/test/src/math/differential_testing/floorf_perf.cpp b/libc/test/src/math/differential_testing/floorf_perf.cpp index 498cdc960c66d13bd6b4c6405a6d7548aac85b80..abd1cd7885ffd21fe6be0c8fe47e235c7370ed2f 100644 --- a/libc/test/src/math/differential_testing/floorf_perf.cpp +++ b/libc/test/src/math/differential_testing/floorf_perf.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::floorf, ::floorf, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::floorf, ::floorf, "floorf_perf.log") diff --git a/libc/test/src/math/differential_testing/fmod_diff.cpp b/libc/test/src/math/differential_testing/fmod_diff.cpp index c20a7c5140f0091c9f4901549476bb735c1b8b09..026e529c6cae2a90337a1265b351750d393ff44e 100644 --- a/libc/test/src/math/differential_testing/fmod_diff.cpp +++ b/libc/test/src/math/differential_testing/fmod_diff.cpp @@ -12,4 +12,5 @@ #include -BINARY_OP_SINGLE_OUTPUT_DIFF(double, __llvm_libc::fmod, ::fmod, "fmod_diff.log") +BINARY_OP_SINGLE_OUTPUT_DIFF(double, LIBC_NAMESPACE::fmod, ::fmod, + "fmod_diff.log") diff --git a/libc/test/src/math/differential_testing/fmod_perf.cpp b/libc/test/src/math/differential_testing/fmod_perf.cpp index 37878bee99c3af1ea2a029413fe5d7f9e9608881..219ee7860a242be06a17d701404324eb04b74baa 100644 --- a/libc/test/src/math/differential_testing/fmod_perf.cpp +++ b/libc/test/src/math/differential_testing/fmod_perf.cpp @@ -12,4 +12,5 @@ #include -BINARY_OP_SINGLE_OUTPUT_PERF(double, __llvm_libc::fmod, ::fmod, "fmod_perf.log") +BINARY_OP_SINGLE_OUTPUT_PERF(double, LIBC_NAMESPACE::fmod, ::fmod, + "fmod_perf.log") diff --git a/libc/test/src/math/differential_testing/fmodf_diff.cpp b/libc/test/src/math/differential_testing/fmodf_diff.cpp index 634c6399877b0fc36aba52ec2fdc009176f85802..7029b1ee42cd0e7d6308d8c689de237e4814d7bf 100644 --- a/libc/test/src/math/differential_testing/fmodf_diff.cpp +++ b/libc/test/src/math/differential_testing/fmodf_diff.cpp @@ -12,5 +12,5 @@ #include -BINARY_OP_SINGLE_OUTPUT_DIFF(float, __llvm_libc::fmodf, ::fmodf, +BINARY_OP_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::fmodf, ::fmodf, "fmodf_diff.log") diff --git a/libc/test/src/math/differential_testing/fmodf_perf.cpp b/libc/test/src/math/differential_testing/fmodf_perf.cpp index 36d0fe56d964afb185e507cbd2bac5a8d4d0b40f..c2927bb1ea9d9fe6c4f5ea3af2d125cd321444f9 100644 --- a/libc/test/src/math/differential_testing/fmodf_perf.cpp +++ b/libc/test/src/math/differential_testing/fmodf_perf.cpp @@ -12,5 +12,5 @@ #include -BINARY_OP_SINGLE_OUTPUT_PERF(float, __llvm_libc::fmodf, ::fmodf, +BINARY_OP_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::fmodf, ::fmodf, "fmodf_perf.log") diff --git a/libc/test/src/math/differential_testing/hypot_diff.cpp b/libc/test/src/math/differential_testing/hypot_diff.cpp index 28dbd2bfc35e3d37c96dbde8cae40c57a34821b3..c61e589bdb2dffaa0767671bc382f7bafe02a932 100644 --- a/libc/test/src/math/differential_testing/hypot_diff.cpp +++ b/libc/test/src/math/differential_testing/hypot_diff.cpp @@ -12,5 +12,5 @@ #include -BINARY_OP_SINGLE_OUTPUT_DIFF(double, __llvm_libc::hypot, ::hypot, +BINARY_OP_SINGLE_OUTPUT_DIFF(double, LIBC_NAMESPACE::hypot, ::hypot, "hypot_diff.log") diff --git a/libc/test/src/math/differential_testing/hypot_perf.cpp b/libc/test/src/math/differential_testing/hypot_perf.cpp index f90605455f768c0bd928cdde926f17f450db2779..01a72e6fbc3d795a0f25a0760d81f8e3f93db7aa 100644 --- a/libc/test/src/math/differential_testing/hypot_perf.cpp +++ b/libc/test/src/math/differential_testing/hypot_perf.cpp @@ -12,5 +12,5 @@ #include -BINARY_OP_SINGLE_OUTPUT_PERF(double, __llvm_libc::hypot, ::hypot, +BINARY_OP_SINGLE_OUTPUT_PERF(double, LIBC_NAMESPACE::hypot, ::hypot, "hypot_perf.log") diff --git a/libc/test/src/math/differential_testing/hypotf_diff.cpp b/libc/test/src/math/differential_testing/hypotf_diff.cpp index e1ee9f28cc55a63f1ce900a875c2e50c4ef3353f..d1c70fc2b6edbdc953febdcb0dfbb4e11f1fa63b 100644 --- a/libc/test/src/math/differential_testing/hypotf_diff.cpp +++ b/libc/test/src/math/differential_testing/hypotf_diff.cpp @@ -12,5 +12,5 @@ #include -BINARY_OP_SINGLE_OUTPUT_DIFF(float, __llvm_libc::hypotf, ::hypotf, +BINARY_OP_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::hypotf, ::hypotf, "hypotf_diff.log") diff --git a/libc/test/src/math/differential_testing/hypotf_perf.cpp b/libc/test/src/math/differential_testing/hypotf_perf.cpp index 75c61cb0592af219f8817779af4f7baa2f74f4d8..ed57b186f889ba854100a0287c3b0baa8956aedd 100644 --- a/libc/test/src/math/differential_testing/hypotf_perf.cpp +++ b/libc/test/src/math/differential_testing/hypotf_perf.cpp @@ -12,5 +12,5 @@ #include -BINARY_OP_SINGLE_OUTPUT_PERF(float, __llvm_libc::hypotf, ::hypotf, +BINARY_OP_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::hypotf, ::hypotf, "hypotf_perf.log") diff --git a/libc/test/src/math/differential_testing/log10f_perf.cpp b/libc/test/src/math/differential_testing/log10f_perf.cpp index e890d0393e0af84ca71ef53ceb911404969e73c5..60c1161a31cf963fcbdc0390c137b468d48dab04 100644 --- a/libc/test/src/math/differential_testing/log10f_perf.cpp +++ b/libc/test/src/math/differential_testing/log10f_perf.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::log10f, ::log10f, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::log10f, ::log10f, "log10f_perf.log") diff --git a/libc/test/src/math/differential_testing/log1pf_perf.cpp b/libc/test/src/math/differential_testing/log1pf_perf.cpp index 9904aba10d35e4d52140097ea7843c6c7db476ae..5cd523d82184cc3e5c8aa398356d320cb98b6cee 100644 --- a/libc/test/src/math/differential_testing/log1pf_perf.cpp +++ b/libc/test/src/math/differential_testing/log1pf_perf.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::log1pf, ::log1pf, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::log1pf, ::log1pf, "log1pf_perf.log") diff --git a/libc/test/src/math/differential_testing/log2f_diff.cpp b/libc/test/src/math/differential_testing/log2f_diff.cpp index 48aec5cb7a8c57371d3edced475c0b110d61b095..aef431dce48701e0bef357a2859f7cea39643ad6 100644 --- a/libc/test/src/math/differential_testing/log2f_diff.cpp +++ b/libc/test/src/math/differential_testing/log2f_diff.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::log2f, ::log2f, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::log2f, ::log2f, "log2f_diff.log") diff --git a/libc/test/src/math/differential_testing/log2f_perf.cpp b/libc/test/src/math/differential_testing/log2f_perf.cpp index 5bab271fc49e00f45cd77edd6080160e4e436066..ee899394c421edeb0fbaedde053a65d7e7742e3e 100644 --- a/libc/test/src/math/differential_testing/log2f_perf.cpp +++ b/libc/test/src/math/differential_testing/log2f_perf.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::log2f, ::log2f, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::log2f, ::log2f, "log2f_perf.log") diff --git a/libc/test/src/math/differential_testing/logbf_diff.cpp b/libc/test/src/math/differential_testing/logbf_diff.cpp index 93439c7fc89816f93bf643c537e4dc0159bce628..37441eb40a4dfaf9739d271f0a2b98b43fbfae2e 100644 --- a/libc/test/src/math/differential_testing/logbf_diff.cpp +++ b/libc/test/src/math/differential_testing/logbf_diff.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::logbf, ::logbf, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::logbf, ::logbf, "logbf_diff.log") diff --git a/libc/test/src/math/differential_testing/logbf_perf.cpp b/libc/test/src/math/differential_testing/logbf_perf.cpp index 38fa331d26644817417b1ad8ffd919bac0141b4f..89d5bd13f9316b63721b2effef7a6f3ae787cef3 100644 --- a/libc/test/src/math/differential_testing/logbf_perf.cpp +++ b/libc/test/src/math/differential_testing/logbf_perf.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::logbf, ::logbf, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::logbf, ::logbf, "logbf_perf.log") diff --git a/libc/test/src/math/differential_testing/logf_diff.cpp b/libc/test/src/math/differential_testing/logf_diff.cpp index 6f5c1ef907e706c440b6664ff8578794f559e001..4ed1307f71208102da3612f97bf56a156a59a8d8 100644 --- a/libc/test/src/math/differential_testing/logf_diff.cpp +++ b/libc/test/src/math/differential_testing/logf_diff.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::logf, ::logf, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::logf, ::logf, "logf_diff.log") diff --git a/libc/test/src/math/differential_testing/logf_perf.cpp b/libc/test/src/math/differential_testing/logf_perf.cpp index ed907ed61048f58a010d75b9f36a5955a75b8bad..f1b3f986bd40a380f8a4ddea025117a00a9bfe9a 100644 --- a/libc/test/src/math/differential_testing/logf_perf.cpp +++ b/libc/test/src/math/differential_testing/logf_perf.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::logf, ::logf, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::logf, ::logf, "logf_perf.log") diff --git a/libc/test/src/math/differential_testing/nearbyintf_diff.cpp b/libc/test/src/math/differential_testing/nearbyintf_diff.cpp index dfcf2fd1cc0e5f11b27676e51680ebda32034142..14200116883db4c21e7b8cacb98cfa3a2b603934 100644 --- a/libc/test/src/math/differential_testing/nearbyintf_diff.cpp +++ b/libc/test/src/math/differential_testing/nearbyintf_diff.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::nearbyintf, ::nearbyintf, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::nearbyintf, ::nearbyintf, "nearbyintf_diff.log") diff --git a/libc/test/src/math/differential_testing/nearbyintf_perf.cpp b/libc/test/src/math/differential_testing/nearbyintf_perf.cpp index 6ee98a967a706410b76218957a4d215a4c6a8ab2..9c5736fb4ab04809dc6f5849321075d29e2be8df 100644 --- a/libc/test/src/math/differential_testing/nearbyintf_perf.cpp +++ b/libc/test/src/math/differential_testing/nearbyintf_perf.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::nearbyintf, ::nearbyintf, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::nearbyintf, ::nearbyintf, "nearbyintf_perf.log") diff --git a/libc/test/src/math/differential_testing/rintf_diff.cpp b/libc/test/src/math/differential_testing/rintf_diff.cpp index 2ed954dde5484c6654658ff20aefba320c5f8859..e60f66085e5d7054bf260be197d62c16355ef4ce 100644 --- a/libc/test/src/math/differential_testing/rintf_diff.cpp +++ b/libc/test/src/math/differential_testing/rintf_diff.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::rintf, ::rintf, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::rintf, ::rintf, "rintf_diff.log") diff --git a/libc/test/src/math/differential_testing/rintf_perf.cpp b/libc/test/src/math/differential_testing/rintf_perf.cpp index 517f04b688e56162c46dcbb48b4cd665d10391b2..432e5da77f3789e4dd2234f28831fcf8d9c22704 100644 --- a/libc/test/src/math/differential_testing/rintf_perf.cpp +++ b/libc/test/src/math/differential_testing/rintf_perf.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::rintf, ::rintf, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::rintf, ::rintf, "rintf_perf.log") diff --git a/libc/test/src/math/differential_testing/roundf_diff.cpp b/libc/test/src/math/differential_testing/roundf_diff.cpp index 803566a9e4b843eb10cbc94cb9637e4fbe839b65..e1401a01af3574d090ef0c97d17f781d521f930d 100644 --- a/libc/test/src/math/differential_testing/roundf_diff.cpp +++ b/libc/test/src/math/differential_testing/roundf_diff.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::roundf, ::roundf, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::roundf, ::roundf, "roundf_diff.log") diff --git a/libc/test/src/math/differential_testing/roundf_perf.cpp b/libc/test/src/math/differential_testing/roundf_perf.cpp index 51be6f187e26be8193f702e586e4c03980f195bf..091c7b2b86800f4c4a1a1d392bfc70b6e5130ce8 100644 --- a/libc/test/src/math/differential_testing/roundf_perf.cpp +++ b/libc/test/src/math/differential_testing/roundf_perf.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::roundf, ::roundf, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::roundf, ::roundf, "roundf_perf.log") diff --git a/libc/test/src/math/differential_testing/sinf_diff.cpp b/libc/test/src/math/differential_testing/sinf_diff.cpp index d69db9b1a136bf8230414486dc01271a01b1cfd2..cb4557e6796b5561adcddd42e79af9185369886b 100644 --- a/libc/test/src/math/differential_testing/sinf_diff.cpp +++ b/libc/test/src/math/differential_testing/sinf_diff.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::sinf, ::sinf, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::sinf, ::sinf, "sinf_diff.log") diff --git a/libc/test/src/math/differential_testing/sinf_perf.cpp b/libc/test/src/math/differential_testing/sinf_perf.cpp index b32821a9483236a327ff5738a6e0ed70f1275456..7247bca2853d881b25721fe5c0b4446861ed28e3 100644 --- a/libc/test/src/math/differential_testing/sinf_perf.cpp +++ b/libc/test/src/math/differential_testing/sinf_perf.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::sinf, ::sinf, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::sinf, ::sinf, "sinf_perf.log") diff --git a/libc/test/src/math/differential_testing/sqrtf_diff.cpp b/libc/test/src/math/differential_testing/sqrtf_diff.cpp index 3fdcf930d2582bf567ee095b69949aa6ebd5f31e..22ddeaac9caf9997a7f4e80967f8da5b17693219 100644 --- a/libc/test/src/math/differential_testing/sqrtf_diff.cpp +++ b/libc/test/src/math/differential_testing/sqrtf_diff.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::sqrtf, ::sqrtf, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::sqrtf, ::sqrtf, "sqrtf_diff.log") diff --git a/libc/test/src/math/differential_testing/sqrtf_perf.cpp b/libc/test/src/math/differential_testing/sqrtf_perf.cpp index d3ceb9d46fb2733c049c4a31f5508bdc25e923db..5ae586ba31267ddef5391985ca0502d7b8426db6 100644 --- a/libc/test/src/math/differential_testing/sqrtf_perf.cpp +++ b/libc/test/src/math/differential_testing/sqrtf_perf.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::sqrtf, ::sqrtf, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::sqrtf, ::sqrtf, "sqrtf_perf.log") diff --git a/libc/test/src/math/differential_testing/truncf_diff.cpp b/libc/test/src/math/differential_testing/truncf_diff.cpp index 30ed0fab1d898c68d083162deb6bc44156d0c279..7f6ac4e6a926941358b08ee3e728e4a7944c377a 100644 --- a/libc/test/src/math/differential_testing/truncf_diff.cpp +++ b/libc/test/src/math/differential_testing/truncf_diff.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, __llvm_libc::truncf, ::truncf, +SINGLE_INPUT_SINGLE_OUTPUT_DIFF(float, LIBC_NAMESPACE::truncf, ::truncf, "truncf_diff.log") diff --git a/libc/test/src/math/differential_testing/truncf_perf.cpp b/libc/test/src/math/differential_testing/truncf_perf.cpp index f5cee930003eac00832affad8836d976048ce9d6..e07db1320fddd79b157cbfba27e01f7e38d6e38f 100644 --- a/libc/test/src/math/differential_testing/truncf_perf.cpp +++ b/libc/test/src/math/differential_testing/truncf_perf.cpp @@ -12,5 +12,5 @@ #include -SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, __llvm_libc::truncf, ::truncf, +SINGLE_INPUT_SINGLE_OUTPUT_PERF(float, LIBC_NAMESPACE::truncf, ::truncf, "truncf_perf.log") diff --git a/libc/test/src/math/erff_test.cpp b/libc/test/src/math/erff_test.cpp index a25ac6f0fca4c97889f1a041fcbdf5e10d64117e..3cb24778d96a151317e7cee23e5ad92b2e96d81e 100644 --- a/libc/test/src/math/erff_test.cpp +++ b/libc/test/src/math/erff_test.cpp @@ -16,17 +16,17 @@ #include #include -namespace mpfr = __llvm_libc::testing::mpfr; -using __llvm_libc::testing::tlog; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcErffTest, SpecialNumbers) { - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::erff(aNaN)); - EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::erff(inf)); - EXPECT_FP_EQ_ALL_ROUNDING(-1.0f, __llvm_libc::erff(neg_inf)); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::erff(zero)); - EXPECT_FP_EQ_ALL_ROUNDING(neg_zero, __llvm_libc::erff(neg_zero)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::erff(aNaN)); + EXPECT_FP_EQ_ALL_ROUNDING(1.0f, LIBC_NAMESPACE::erff(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(-1.0f, LIBC_NAMESPACE::erff(neg_inf)); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::erff(zero)); + EXPECT_FP_EQ_ALL_ROUNDING(neg_zero, LIBC_NAMESPACE::erff(neg_zero)); } TEST(LlvmLibcErffTest, TrickyInputs) { @@ -38,9 +38,9 @@ TEST(LlvmLibcErffTest, TrickyInputs) { for (int i = 0; i < N; ++i) { float x = float(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Erf, x, - __llvm_libc::erff(x), 0.5); + LIBC_NAMESPACE::erff(x), 0.5); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Erf, -x, - __llvm_libc::erff(-x), 0.5); + LIBC_NAMESPACE::erff(-x), 0.5); } } @@ -67,7 +67,7 @@ TEST(LlvmLibcErffTest, InFloatRange) { if (isnan(x)) continue; - float result = __llvm_libc::erff(x); + float result = LIBC_NAMESPACE::erff(x); ++cc; if (isnan(result)) continue; diff --git a/libc/test/src/math/exhaustive/acosf_test.cpp b/libc/test/src/math/exhaustive/acosf_test.cpp index 4cece0b76ecacbffdef4f9960c77b026ea53bd94..df4adae5fd0e64f59d99715ab9751a108c60e4ea 100644 --- a/libc/test/src/math/exhaustive/acosf_test.cpp +++ b/libc/test/src/math/exhaustive/acosf_test.cpp @@ -10,11 +10,11 @@ #include "src/math/acosf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcAcosfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest; + LIBC_NAMESPACE::acosf>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/acoshf_test.cpp b/libc/test/src/math/exhaustive/acoshf_test.cpp index 1dd993c26b8cacb9f91e5941e48e58b0d59cc4d3..eff8b64a7dae1a01bb8d27148bd28a78e53421a1 100644 --- a/libc/test/src/math/exhaustive/acoshf_test.cpp +++ b/libc/test/src/math/exhaustive/acoshf_test.cpp @@ -10,11 +10,11 @@ #include "src/math/acoshf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcAcoshfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest; + LIBC_NAMESPACE::acoshf>; // Range: [1, Inf]; static constexpr uint32_t POS_START = 0x3f80'0000U; diff --git a/libc/test/src/math/exhaustive/asinf_test.cpp b/libc/test/src/math/exhaustive/asinf_test.cpp index 5dcb625304a1f5e7c8eda9754df69caa74811f41..f88d254b075041405c921e853964d535523d8960 100644 --- a/libc/test/src/math/exhaustive/asinf_test.cpp +++ b/libc/test/src/math/exhaustive/asinf_test.cpp @@ -10,11 +10,11 @@ #include "src/math/asinf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcAsinfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest; + LIBC_NAMESPACE::asinf>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/asinhf_test.cpp b/libc/test/src/math/exhaustive/asinhf_test.cpp index 6af0ec0d6b03d145ecdaead5277ac9f07c7ae69c..8bc62bd393dac4a47351f738c2ab51e4ae91b8f5 100644 --- a/libc/test/src/math/exhaustive/asinhf_test.cpp +++ b/libc/test/src/math/exhaustive/asinhf_test.cpp @@ -10,11 +10,11 @@ #include "src/math/asinhf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcAsinhfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest; + LIBC_NAMESPACE::asinhf>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/atanf_test.cpp b/libc/test/src/math/exhaustive/atanf_test.cpp index c7c891ecbbd1ec8a66384e3559cd1e1b1029d9c5..508c288b050c55ec1eda38882d174259218b6770 100644 --- a/libc/test/src/math/exhaustive/atanf_test.cpp +++ b/libc/test/src/math/exhaustive/atanf_test.cpp @@ -10,11 +10,11 @@ #include "src/math/atanf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcAtanfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest; + LIBC_NAMESPACE::atanf>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/atanhf_test.cpp b/libc/test/src/math/exhaustive/atanhf_test.cpp index 17bd6ec9dda04b0a39acd9d6fdb0836d4d5b4e52..d2e63b33a0b990f92951a6b79ed13b9a4dec19a1 100644 --- a/libc/test/src/math/exhaustive/atanhf_test.cpp +++ b/libc/test/src/math/exhaustive/atanhf_test.cpp @@ -11,11 +11,11 @@ #include "src/math/atanhf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; using LlvmLibcAtanhfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest; + LIBC_NAMESPACE::atanhf>; // Range: [0, 1.0]; static const uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/cosf_test.cpp b/libc/test/src/math/exhaustive/cosf_test.cpp index 465d8242bc854382f9273a8663f729663dd99617..89b75199ba1225e105578bbb823ef3b557a712a7 100644 --- a/libc/test/src/math/exhaustive/cosf_test.cpp +++ b/libc/test/src/math/exhaustive/cosf_test.cpp @@ -10,11 +10,11 @@ #include "src/math/cosf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcCosfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest; + LIBC_NAMESPACE::cosf>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/coshf_test.cpp b/libc/test/src/math/exhaustive/coshf_test.cpp index 5fb4856b0cf79c8605e371afa2c7fdcc10091cfd..cbfa654800bfd75c97582cb172cf5afbdd92be57 100644 --- a/libc/test/src/math/exhaustive/coshf_test.cpp +++ b/libc/test/src/math/exhaustive/coshf_test.cpp @@ -10,11 +10,11 @@ #include "src/math/coshf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcCoshfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest; + LIBC_NAMESPACE::coshf>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/erff_test.cpp b/libc/test/src/math/exhaustive/erff_test.cpp index f8e1a1b3106317a2ca2d01fb2ca7ee00f68c1f5d..5b8884a9d4d0c1ae7a7c64c288b076984c738ae5 100644 --- a/libc/test/src/math/exhaustive/erff_test.cpp +++ b/libc/test/src/math/exhaustive/erff_test.cpp @@ -10,11 +10,11 @@ #include "src/math/erff.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcErffExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest; + LIBC_NAMESPACE::erff>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/exhaustive_test.h b/libc/test/src/math/exhaustive/exhaustive_test.h index 00dad034dd6cc41a744afb0aab99b4d2636863c2..c4e68d40e8e91e7e3875ccf0ac85af4a9406516f 100644 --- a/libc/test/src/math/exhaustive/exhaustive_test.h +++ b/libc/test/src/math/exhaustive/exhaustive_test.h @@ -33,14 +33,14 @@ // or test_full_range_all_roundings(start, stop). // * For single input single output math function, use the convenient template: // LlvmLibcUnaryOpExhaustiveMathTest. -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; template using UnaryOp = T(T); template Func> -struct UnaryOpChecker : public virtual __llvm_libc::testing::Test { +struct UnaryOpChecker : public virtual LIBC_NAMESPACE::testing::Test { using FloatType = T; - using FPBits = __llvm_libc::fputil::FPBits; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; using UIntType = typename FPBits::UIntType; static constexpr UnaryOp *FUNC = Func; @@ -67,11 +67,12 @@ struct UnaryOpChecker : public virtual __llvm_libc::testing::Test { } }; -// Checker class needs inherit from __llvm_libc::testing::Test and provide +// Checker class needs inherit from LIBC_NAMESPACE::testing::Test and provide // UIntType and check method. template -struct LlvmLibcExhaustiveMathTest : public virtual __llvm_libc::testing::Test, - public Checker { +struct LlvmLibcExhaustiveMathTest + : public virtual LIBC_NAMESPACE::testing::Test, + public Checker { using FloatType = typename Checker::FloatType; using FPBits = typename Checker::FPBits; using UIntType = typename Checker::UIntType; diff --git a/libc/test/src/math/exhaustive/exp10f_test.cpp b/libc/test/src/math/exhaustive/exp10f_test.cpp index eba0f65de1a8fc7c723af8509d6f7edbea37bfb2..0daad67847b33205fc9a10367f9041e2a40fa4a3 100644 --- a/libc/test/src/math/exhaustive/exp10f_test.cpp +++ b/libc/test/src/math/exhaustive/exp10f_test.cpp @@ -10,11 +10,11 @@ #include "src/math/exp10f.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcExp10fExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest; + LIBC_NAMESPACE::exp10f>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/exp2f_test.cpp b/libc/test/src/math/exhaustive/exp2f_test.cpp index 8c9b88988ba68c400b58e5b5605619347ab992d6..6b91c36b29e330a3b5ac70ca3c0b31aded880659 100644 --- a/libc/test/src/math/exhaustive/exp2f_test.cpp +++ b/libc/test/src/math/exhaustive/exp2f_test.cpp @@ -10,11 +10,11 @@ #include "src/math/exp2f.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcExp2fExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest; + LIBC_NAMESPACE::exp2f>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/expf_test.cpp b/libc/test/src/math/exhaustive/expf_test.cpp index 75002a2de96538b7d7debafefcbedbdc16c16728..79ab79433362ae880fe090df70d9f5dd100dd13b 100644 --- a/libc/test/src/math/exhaustive/expf_test.cpp +++ b/libc/test/src/math/exhaustive/expf_test.cpp @@ -10,11 +10,11 @@ #include "src/math/expf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcExpfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest; + LIBC_NAMESPACE::expf>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/expm1f_test.cpp b/libc/test/src/math/exhaustive/expm1f_test.cpp index 2cd27f1e88f27699ba95117336f7dd76be07d722..9c50f1a70aa74dbe07f4a8e514488d1b8b07202d 100644 --- a/libc/test/src/math/exhaustive/expm1f_test.cpp +++ b/libc/test/src/math/exhaustive/expm1f_test.cpp @@ -10,11 +10,11 @@ #include "src/math/expm1f.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcExpm1fExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest; + LIBC_NAMESPACE::expm1f>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/fmod_generic_impl_test.cpp b/libc/test/src/math/exhaustive/fmod_generic_impl_test.cpp index 1273cf0b588bd1b2432a10f9345d22c87d8a376c..b47d24c54869bbab3102c2a9c5d9796833d52738 100644 --- a/libc/test/src/math/exhaustive/fmod_generic_impl_test.cpp +++ b/libc/test/src/math/exhaustive/fmod_generic_impl_test.cpp @@ -14,15 +14,15 @@ #include #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; template -class LlvmLibcFModTest : public __llvm_libc::testing::Test { +class LlvmLibcFModTest : public LIBC_NAMESPACE::testing::Test { - using DivisionHelper = __llvm_libc::cpp::conditional_t< + using DivisionHelper = LIBC_NAMESPACE::cpp::conditional_t< InverseMultiplication, - __llvm_libc::fputil::generic::FModDivisionInvMultHelper, - __llvm_libc::fputil::generic::FModDivisionSimpleHelper>; + LIBC_NAMESPACE::fputil::generic::FModDivisionInvMultHelper, + LIBC_NAMESPACE::fputil::generic::FModDivisionSimpleHelper>; static constexpr std::array test_bases = { T(0.0), @@ -39,8 +39,8 @@ class LlvmLibcFModTest : public __llvm_libc::testing::Test { public: void testExtensive() { - using FMod = __llvm_libc::fputil::generic::FMod< - T, __llvm_libc::fputil::generic::FModFastMathWrapper, + using FMod = LIBC_NAMESPACE::fputil::generic::FMod< + T, LIBC_NAMESPACE::fputil::generic::FModFastMathWrapper, DivisionHelper>; using nl = std::numeric_limits; int min2 = nl::min_exponent - nl::digits - 5; diff --git a/libc/test/src/math/exhaustive/hypotf_test.cpp b/libc/test/src/math/exhaustive/hypotf_test.cpp index c45e7412a7b12657806f92f04ae92d185d4587dd..8812f0e5dcde34a7f940f2f5fa834247821cddef 100644 --- a/libc/test/src/math/exhaustive/hypotf_test.cpp +++ b/libc/test/src/math/exhaustive/hypotf_test.cpp @@ -13,11 +13,11 @@ #include "test/UnitTest/FPMatcher.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -struct HypotfChecker : public virtual __llvm_libc::testing::Test { +struct HypotfChecker : public virtual LIBC_NAMESPACE::testing::Test { using FloatType = float; - using FPBits = __llvm_libc::fputil::FPBits; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; using UIntType = typename FPBits::UIntType; uint64_t check(uint32_t start, uint32_t stop, mpfr::RoundingMode rounding) { @@ -35,12 +35,12 @@ struct HypotfChecker : public virtual __llvm_libc::testing::Test { uint32_t ybits = Y_START; do { float y = float(FPBits(ybits)); - bool correct = TEST_FP_EQ(__llvm_libc::fputil::hypot(x, y), - __llvm_libc::hypotf(x, y)); + bool correct = TEST_FP_EQ(LIBC_NAMESPACE::fputil::hypot(x, y), + LIBC_NAMESPACE::hypotf(x, y)); // Using MPFR will be much slower. // mpfr::BinaryInput input{x, y}; // bool correct = TEST_MPFR_MATCH_ROUNDING_SILENTLY( - // mpfr::Operation::Hypot, input, __llvm_libc::hypotf(x, y), 0.5, + // mpfr::Operation::Hypot, input, LIBC_NAMESPACE::hypotf(x, y), 0.5, // rounding); failed += (!correct); } while (ybits++ < Y_STOP); diff --git a/libc/test/src/math/exhaustive/log10f_test.cpp b/libc/test/src/math/exhaustive/log10f_test.cpp index 912fda144be674ee522ba3f731dc9eb73a84364e..d626df07e28f4193eed8d1f0fe48de070fb2708b 100644 --- a/libc/test/src/math/exhaustive/log10f_test.cpp +++ b/libc/test/src/math/exhaustive/log10f_test.cpp @@ -10,11 +10,11 @@ #include "src/math/log10f.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcLog10fExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest; + LIBC_NAMESPACE::log10f>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/log1pf_test.cpp b/libc/test/src/math/exhaustive/log1pf_test.cpp index 992781571f035490fa0652d488f4e56d13077338..698e08e543871c67498c27e808632bbcac59ef55 100644 --- a/libc/test/src/math/exhaustive/log1pf_test.cpp +++ b/libc/test/src/math/exhaustive/log1pf_test.cpp @@ -10,11 +10,11 @@ #include "src/math/log1pf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcLog1pfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest; + LIBC_NAMESPACE::log1pf>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/log2f_test.cpp b/libc/test/src/math/exhaustive/log2f_test.cpp index 249ea2e1dfaa1457e1aa2cf62b5481d14b6d8694..a84b0964c6045c0d468a2e8363e3cfd170115852 100644 --- a/libc/test/src/math/exhaustive/log2f_test.cpp +++ b/libc/test/src/math/exhaustive/log2f_test.cpp @@ -10,11 +10,11 @@ #include "src/math/log2f.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcLog2fExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest; + LIBC_NAMESPACE::log2f>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/logf_test.cpp b/libc/test/src/math/exhaustive/logf_test.cpp index cf54ba5e78c23f827ae6345a1b274e4977fa7f6f..2f0ff201e56224117faead5f834e7c85eb721ce1 100644 --- a/libc/test/src/math/exhaustive/logf_test.cpp +++ b/libc/test/src/math/exhaustive/logf_test.cpp @@ -10,11 +10,11 @@ #include "src/math/logf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcLogfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest; + LIBC_NAMESPACE::logf>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/sincosf_test.cpp b/libc/test/src/math/exhaustive/sincosf_test.cpp index 19179243047c0844507c542bdd2561a2afdc8fa2..f73a1a64c5e4ddef943339c47ab8941a77f62047 100644 --- a/libc/test/src/math/exhaustive/sincosf_test.cpp +++ b/libc/test/src/math/exhaustive/sincosf_test.cpp @@ -10,11 +10,11 @@ #include "src/math/sincosf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; -struct SincosfChecker : public virtual __llvm_libc::testing::Test { +struct SincosfChecker : public virtual LIBC_NAMESPACE::testing::Test { using FloatType = float; - using FPBits = __llvm_libc::fputil::FPBits; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; using UIntType = uint32_t; uint64_t check(UIntType start, UIntType stop, mpfr::RoundingMode rounding) { @@ -27,7 +27,7 @@ struct SincosfChecker : public virtual __llvm_libc::testing::Test { FPBits xbits(bits); FloatType x = FloatType(xbits); FloatType sinx, cosx; - __llvm_libc::sincosf(x, &sinx, &cosx); + LIBC_NAMESPACE::sincosf(x, &sinx, &cosx); bool correct = TEST_MPFR_MATCH_ROUNDING_SILENTLY(mpfr::Operation::Sin, x, sinx, 0.5, rounding); diff --git a/libc/test/src/math/exhaustive/sinf_test.cpp b/libc/test/src/math/exhaustive/sinf_test.cpp index 1c0ce568eadf73c654d54bbeb0bb000410fe422c..72255ae2d642123f71654cbbf90afc10f39019f5 100644 --- a/libc/test/src/math/exhaustive/sinf_test.cpp +++ b/libc/test/src/math/exhaustive/sinf_test.cpp @@ -10,11 +10,11 @@ #include "src/math/sinf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcSinfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest; + LIBC_NAMESPACE::sinf>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/sinhf_test.cpp b/libc/test/src/math/exhaustive/sinhf_test.cpp index 50f1094abf14f3863b763e9273dcf6b306c292eb..51505afb8c3bf1f0e1e078408203a86937cf158f 100644 --- a/libc/test/src/math/exhaustive/sinhf_test.cpp +++ b/libc/test/src/math/exhaustive/sinhf_test.cpp @@ -10,11 +10,11 @@ #include "src/math/sinhf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcSinhfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest; + LIBC_NAMESPACE::sinhf>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/sqrtf_test.cpp b/libc/test/src/math/exhaustive/sqrtf_test.cpp index e475182a9359a2f38f3886da66a9d76806e734fb..6f761320554e37bd6aa481319a65af06e8375c7f 100644 --- a/libc/test/src/math/exhaustive/sqrtf_test.cpp +++ b/libc/test/src/math/exhaustive/sqrtf_test.cpp @@ -10,11 +10,11 @@ #include "src/math/sqrtf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcSqrtfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest; + LIBC_NAMESPACE::sqrtf>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/tanf_test.cpp b/libc/test/src/math/exhaustive/tanf_test.cpp index 9e1278b4c3ea51b21a346fae224b94d385d87680..09e63ea0d89c7c1dc955c4e9531fcc514639a872 100644 --- a/libc/test/src/math/exhaustive/tanf_test.cpp +++ b/libc/test/src/math/exhaustive/tanf_test.cpp @@ -11,11 +11,11 @@ #include "src/math/tanf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcTanfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest; + LIBC_NAMESPACE::tanf>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exhaustive/tanhf_test.cpp b/libc/test/src/math/exhaustive/tanhf_test.cpp index 3c3951c14ffdc03e004661e23cac855493683654..e341064d5a9ecd871773d32da68f835592f416e8 100644 --- a/libc/test/src/math/exhaustive/tanhf_test.cpp +++ b/libc/test/src/math/exhaustive/tanhf_test.cpp @@ -10,11 +10,11 @@ #include "src/math/tanhf.h" #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LlvmLibcTanhfExhaustiveTest = LlvmLibcUnaryOpExhaustiveMathTest; + LIBC_NAMESPACE::tanhf>; // Range: [0, Inf]; static constexpr uint32_t POS_START = 0x0000'0000U; diff --git a/libc/test/src/math/exp10_test.cpp b/libc/test/src/math/exp10_test.cpp index 2b4c5ccc13f5d8210d8292223c8031901110ea2a..86d902eaad306b2ac646eb855cb5cf0fec196b8c 100644 --- a/libc/test/src/math/exp10_test.cpp +++ b/libc/test/src/math/exp10_test.cpp @@ -17,20 +17,21 @@ #include #include -namespace mpfr = __llvm_libc::testing::mpfr; -using __llvm_libc::testing::tlog; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(double) TEST(LlvmLibcExp10Test, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::exp10(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::exp10(inf)); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::exp10(neg_inf)); - EXPECT_FP_EQ_WITH_EXCEPTION(zero, __llvm_libc::exp10(-0x1.0p20), + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp10(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::exp10(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::exp10(neg_inf)); + EXPECT_FP_EQ_WITH_EXCEPTION(zero, LIBC_NAMESPACE::exp10(-0x1.0p20), FE_UNDERFLOW); - EXPECT_FP_EQ_WITH_EXCEPTION(inf, __llvm_libc::exp10(0x1.0p20), FE_OVERFLOW); - EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp10(0.0)); - EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp10(-0.0)); + EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp10(0x1.0p20), + FE_OVERFLOW); + EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp10(0.0)); + EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp10(-0.0)); } TEST(LlvmLibcExp10Test, TrickyInputs) { @@ -80,14 +81,14 @@ TEST(LlvmLibcExp10Test, TrickyInputs) { for (int i = 0; i < N; ++i) { double x = double(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp10, x, - __llvm_libc::exp10(x), 0.5); + LIBC_NAMESPACE::exp10(x), 0.5); } } TEST(LlvmLibcExp10Test, InDoubleRange) { constexpr uint64_t COUNT = 1'231; - uint64_t START = __llvm_libc::fputil::FPBits(0.25).uintval(); - uint64_t STOP = __llvm_libc::fputil::FPBits(4.0).uintval(); + uint64_t START = LIBC_NAMESPACE::fputil::FPBits(0.25).uintval(); + uint64_t STOP = LIBC_NAMESPACE::fputil::FPBits(4.0).uintval(); uint64_t STEP = (STOP - START) / COUNT; auto test = [&](mpfr::RoundingMode rounding_mode) { @@ -106,7 +107,7 @@ TEST(LlvmLibcExp10Test, InDoubleRange) { if (isnan(x) || isinf(x) || x < 0.0) continue; libc_errno = 0; - double result = __llvm_libc::exp10(x); + double result = LIBC_NAMESPACE::exp10(x); ++cc; if (isnan(result) || isinf(result)) continue; diff --git a/libc/test/src/math/exp10f_test.cpp b/libc/test/src/math/exp10f_test.cpp index 384f9064db107f273964725c3e1db7ba981321ac..ac8f5515347054cbdaacbe091e3297edceb91f56 100644 --- a/libc/test/src/math/exp10f_test.cpp +++ b/libc/test/src/math/exp10f_test.cpp @@ -16,58 +16,58 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcExp10fTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ(aNaN, __llvm_libc::exp10f(aNaN)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp10f(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(inf, __llvm_libc::exp10f(inf)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::exp10f(inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(0.0f, __llvm_libc::exp10f(neg_inf)); + EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::exp10f(neg_inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(1.0f, __llvm_libc::exp10f(0.0f)); + EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::exp10f(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(1.0f, __llvm_libc::exp10f(-0.0f)); + EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::exp10f(-0.0f)); EXPECT_MATH_ERRNO(0); } TEST(LlvmLibcExp10fTest, Overflow) { libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::exp10f(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::exp10f(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::exp10f(float(FPBits(0x43000000U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::exp10f(float(FPBits(0x43000000U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::exp10f(float(FPBits(0x43000001U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::exp10f(float(FPBits(0x43000001U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); } TEST(LlvmLibcExp10fTest, Underflow) { libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( - 0.0f, __llvm_libc::exp10f(float(FPBits(0xff7fffffU))), FE_UNDERFLOW); + 0.0f, LIBC_NAMESPACE::exp10f(float(FPBits(0xff7fffffU))), FE_UNDERFLOW); EXPECT_MATH_ERRNO(ERANGE); float x = float(FPBits(0xc2cffff8U)); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp10, x, - __llvm_libc::exp10f(x), 0.5); + LIBC_NAMESPACE::exp10f(x), 0.5); EXPECT_MATH_ERRNO(ERANGE); x = float(FPBits(0xc2d00008U)); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp10, x, - __llvm_libc::exp10f(x), 0.5); + LIBC_NAMESPACE::exp10f(x), 0.5); EXPECT_MATH_ERRNO(ERANGE); } @@ -99,9 +99,9 @@ TEST(LlvmLibcExp10fTest, TrickyInputs) { libc_errno = 0; float x = float(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp10, x, - __llvm_libc::exp10f(x), 0.5); + LIBC_NAMESPACE::exp10f(x), 0.5); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp10, -x, - __llvm_libc::exp10f(-x), 0.5); + LIBC_NAMESPACE::exp10f(-x), 0.5); } } @@ -113,7 +113,7 @@ TEST(LlvmLibcExp10fTest, InFloatRange) { if (isnan(x) || isinf(x)) continue; libc_errno = 0; - float result = __llvm_libc::exp10f(x); + float result = LIBC_NAMESPACE::exp10f(x); // If the computation resulted in an error or did not produce valid result // in the single-precision floating point range, then ignore comparing with @@ -122,6 +122,6 @@ TEST(LlvmLibcExp10fTest, InFloatRange) { if (isnan(result) || isinf(result) || libc_errno != 0) continue; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp10, x, - __llvm_libc::exp10f(x), 0.5); + LIBC_NAMESPACE::exp10f(x), 0.5); } } diff --git a/libc/test/src/math/exp2_test.cpp b/libc/test/src/math/exp2_test.cpp index 61081690880c509a44ec8475897d326c184eaccb..6a90c9ba911bd3fdb80f8b865c91c6e9fe65248e 100644 --- a/libc/test/src/math/exp2_test.cpp +++ b/libc/test/src/math/exp2_test.cpp @@ -17,19 +17,20 @@ #include #include -namespace mpfr = __llvm_libc::testing::mpfr; -using __llvm_libc::testing::tlog; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(double) TEST(LlvmLibcExp2Test, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::exp2(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::exp2(inf)); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::exp2(neg_inf)); - EXPECT_FP_EQ_WITH_EXCEPTION(zero, __llvm_libc::exp2(-0x1.0p20), FE_UNDERFLOW); - EXPECT_FP_EQ_WITH_EXCEPTION(inf, __llvm_libc::exp2(0x1.0p20), FE_OVERFLOW); - EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp2(0.0)); - EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp2(-0.0)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp2(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::exp2(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::exp2(neg_inf)); + EXPECT_FP_EQ_WITH_EXCEPTION(zero, LIBC_NAMESPACE::exp2(-0x1.0p20), + FE_UNDERFLOW); + EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp2(0x1.0p20), FE_OVERFLOW); + EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp2(0.0)); + EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp2(-0.0)); } TEST(LlvmLibcExp2Test, TrickyInputs) { @@ -55,14 +56,14 @@ TEST(LlvmLibcExp2Test, TrickyInputs) { for (int i = 0; i < N; ++i) { double x = double(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp2, x, - __llvm_libc::exp2(x), 0.5); + LIBC_NAMESPACE::exp2(x), 0.5); } } TEST(LlvmLibcExp2Test, InDoubleRange) { constexpr uint64_t COUNT = 1'231; - uint64_t START = __llvm_libc::fputil::FPBits(0.25).uintval(); - uint64_t STOP = __llvm_libc::fputil::FPBits(4.0).uintval(); + uint64_t START = LIBC_NAMESPACE::fputil::FPBits(0.25).uintval(); + uint64_t STOP = LIBC_NAMESPACE::fputil::FPBits(4.0).uintval(); uint64_t STEP = (STOP - START) / COUNT; auto test = [&](mpfr::RoundingMode rounding_mode) { @@ -81,7 +82,7 @@ TEST(LlvmLibcExp2Test, InDoubleRange) { if (isnan(x) || isinf(x) || x < 0.0) continue; libc_errno = 0; - double result = __llvm_libc::exp2(x); + double result = LIBC_NAMESPACE::exp2(x); ++cc; if (isnan(result) || isinf(result)) continue; diff --git a/libc/test/src/math/exp2f_test.cpp b/libc/test/src/math/exp2f_test.cpp index afd2c0f700514c8074967ff4dd494c75f6c89726..987e1b9f59cbb7b6454dfacf59ff91cb264364aa 100644 --- a/libc/test/src/math/exp2f_test.cpp +++ b/libc/test/src/math/exp2f_test.cpp @@ -17,41 +17,41 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcExp2fTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ(aNaN, __llvm_libc::exp2f(aNaN)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp2f(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(inf, __llvm_libc::exp2f(inf)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::exp2f(inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(0.0f, __llvm_libc::exp2f(neg_inf)); + EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::exp2f(neg_inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(1.0f, __llvm_libc::exp2f(0.0f)); + EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::exp2f(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(1.0f, __llvm_libc::exp2f(-0.0f)); + EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::exp2f(-0.0f)); EXPECT_MATH_ERRNO(0); } TEST(LlvmLibcExp2fTest, Overflow) { libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::exp2f(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::exp2f(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::exp2f(float(FPBits(0x43000000U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::exp2f(float(FPBits(0x43000000U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::exp2f(float(FPBits(0x43000001U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::exp2f(float(FPBits(0x43000001U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); } @@ -75,7 +75,7 @@ TEST(LlvmLibcExp2fTest, TrickyInputs) { libc_errno = 0; float x = float(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp2, x, - __llvm_libc::exp2f(x), 0.5); + LIBC_NAMESPACE::exp2f(x), 0.5); EXPECT_MATH_ERRNO(0); } } @@ -83,22 +83,22 @@ TEST(LlvmLibcExp2fTest, TrickyInputs) { TEST(LlvmLibcExp2fTest, Underflow) { libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( - 0.0f, __llvm_libc::exp2f(float(FPBits(0xff7fffffU))), FE_UNDERFLOW); + 0.0f, LIBC_NAMESPACE::exp2f(float(FPBits(0xff7fffffU))), FE_UNDERFLOW); EXPECT_MATH_ERRNO(ERANGE); float x = float(FPBits(0xc3158000U)); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp2, x, - __llvm_libc::exp2f(x), 0.5); + LIBC_NAMESPACE::exp2f(x), 0.5); EXPECT_MATH_ERRNO(0); x = float(FPBits(0xc3160000U)); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp2, x, - __llvm_libc::exp2f(x), 0.5); + LIBC_NAMESPACE::exp2f(x), 0.5); EXPECT_MATH_ERRNO(ERANGE); x = float(FPBits(0xc3165432U)); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp2, x, - __llvm_libc::exp2f(x), 0.5); + LIBC_NAMESPACE::exp2f(x), 0.5); EXPECT_MATH_ERRNO(ERANGE); } @@ -110,7 +110,7 @@ TEST(LlvmLibcExp2fTest, InFloatRange) { if (isnan(x) || isinf(x)) continue; libc_errno = 0; - float result = __llvm_libc::exp2f(x); + float result = LIBC_NAMESPACE::exp2f(x); // If the computation resulted in an error or did not produce valid result // in the single-precision floating point range, then ignore comparing with @@ -119,6 +119,6 @@ TEST(LlvmLibcExp2fTest, InFloatRange) { if (isnan(result) || isinf(result) || libc_errno != 0) continue; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp2, x, - __llvm_libc::exp2f(x), 0.5); + LIBC_NAMESPACE::exp2f(x), 0.5); } } diff --git a/libc/test/src/math/exp_test.cpp b/libc/test/src/math/exp_test.cpp index 7ff149acdb32f81c7e2f3f376b1f6854fb58ddd0..06894bce70699e516bce019c117e92f1a351e73c 100644 --- a/libc/test/src/math/exp_test.cpp +++ b/libc/test/src/math/exp_test.cpp @@ -17,19 +17,20 @@ #include #include -namespace mpfr = __llvm_libc::testing::mpfr; -using __llvm_libc::testing::tlog; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(double) TEST(LlvmLibcExpTest, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::exp(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::exp(inf)); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::exp(neg_inf)); - EXPECT_FP_EQ_WITH_EXCEPTION(zero, __llvm_libc::exp(-0x1.0p20), FE_UNDERFLOW); - EXPECT_FP_EQ_WITH_EXCEPTION(inf, __llvm_libc::exp(0x1.0p20), FE_OVERFLOW); - EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp(0.0)); - EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp(-0.0)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::exp(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::exp(neg_inf)); + EXPECT_FP_EQ_WITH_EXCEPTION(zero, LIBC_NAMESPACE::exp(-0x1.0p20), + FE_UNDERFLOW); + EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp(0x1.0p20), FE_OVERFLOW); + EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp(0.0)); + EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp(-0.0)); } TEST(LlvmLibcExpTest, TrickyInputs) { @@ -52,15 +53,15 @@ TEST(LlvmLibcExpTest, TrickyInputs) { }; for (int i = 0; i < N; ++i) { double x = double(FPBits(INPUTS[i])); - EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, __llvm_libc::exp(x), - 0.5); + EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, + LIBC_NAMESPACE::exp(x), 0.5); } } TEST(LlvmLibcExpTest, InDoubleRange) { constexpr uint64_t COUNT = 1'231; - uint64_t START = __llvm_libc::fputil::FPBits(0.25).uintval(); - uint64_t STOP = __llvm_libc::fputil::FPBits(4.0).uintval(); + uint64_t START = LIBC_NAMESPACE::fputil::FPBits(0.25).uintval(); + uint64_t STOP = LIBC_NAMESPACE::fputil::FPBits(4.0).uintval(); uint64_t STEP = (STOP - START) / COUNT; auto test = [&](mpfr::RoundingMode rounding_mode) { @@ -79,7 +80,7 @@ TEST(LlvmLibcExpTest, InDoubleRange) { if (isnan(x) || isinf(x) || x < 0.0) continue; libc_errno = 0; - double result = __llvm_libc::exp(x); + double result = LIBC_NAMESPACE::exp(x); ++cc; if (isnan(result) || isinf(result)) continue; diff --git a/libc/test/src/math/expf_test.cpp b/libc/test/src/math/expf_test.cpp index acc0e645a4186a294eedb68a9a64702250965a7c..f015e46d50b6b2de1db4b0c91837d6c6a8e36e57 100644 --- a/libc/test/src/math/expf_test.cpp +++ b/libc/test/src/math/expf_test.cpp @@ -16,58 +16,58 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcExpfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ(aNaN, __llvm_libc::expf(aNaN)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::expf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(inf, __llvm_libc::expf(inf)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::expf(inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(0.0f, __llvm_libc::expf(neg_inf)); + EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::expf(neg_inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(1.0f, __llvm_libc::expf(0.0f)); + EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::expf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(1.0f, __llvm_libc::expf(-0.0f)); + EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::expf(-0.0f)); EXPECT_MATH_ERRNO(0); } TEST(LlvmLibcExpfTest, Overflow) { libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::expf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::expf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::expf(float(FPBits(0x42cffff8U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::expf(float(FPBits(0x42cffff8U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::expf(float(FPBits(0x42d00008U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::expf(float(FPBits(0x42d00008U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); } TEST(LlvmLibcExpfTest, Underflow) { libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( - 0.0f, __llvm_libc::expf(float(FPBits(0xff7fffffU))), FE_UNDERFLOW); + 0.0f, LIBC_NAMESPACE::expf(float(FPBits(0xff7fffffU))), FE_UNDERFLOW); EXPECT_MATH_ERRNO(ERANGE); float x = float(FPBits(0xc2cffff8U)); - EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, __llvm_libc::expf(x), - 0.5); + EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, + LIBC_NAMESPACE::expf(x), 0.5); EXPECT_MATH_ERRNO(ERANGE); x = float(FPBits(0xc2d00008U)); - EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, __llvm_libc::expf(x), - 0.5); + EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, + LIBC_NAMESPACE::expf(x), 0.5); EXPECT_MATH_ERRNO(ERANGE); } @@ -78,28 +78,28 @@ TEST(LlvmLibcExpfTest, Borderline) { libc_errno = 0; x = float(FPBits(0x42affff8U)); - ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, __llvm_libc::expf(x), - 0.5); + ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, + LIBC_NAMESPACE::expf(x), 0.5); EXPECT_MATH_ERRNO(0); x = float(FPBits(0x42b00008U)); - ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, __llvm_libc::expf(x), - 0.5); + ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, + LIBC_NAMESPACE::expf(x), 0.5); EXPECT_MATH_ERRNO(0); x = float(FPBits(0xc2affff8U)); - ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, __llvm_libc::expf(x), - 0.5); + ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, + LIBC_NAMESPACE::expf(x), 0.5); EXPECT_MATH_ERRNO(0); x = float(FPBits(0xc2b00008U)); - ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, __llvm_libc::expf(x), - 0.5); + ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, + LIBC_NAMESPACE::expf(x), 0.5); EXPECT_MATH_ERRNO(0); x = float(FPBits(0xc236bd8cU)); - EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, __llvm_libc::expf(x), - 0.5); + EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, + LIBC_NAMESPACE::expf(x), 0.5); EXPECT_MATH_ERRNO(0); } @@ -111,7 +111,7 @@ TEST(LlvmLibcExpfTest, InFloatRange) { if (isnan(x) || isinf(x)) continue; libc_errno = 0; - float result = __llvm_libc::expf(x); + float result = LIBC_NAMESPACE::expf(x); // If the computation resulted in an error or did not produce valid result // in the single-precision floating point range, then ignore comparing with @@ -120,6 +120,6 @@ TEST(LlvmLibcExpfTest, InFloatRange) { if (isnan(result) || isinf(result) || libc_errno != 0) continue; EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Exp, x, - __llvm_libc::expf(x), 0.5); + LIBC_NAMESPACE::expf(x), 0.5); } } diff --git a/libc/test/src/math/explogxf_test.cpp b/libc/test/src/math/explogxf_test.cpp index d6d646db9c89b91505a7b6e14fc228b5abcff3a6..7b402e17fbc7f3f3f5479248f223eec4a1df58bb 100644 --- a/libc/test/src/math/explogxf_test.cpp +++ b/libc/test/src/math/explogxf_test.cpp @@ -14,7 +14,7 @@ #include "utils/MPFRWrapper/MPFRUtils.h" #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) @@ -27,8 +27,8 @@ auto f_normal = [](float x) -> bool { TEST(LlvmLibcExpxfTest, InFloatRange) { auto fx = [](float x) -> float { - auto result = __llvm_libc::exp_b_range_reduc<__llvm_libc::ExpBase>(x); - double r = __llvm_libc::ExpBase::powb_lo(result.lo); + auto result = LIBC_NAMESPACE::exp_b_range_reduc(x); + double r = LIBC_NAMESPACE::ExpBase::powb_lo(result.lo); return static_cast(result.mh * r); }; auto f_check = [](float x) -> bool { @@ -40,11 +40,11 @@ TEST(LlvmLibcExpxfTest, InFloatRange) { } TEST(LlvmLibcLog2xfTest, InFloatRange) { - CHECK_DATA(0.0f, inf, mpfr::Operation::Log2, __llvm_libc::log2_eval, f_normal, - def_count, def_prec); + CHECK_DATA(0.0f, inf, mpfr::Operation::Log2, LIBC_NAMESPACE::log2_eval, + f_normal, def_count, def_prec); } TEST(LlvmLibcLogxfTest, InFloatRange) { - CHECK_DATA(0.0f, inf, mpfr::Operation::Log, __llvm_libc::log_eval, f_normal, - def_count, def_prec); + CHECK_DATA(0.0f, inf, mpfr::Operation::Log, LIBC_NAMESPACE::log_eval, + f_normal, def_count, def_prec); } diff --git a/libc/test/src/math/expm1f_test.cpp b/libc/test/src/math/expm1f_test.cpp index c05edf8da3cd7811dbfc48e0f473c33959f4e215..f63c9f464c6d7d1f8b4eb9ab1888ef15b67148b8 100644 --- a/libc/test/src/math/expm1f_test.cpp +++ b/libc/test/src/math/expm1f_test.cpp @@ -16,53 +16,53 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcExpm1fTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ(aNaN, __llvm_libc::expm1f(aNaN)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::expm1f(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(inf, __llvm_libc::expm1f(inf)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::expm1f(inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(-1.0f, __llvm_libc::expm1f(neg_inf)); + EXPECT_FP_EQ(-1.0f, LIBC_NAMESPACE::expm1f(neg_inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(0.0f, __llvm_libc::expm1f(0.0f)); + EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::expm1f(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(-0.0f, __llvm_libc::expm1f(-0.0f)); + EXPECT_FP_EQ(-0.0f, LIBC_NAMESPACE::expm1f(-0.0f)); EXPECT_MATH_ERRNO(0); } TEST(LlvmLibcExpm1fTest, Overflow) { libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::expm1f(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::expm1f(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::expm1f(float(FPBits(0x42cffff8U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::expm1f(float(FPBits(0x42cffff8U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::expm1f(float(FPBits(0x42d00008U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::expm1f(float(FPBits(0x42d00008U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); } TEST(LlvmLibcExpm1fTest, Underflow) { libc_errno = 0; - EXPECT_FP_EQ(-1.0f, __llvm_libc::expm1f(float(FPBits(0xff7fffffU)))); + EXPECT_FP_EQ(-1.0f, LIBC_NAMESPACE::expm1f(float(FPBits(0xff7fffffU)))); float x = float(FPBits(0xc2cffff8U)); - EXPECT_FP_EQ(-1.0f, __llvm_libc::expm1f(x)); + EXPECT_FP_EQ(-1.0f, LIBC_NAMESPACE::expm1f(x)); x = float(FPBits(0xc2d00008U)); - EXPECT_FP_EQ(-1.0f, __llvm_libc::expm1f(x)); + EXPECT_FP_EQ(-1.0f, LIBC_NAMESPACE::expm1f(x)); } // Test with inputs which are the borders of underflow/overflow but still @@ -73,42 +73,42 @@ TEST(LlvmLibcExpm1fTest, Borderline) { libc_errno = 0; x = float(FPBits(0x42affff8U)); ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x, - __llvm_libc::expm1f(x), 0.5); + LIBC_NAMESPACE::expm1f(x), 0.5); EXPECT_MATH_ERRNO(0); x = float(FPBits(0x42b00008U)); ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x, - __llvm_libc::expm1f(x), 0.5); + LIBC_NAMESPACE::expm1f(x), 0.5); EXPECT_MATH_ERRNO(0); x = float(FPBits(0xc2affff8U)); ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x, - __llvm_libc::expm1f(x), 0.5); + LIBC_NAMESPACE::expm1f(x), 0.5); EXPECT_MATH_ERRNO(0); x = float(FPBits(0xc2b00008U)); ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x, - __llvm_libc::expm1f(x), 0.5); + LIBC_NAMESPACE::expm1f(x), 0.5); EXPECT_MATH_ERRNO(0); x = float(FPBits(0x3dc252ddU)); ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x, - __llvm_libc::expm1f(x), 0.5); + LIBC_NAMESPACE::expm1f(x), 0.5); EXPECT_MATH_ERRNO(0); x = float(FPBits(0x3e35bec5U)); ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x, - __llvm_libc::expm1f(x), 0.5); + LIBC_NAMESPACE::expm1f(x), 0.5); EXPECT_MATH_ERRNO(0); x = float(FPBits(0x942ed494U)); ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x, - __llvm_libc::expm1f(x), 0.5); + LIBC_NAMESPACE::expm1f(x), 0.5); EXPECT_MATH_ERRNO(0); x = float(FPBits(0xbdc1c6cbU)); ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x, - __llvm_libc::expm1f(x), 0.5); + LIBC_NAMESPACE::expm1f(x), 0.5); EXPECT_MATH_ERRNO(0); } @@ -120,7 +120,7 @@ TEST(LlvmLibcExpm1fTest, InFloatRange) { if (isnan(x) || isinf(x)) continue; libc_errno = 0; - float result = __llvm_libc::expm1f(x); + float result = LIBC_NAMESPACE::expm1f(x); // If the computation resulted in an error or did not produce valid result // in the single-precision floating point range, then ignore comparing with @@ -129,6 +129,6 @@ TEST(LlvmLibcExpm1fTest, InFloatRange) { if (isnan(result) || isinf(result) || libc_errno != 0) continue; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Expm1, x, - __llvm_libc::expm1f(x), 0.5); + LIBC_NAMESPACE::expm1f(x), 0.5); } } diff --git a/libc/test/src/math/fabs_test.cpp b/libc/test/src/math/fabs_test.cpp index 2bf0ddda44ade35962b98d3059221f94ec2778f1..0447040ddae3061c9f42629e3d7951bcaac33ac2 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 6374a1018f1da420537dd754d8dd07a4cd7a7658..9f1e2a66d47655cf623de4cf3a54a91ad3607a9d 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 ff1320225452a920561a5b6c2cff0f09d2e62e81..37d2b54a4c53e111dd40dc788665f91dd36d88f5 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 80174b79b95b83ce713a1d2f1bd14ec59dbbdacc..2f00a30ad1ee6f76e231ee525917916013f6bfe6 100644 --- a/libc/test/src/math/fdim_test.cpp +++ b/libc/test/src/math/fdim_test.cpp @@ -16,16 +16,18 @@ using LlvmLibcFDimTest = FDimTestTemplate; -TEST_F(LlvmLibcFDimTest, NaNArg_fdim) { test_na_n_arg(&__llvm_libc::fdim); } +TEST_F(LlvmLibcFDimTest, NaNArg_fdim) { test_na_n_arg(&LIBC_NAMESPACE::fdim); } -TEST_F(LlvmLibcFDimTest, InfArg_fdim) { test_inf_arg(&__llvm_libc::fdim); } +TEST_F(LlvmLibcFDimTest, InfArg_fdim) { test_inf_arg(&LIBC_NAMESPACE::fdim); } TEST_F(LlvmLibcFDimTest, NegInfArg_fdim) { - test_neg_inf_arg(&__llvm_libc::fdim); + test_neg_inf_arg(&LIBC_NAMESPACE::fdim); } -TEST_F(LlvmLibcFDimTest, BothZero_fdim) { test_both_zero(&__llvm_libc::fdim); } +TEST_F(LlvmLibcFDimTest, BothZero_fdim) { + test_both_zero(&LIBC_NAMESPACE::fdim); +} TEST_F(LlvmLibcFDimTest, InDoubleRange_fdim) { - test_in_range(&__llvm_libc::fdim); + test_in_range(&LIBC_NAMESPACE::fdim); } diff --git a/libc/test/src/math/fdimf_test.cpp b/libc/test/src/math/fdimf_test.cpp index 531b89b81ffc9edc249dc2d4591e2faf2f1d00f8..27511baf25b6da8aef9cdc3e00a99e43bb2160e0 100644 --- a/libc/test/src/math/fdimf_test.cpp +++ b/libc/test/src/math/fdimf_test.cpp @@ -16,18 +16,20 @@ using LlvmLibcFDimTest = FDimTestTemplate; -TEST_F(LlvmLibcFDimTest, NaNArg_fdimf) { test_na_n_arg(&__llvm_libc::fdimf); } +TEST_F(LlvmLibcFDimTest, NaNArg_fdimf) { + test_na_n_arg(&LIBC_NAMESPACE::fdimf); +} -TEST_F(LlvmLibcFDimTest, InfArg_fdimf) { test_inf_arg(&__llvm_libc::fdimf); } +TEST_F(LlvmLibcFDimTest, InfArg_fdimf) { test_inf_arg(&LIBC_NAMESPACE::fdimf); } TEST_F(LlvmLibcFDimTest, NegInfArg_fdimf) { - test_neg_inf_arg(&__llvm_libc::fdimf); + test_neg_inf_arg(&LIBC_NAMESPACE::fdimf); } TEST_F(LlvmLibcFDimTest, BothZero_fdimf) { - test_both_zero(&__llvm_libc::fdimf); + test_both_zero(&LIBC_NAMESPACE::fdimf); } TEST_F(LlvmLibcFDimTest, InFloatRange_fdimf) { - test_in_range(&__llvm_libc::fdimf); + test_in_range(&LIBC_NAMESPACE::fdimf); } diff --git a/libc/test/src/math/fdiml_test.cpp b/libc/test/src/math/fdiml_test.cpp index bb6c54d567a0b2842c6e87cfa27f1ca04b6b6595..45aedb0a1cdea61c050fe6a52eb47a4c4651c576 100644 --- a/libc/test/src/math/fdiml_test.cpp +++ b/libc/test/src/math/fdiml_test.cpp @@ -16,18 +16,20 @@ using LlvmLibcFDimTest = FDimTestTemplate; -TEST_F(LlvmLibcFDimTest, NaNArg_fdiml) { test_na_n_arg(&__llvm_libc::fdiml); } +TEST_F(LlvmLibcFDimTest, NaNArg_fdiml) { + test_na_n_arg(&LIBC_NAMESPACE::fdiml); +} -TEST_F(LlvmLibcFDimTest, InfArg_fdiml) { test_inf_arg(&__llvm_libc::fdiml); } +TEST_F(LlvmLibcFDimTest, InfArg_fdiml) { test_inf_arg(&LIBC_NAMESPACE::fdiml); } TEST_F(LlvmLibcFDimTest, NegInfArg_fdiml) { - test_neg_inf_arg(&__llvm_libc::fdiml); + test_neg_inf_arg(&LIBC_NAMESPACE::fdiml); } TEST_F(LlvmLibcFDimTest, BothZero_fdiml) { - test_both_zero(&__llvm_libc::fdiml); + test_both_zero(&LIBC_NAMESPACE::fdiml); } TEST_F(LlvmLibcFDimTest, InLongDoubleRange_fdiml) { - test_in_range(&__llvm_libc::fdiml); + test_in_range(&LIBC_NAMESPACE::fdiml); } diff --git a/libc/test/src/math/floor_test.cpp b/libc/test/src/math/floor_test.cpp index e68ed3ecbb603e05b2341776222c0c23d4802e91..9231d07aeb7f8f4a810a3be3b10dad2acada380e 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 f0538f7b97b22f4668c9eb151d7970bc86861d53..cbb11f36f58da3c89aa80e2e781a825050338a5c 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 1b244fd62a117be3a0c17adc593d37039a5aa39f..26f6a7703ed0f6eb52d38b73487e28fac397fb6f 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 be6b138342d5c8cdc0c54459ce6e8d3d31ba7d0c..20224d99894be6ddf7b0db83e70dc39e727fc875 100644 --- a/libc/test/src/math/fma_test.cpp +++ b/libc/test/src/math/fma_test.cpp @@ -270,20 +270,22 @@ struct LlvmLibcFmaTest : public FmaTestTemplate { double c = (signs & 1) ? -INPUTS[i].c : INPUTS[i].c; mpfr::TernaryInput input{a, b, c}; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Fma, input, - __llvm_libc::fma(a, b, c), 0.5); + LIBC_NAMESPACE::fma(a, b, c), 0.5); } } } }; TEST_F(LlvmLibcFmaTest, SpecialNumbers) { - test_special_numbers(&__llvm_libc::fma); + test_special_numbers(&LIBC_NAMESPACE::fma); } TEST_F(LlvmLibcFmaTest, SubnormalRange) { - test_subnormal_range(&__llvm_libc::fma); + test_subnormal_range(&LIBC_NAMESPACE::fma); } -TEST_F(LlvmLibcFmaTest, NormalRange) { test_normal_range(&__llvm_libc::fma); } +TEST_F(LlvmLibcFmaTest, NormalRange) { + test_normal_range(&LIBC_NAMESPACE::fma); +} TEST_F(LlvmLibcFmaTest, ExtraValues) { test_more_values(); } diff --git a/libc/test/src/math/fmaf_test.cpp b/libc/test/src/math/fmaf_test.cpp index 8d1cf254701c906f7888453b27bc9d0bfee0955f..b607d4a66f8eb0aca48648e6dd1f396f7a474eb1 100644 --- a/libc/test/src/math/fmaf_test.cpp +++ b/libc/test/src/math/fmaf_test.cpp @@ -13,11 +13,13 @@ using LlvmLibcFmafTest = FmaTestTemplate; TEST_F(LlvmLibcFmafTest, SpecialNumbers) { - test_special_numbers(&__llvm_libc::fmaf); + test_special_numbers(&LIBC_NAMESPACE::fmaf); } TEST_F(LlvmLibcFmafTest, SubnormalRange) { - test_subnormal_range(&__llvm_libc::fmaf); + test_subnormal_range(&LIBC_NAMESPACE::fmaf); } -TEST_F(LlvmLibcFmafTest, NormalRange) { test_normal_range(&__llvm_libc::fmaf); } +TEST_F(LlvmLibcFmafTest, NormalRange) { + test_normal_range(&LIBC_NAMESPACE::fmaf); +} diff --git a/libc/test/src/math/fmax_test.cpp b/libc/test/src/math/fmax_test.cpp index 9c81c09414f0139626be5a473a19d38e73d90036..6800939625ebc06a6c2d3319aa485ccb78797a0f 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 cf337d4f07e0307cb99abfefa9d6f98cd6f61517..25c6f7339e8c95e69466719df8367373f0ea25e7 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 636bc4208caef65a3c2c4bee6fe7c9feee4fb97f..9ac986c00012a01d40081bcb51194f31c2683744 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 3515f97faca33cdbf7ac954603d9487f24e4ddf4..5d241519021d43617ce3c2a35787ba47a083d409 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 1a762478af613b1a45f7088ba5e377b493b1f870..1af5b79155b1dcd2a054bd98b372c19afa4adfc7 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 ce8b705b0385e2e256c9e3121ae5d263ed9f0781..0791f8c4ad8595c983fa461a1642b5d3c59bd023 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 03790e4941e19182b3bd7bf8fe6e37ee08db09de..ec39e0567a7ca039a8cd0a3a8f8cfa3b4da50411 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 2b13379eba25235af73a15177f0d379559851d89..5c3c6286e88fef0ef4902e2854757719a27fb76a 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 a44aefc7d8b4e334b710366fcb724db6c3f59d90..4d078baffcb39371685a029fd9239a32352f84d9 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 5d78f94ec1e596a84d3b544c57c721c9b2b1bfae..577eb9609cfcc5baf2dde5c3d2553c2353a7a6f5 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 4904ccd14907bb8991595fc2fb1000d547a84f8b..e5184cd225bcfa95481e0be26bb0c2d30a27d470 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 cecfc0ee3de3aee0ba54a8e4790d633e24a1e48a..d0ab31ffd0fe63c99801a008a315e050472a2b88 100644 --- a/libc/test/src/math/generic_sqrt_test.cpp +++ b/libc/test/src/math/generic_sqrt_test.cpp @@ -10,4 +10,4 @@ #include "src/__support/FPUtil/generic/sqrt.h" -LIST_SQRT_TESTS(double, __llvm_libc::fputil::sqrt) +LIST_SQRT_TESTS(double, LIBC_NAMESPACE::fputil::sqrt) diff --git a/libc/test/src/math/generic_sqrtf_test.cpp b/libc/test/src/math/generic_sqrtf_test.cpp index 64bf92133b98f3ec59aede42d8adc9a1623b0233..f22ac8829d5ac89de67341aef967a2d937e085b3 100644 --- a/libc/test/src/math/generic_sqrtf_test.cpp +++ b/libc/test/src/math/generic_sqrtf_test.cpp @@ -10,4 +10,4 @@ #include "src/__support/FPUtil/generic/sqrt.h" -LIST_SQRT_TESTS(float, __llvm_libc::fputil::sqrt) +LIST_SQRT_TESTS(float, LIBC_NAMESPACE::fputil::sqrt) diff --git a/libc/test/src/math/generic_sqrtl_test.cpp b/libc/test/src/math/generic_sqrtl_test.cpp index 6b68aaed97004870ba8c0fddb111007074c147d2..ddc6a23695be4303b2779ccb1a80313dfdb854e4 100644 --- a/libc/test/src/math/generic_sqrtl_test.cpp +++ b/libc/test/src/math/generic_sqrtl_test.cpp @@ -10,4 +10,4 @@ #include "src/__support/FPUtil/generic/sqrt.h" -LIST_SQRT_TESTS(long double, __llvm_libc::fputil::sqrt) +LIST_SQRT_TESTS(long double, LIBC_NAMESPACE::fputil::sqrt) diff --git a/libc/test/src/math/hypot_test.cpp b/libc/test/src/math/hypot_test.cpp index 2d7b640adf10ac3ddd1d966249aab7dbfdaf17cd..8f560f053326b62252ac48d78d839b90213e4b45 100644 --- a/libc/test/src/math/hypot_test.cpp +++ b/libc/test/src/math/hypot_test.cpp @@ -13,13 +13,13 @@ using LlvmLibcHypotTest = HypotTestTemplate; TEST_F(LlvmLibcHypotTest, SpecialNumbers) { - test_special_numbers(&__llvm_libc::hypot); + test_special_numbers(&LIBC_NAMESPACE::hypot); } TEST_F(LlvmLibcHypotTest, SubnormalRange) { - test_subnormal_range(&__llvm_libc::hypot); + test_subnormal_range(&LIBC_NAMESPACE::hypot); } TEST_F(LlvmLibcHypotTest, NormalRange) { - test_normal_range(&__llvm_libc::hypot); + test_normal_range(&LIBC_NAMESPACE::hypot); } diff --git a/libc/test/src/math/hypotf_hard_to_round.h b/libc/test/src/math/hypotf_hard_to_round.h index 1b2abfd2fb909b112cb5ee55e8bd504001ccf646..f85be91ca3ec4a99bae2c2063cbbb4ad1f1997b5 100644 --- a/libc/test/src/math/hypotf_hard_to_round.h +++ b/libc/test/src/math/hypotf_hard_to_round.h @@ -11,7 +11,7 @@ #include "utils/MPFRWrapper/MPFRUtils.h" -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; constexpr int N_HARD_TO_ROUND = 1217; constexpr mpfr::BinaryInput HYPOTF_HARD_TO_ROUND[N_HARD_TO_ROUND] = { diff --git a/libc/test/src/math/hypotf_test.cpp b/libc/test/src/math/hypotf_test.cpp index 437e0fc29b76b319b914b658456e610903221ada..ee16e3dbcd111350b6f524df1f3d914ce7ae7063 100644 --- a/libc/test/src/math/hypotf_test.cpp +++ b/libc/test/src/math/hypotf_test.cpp @@ -14,17 +14,18 @@ using LlvmLibcHypotfTest = HypotTestTemplate; TEST_F(LlvmLibcHypotfTest, SpecialNumbers) { - test_special_numbers(&__llvm_libc::hypotf); + test_special_numbers(&LIBC_NAMESPACE::hypotf); } TEST_F(LlvmLibcHypotfTest, SubnormalRange) { - test_subnormal_range(&__llvm_libc::hypotf); + test_subnormal_range(&LIBC_NAMESPACE::hypotf); } TEST_F(LlvmLibcHypotfTest, NormalRange) { - test_normal_range(&__llvm_libc::hypotf); + test_normal_range(&LIBC_NAMESPACE::hypotf); } TEST_F(LlvmLibcHypotfTest, TrickyInputs) { - test_input_list(&__llvm_libc::hypotf, N_HARD_TO_ROUND, HYPOTF_HARD_TO_ROUND); + test_input_list(&LIBC_NAMESPACE::hypotf, N_HARD_TO_ROUND, + HYPOTF_HARD_TO_ROUND); } diff --git a/libc/test/src/math/ilogb_test.cpp b/libc/test/src/math/ilogb_test.cpp index a77adec4adba44d6912fe8ccaf0cbdc6cc12a03e..7011c43386e66a5ce52a3c03d48159f739ad96b8 100644 --- a/libc/test/src/math/ilogb_test.cpp +++ b/libc/test/src/math/ilogb_test.cpp @@ -16,21 +16,21 @@ #include TEST_F(LlvmLibcILogbTest, SpecialNumbers_ilogb) { - test_special_numbers(&__llvm_libc::ilogb); + test_special_numbers(&LIBC_NAMESPACE::ilogb); } TEST_F(LlvmLibcILogbTest, PowersOfTwo_ilogb) { - test_powers_of_two(&__llvm_libc::ilogb); + test_powers_of_two(&LIBC_NAMESPACE::ilogb); } TEST_F(LlvmLibcILogbTest, SomeIntegers_ilogb) { - test_some_integers(&__llvm_libc::ilogb); + test_some_integers(&LIBC_NAMESPACE::ilogb); } TEST_F(LlvmLibcILogbTest, SubnormalRange_ilogb) { - test_subnormal_range(&__llvm_libc::ilogb); + test_subnormal_range(&LIBC_NAMESPACE::ilogb); } TEST_F(LlvmLibcILogbTest, NormalRange_ilogb) { - test_normal_range(&__llvm_libc::ilogb); + test_normal_range(&LIBC_NAMESPACE::ilogb); } diff --git a/libc/test/src/math/ilogbf_test.cpp b/libc/test/src/math/ilogbf_test.cpp index 20904a13c98a81261fa8527ba06d4f40684ba1e6..dcff8eeb1518059570a7ab4c15fa544286d4b3e1 100644 --- a/libc/test/src/math/ilogbf_test.cpp +++ b/libc/test/src/math/ilogbf_test.cpp @@ -16,21 +16,21 @@ #include TEST_F(LlvmLibcILogbTest, SpecialNumbers_ilogbf) { - test_special_numbers(&__llvm_libc::ilogbf); + test_special_numbers(&LIBC_NAMESPACE::ilogbf); } TEST_F(LlvmLibcILogbTest, PowersOfTwo_ilogbf) { - test_powers_of_two(&__llvm_libc::ilogbf); + test_powers_of_two(&LIBC_NAMESPACE::ilogbf); } TEST_F(LlvmLibcILogbTest, SomeIntegers_ilogbf) { - test_some_integers(&__llvm_libc::ilogbf); + test_some_integers(&LIBC_NAMESPACE::ilogbf); } TEST_F(LlvmLibcILogbTest, SubnormalRange_ilogbf) { - test_subnormal_range(&__llvm_libc::ilogbf); + test_subnormal_range(&LIBC_NAMESPACE::ilogbf); } TEST_F(LlvmLibcILogbTest, NormalRange_ilogbf) { - test_normal_range(&__llvm_libc::ilogbf); + test_normal_range(&LIBC_NAMESPACE::ilogbf); } diff --git a/libc/test/src/math/ilogbl_test.cpp b/libc/test/src/math/ilogbl_test.cpp index 9647f232245dc3e8fb5bc3869643f8c68bea71bc..29a221ad7f08f7af922f607d72460f071108b4d3 100644 --- a/libc/test/src/math/ilogbl_test.cpp +++ b/libc/test/src/math/ilogbl_test.cpp @@ -16,21 +16,21 @@ #include TEST_F(LlvmLibcILogbTest, SpecialNumbers_ilogbl) { - test_special_numbers(&__llvm_libc::ilogbl); + test_special_numbers(&LIBC_NAMESPACE::ilogbl); } TEST_F(LlvmLibcILogbTest, PowersOfTwo_ilogbl) { - test_powers_of_two(&__llvm_libc::ilogbl); + test_powers_of_two(&LIBC_NAMESPACE::ilogbl); } TEST_F(LlvmLibcILogbTest, SomeIntegers_ilogbl) { - test_some_integers(&__llvm_libc::ilogbl); + test_some_integers(&LIBC_NAMESPACE::ilogbl); } TEST_F(LlvmLibcILogbTest, SubnormalRange_ilogbl) { - test_subnormal_range(&__llvm_libc::ilogbl); + test_subnormal_range(&LIBC_NAMESPACE::ilogbl); } TEST_F(LlvmLibcILogbTest, NormalRange_ilogbl) { - test_normal_range(&__llvm_libc::ilogbl); + test_normal_range(&LIBC_NAMESPACE::ilogbl); } diff --git a/libc/test/src/math/inv_trigf_utils_test.cpp b/libc/test/src/math/inv_trigf_utils_test.cpp index ffcca5cce4203908f2e76fee548f954b60841399..4f50027bf82a83a517178e3bbbf631080e993c39 100644 --- a/libc/test/src/math/inv_trigf_utils_test.cpp +++ b/libc/test/src/math/inv_trigf_utils_test.cpp @@ -14,7 +14,7 @@ #include "utils/MPFRWrapper/MPFRUtils.h" #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) @@ -24,11 +24,11 @@ constexpr float def_prec = 0.500001f; auto f_normal = [](float x) -> bool { return !(isnan(x) || isinf(x)); }; TEST(LlvmLibcAtanfPosTest, InFloatRange) { - CHECK_DATA(0.0f, inf, mpfr::Operation::Atan, __llvm_libc::atan_eval, f_normal, - def_count, def_prec); + CHECK_DATA(0.0f, inf, mpfr::Operation::Atan, LIBC_NAMESPACE::atan_eval, + f_normal, def_count, def_prec); } TEST(LlvmLibcAtanfNegTest, InFloatRange) { - CHECK_DATA(-0.0f, neg_inf, mpfr::Operation::Atan, __llvm_libc::atan_eval, + CHECK_DATA(-0.0f, neg_inf, mpfr::Operation::Atan, LIBC_NAMESPACE::atan_eval, f_normal, def_count, def_prec); } diff --git a/libc/test/src/math/ldexp_test.cpp b/libc/test/src/math/ldexp_test.cpp index c078aa4b7ef84c714dd8d5e6dced446c105f9b60..aad580f95fb99d49932e9b1e703a000c764eef90 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 4fe80fc79151cd6bf43876579c65429be46f469f..f4cce37b9277dc58f0386eef73cd6e041bec5984 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 5e6e6e75ae0855b3f48bbb27f87c68aa06af398f..405e53390e8c34dafb3bbed89ae5b550d7894cb2 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 8027004bd50a5ddf0f977f108382f19da025d5dd..8cf7d92095891bf62298bdf7f52ea0124969029b 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 9ad710e4698350c58157a5a6ded1f9ee97e6ff9f..0d9d3c4111bb245091e10a6b5ea690a24148a4c7 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 948e961e57bd4d0500fbc9721ef7d6835ff2ad52..1ceb9fecc40391f7e0790f98fb0d9dd5e75c0055 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 c86095dc9aae03b5644b83c4decb46c639125850..bda2fca6e8659f303e08158b983af2de888b128a 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 5e36258c246ae13c2283d2d8dccf43da26d46626..a35b5fabbac34c3528e9df96119a67c2972b8dac 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 8fbc840c4f2acc7d885379b00766d0bc5577d6e5..e43d49f4cbe1bf3e5714c55002c0d552e05c96da 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 f841fbed8a9f8b7f404365400ae6b0ba8130ec41..46458c324673b028ff81e00088daa1fd5ffcd745 100644 --- a/libc/test/src/math/log10_test.cpp +++ b/libc/test/src/math/log10_test.cpp @@ -17,19 +17,21 @@ #include #include -namespace mpfr = __llvm_libc::testing::mpfr; -using __llvm_libc::testing::tlog; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(double) TEST(LlvmLibcLog10Test, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::log10(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::log10(inf)); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log10(neg_inf), FE_INVALID); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log10(0.0), FE_DIVBYZERO); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log10(-0.0), FE_DIVBYZERO); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log10(-1.0), FE_INVALID); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log10(1.0)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log10(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log10(inf)); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log10(neg_inf), FE_INVALID); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log10(0.0), + FE_DIVBYZERO); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log10(-0.0), + FE_DIVBYZERO); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log10(-1.0), FE_INVALID); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log10(1.0)); } TEST(LlvmLibcLog10Test, TrickyInputs) { @@ -66,7 +68,7 @@ TEST(LlvmLibcLog10Test, TrickyInputs) { for (int i = 0; i < N; ++i) { double x = double(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log10, x, - __llvm_libc::log10(x), 0.5); + LIBC_NAMESPACE::log10(x), 0.5); } } @@ -74,7 +76,7 @@ TEST(LlvmLibcLog10Test, AllExponents) { double x = 0x1.0p-1074; for (int i = -1074; i < 1024; ++i, x *= 2.0) { ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log10, x, - __llvm_libc::log10(x), 0.5); + LIBC_NAMESPACE::log10(x), 0.5); } } @@ -101,7 +103,7 @@ TEST(LlvmLibcLog10Test, InDoubleRange) { if (isnan(x) || isinf(x) || x < 0.0) continue; libc_errno = 0; - double result = __llvm_libc::log10(x); + double result = LIBC_NAMESPACE::log10(x); ++cc; if (isnan(result) || isinf(result)) continue; diff --git a/libc/test/src/math/log10f_test.cpp b/libc/test/src/math/log10f_test.cpp index 444a742003235fdec2e771e2e533aec598055728..05c42b9265ad9276bca4d93e63bb7f0553898727 100644 --- a/libc/test/src/math/log10f_test.cpp +++ b/libc/test/src/math/log10f_test.cpp @@ -16,19 +16,20 @@ #include #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcLog10fTest, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::log10f(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::log10f(inf)); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log10f(neg_inf), FE_INVALID); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log10f(0.0f), FE_DIVBYZERO); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log10f(-0.0f), + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log10f(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log10f(inf)); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log10f(neg_inf), FE_INVALID); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log10f(0.0f), FE_DIVBYZERO); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log10f(-1.0f), FE_INVALID); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log10f(1.0f)); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log10f(-0.0f), + FE_DIVBYZERO); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log10f(-1.0f), FE_INVALID); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log10f(1.0f)); } TEST(LlvmLibcLog10fTest, TrickyInputs) { @@ -60,7 +61,7 @@ TEST(LlvmLibcLog10fTest, TrickyInputs) { for (int i = 0; i < N; ++i) { float x = float(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log10, x, - __llvm_libc::log10f(x), 0.5); + LIBC_NAMESPACE::log10f(x), 0.5); } } @@ -70,6 +71,6 @@ TEST(LlvmLibcLog10fTest, InFloatRange) { for (uint32_t i = 0, v = 0; i <= COUNT; ++i, v += STEP) { float x = float(FPBits(v)); ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log10, x, - __llvm_libc::log10f(x), 0.5); + LIBC_NAMESPACE::log10f(x), 0.5); } } diff --git a/libc/test/src/math/log1p_test.cpp b/libc/test/src/math/log1p_test.cpp index c128c5e6c918f40d125fdc38782ed8f60c5256bd..b677e7b416e1a6cade12524fa861500ed4df8df9 100644 --- a/libc/test/src/math/log1p_test.cpp +++ b/libc/test/src/math/log1p_test.cpp @@ -17,19 +17,20 @@ #include #include -namespace mpfr = __llvm_libc::testing::mpfr; -using __llvm_libc::testing::tlog; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(double) TEST(LlvmLibcLog1pTest, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::log1p(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::log1p(inf)); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log1p(neg_inf), FE_INVALID); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log1p(-2.0), FE_INVALID); - EXPECT_FP_EQ(zero, __llvm_libc::log1p(0.0)); - EXPECT_FP_EQ(neg_zero, __llvm_libc::log1p(-0.0)); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log1p(-1.0), FE_DIVBYZERO); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log1p(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log1p(inf)); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log1p(neg_inf), FE_INVALID); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log1p(-2.0), FE_INVALID); + EXPECT_FP_EQ(zero, LIBC_NAMESPACE::log1p(0.0)); + EXPECT_FP_EQ(neg_zero, LIBC_NAMESPACE::log1p(-0.0)); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log1p(-1.0), + FE_DIVBYZERO); } TEST(LlvmLibcLog1pTest, TrickyInputs) { @@ -68,7 +69,7 @@ TEST(LlvmLibcLog1pTest, TrickyInputs) { for (int i = 0; i < N; ++i) { double x = double(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log1p, x, - __llvm_libc::log1p(x), 0.5); + LIBC_NAMESPACE::log1p(x), 0.5); } } @@ -76,7 +77,7 @@ TEST(LlvmLibcLog1pTest, AllExponents) { double x = 0x1.0p-1074; for (int i = -1074; i < 1024; ++i, x *= 2.0) { ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log1p, x, - __llvm_libc::log1p(x), 0.5); + LIBC_NAMESPACE::log1p(x), 0.5); } } @@ -102,7 +103,7 @@ TEST(LlvmLibcLog1pTest, InDoubleRange) { if (isnan(x) || isinf(x) || x < 0.0) continue; libc_errno = 0; - double result = __llvm_libc::log1p(x); + double result = LIBC_NAMESPACE::log1p(x); ++cc; if (isnan(result) || isinf(result)) continue; diff --git a/libc/test/src/math/log1pf_test.cpp b/libc/test/src/math/log1pf_test.cpp index 264687d5fc2b0e0c4a9238fb21d65390848a0f2f..d8132e479e83dba84adf0d0f4267ea9ed01638d1 100644 --- a/libc/test/src/math/log1pf_test.cpp +++ b/libc/test/src/math/log1pf_test.cpp @@ -17,17 +17,17 @@ #include #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibclog1pfTest, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::log1pf(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::log1pf(inf)); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log1pf(neg_inf), FE_INVALID); - EXPECT_FP_EQ(zero, __llvm_libc::log1pf(0.0f)); - EXPECT_FP_EQ(neg_zero, __llvm_libc::log1pf(-0.0f)); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log1pf(-1.0f), + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log1pf(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log1pf(inf)); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log1pf(neg_inf), FE_INVALID); + EXPECT_FP_EQ(zero, LIBC_NAMESPACE::log1pf(0.0f)); + EXPECT_FP_EQ(neg_zero, LIBC_NAMESPACE::log1pf(-0.0f)); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log1pf(-1.0f), FE_DIVBYZERO); } @@ -65,7 +65,7 @@ TEST(LlvmLibclog1pfTest, TrickyInputs) { for (int i = 0; i < N; ++i) { float x = float(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log1p, x, - __llvm_libc::log1pf(x), 0.5); + LIBC_NAMESPACE::log1pf(x), 0.5); } } @@ -78,6 +78,6 @@ TEST(LlvmLibclog1pfTest, InFloatRange) { continue; libc_errno = 0; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log1p, x, - __llvm_libc::log1pf(x), 0.5); + LIBC_NAMESPACE::log1pf(x), 0.5); } } diff --git a/libc/test/src/math/log2_test.cpp b/libc/test/src/math/log2_test.cpp index c4756875d6a54b318b049d627f1da5db842e4086..42643fa7083fc1344a056cbf6f4ee9c93c61e2ba 100644 --- a/libc/test/src/math/log2_test.cpp +++ b/libc/test/src/math/log2_test.cpp @@ -17,19 +17,20 @@ #include #include -namespace mpfr = __llvm_libc::testing::mpfr; -using __llvm_libc::testing::tlog; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(double) TEST(LlvmLibcLog2Test, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::log2(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::log2(inf)); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log2(neg_inf), FE_INVALID); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log2(0.0), FE_DIVBYZERO); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log2(-0.0), FE_DIVBYZERO); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log2(-1.0), FE_INVALID); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log2(1.0)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log2(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log2(inf)); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log2(neg_inf), FE_INVALID); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log2(0.0), FE_DIVBYZERO); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log2(-0.0), + FE_DIVBYZERO); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log2(-1.0), FE_INVALID); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log2(1.0)); } TEST(LlvmLibcLog2Test, TrickyInputs) { @@ -65,7 +66,7 @@ TEST(LlvmLibcLog2Test, TrickyInputs) { for (int i = 0; i < N; ++i) { double x = double(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log2, x, - __llvm_libc::log2(x), 0.5); + LIBC_NAMESPACE::log2(x), 0.5); } } @@ -73,7 +74,7 @@ TEST(LlvmLibcLog2Test, AllExponents) { double x = 0x1.0p-1074; for (int i = -1074; i < 1024; ++i, x *= 2.0) { ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log2, x, - __llvm_libc::log2(x), 0.5); + LIBC_NAMESPACE::log2(x), 0.5); } } @@ -101,7 +102,7 @@ TEST(LlvmLibcLog2Test, InDoubleRange) { if (isnan(x) || isinf(x) || x < 0.0) continue; libc_errno = 0; - double result = __llvm_libc::log2(x); + double result = LIBC_NAMESPACE::log2(x); ++cc; if (isnan(result) || isinf(result)) continue; diff --git a/libc/test/src/math/log2f_test.cpp b/libc/test/src/math/log2f_test.cpp index afc7a748c63d5f49eb3dab8e600da3a28e1589dc..d4f4b937c955437b45026a9cc6dff09501cc2f93 100644 --- a/libc/test/src/math/log2f_test.cpp +++ b/libc/test/src/math/log2f_test.cpp @@ -16,18 +16,20 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcLog2fTest, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::log2f(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::log2f(inf)); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log2f(neg_inf), FE_INVALID); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log2f(0.0f), FE_DIVBYZERO); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log2f(-0.0f), FE_DIVBYZERO); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log2f(-1.0f), FE_INVALID); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log2f(1.0f)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log2f(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log2f(inf)); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log2f(neg_inf), FE_INVALID); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log2f(0.0f), + FE_DIVBYZERO); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log2f(-0.0f), + FE_DIVBYZERO); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log2f(-1.0f), FE_INVALID); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log2f(1.0f)); } TEST(LlvmLibcLog2fTest, TrickyInputs) { @@ -39,7 +41,7 @@ TEST(LlvmLibcLog2fTest, TrickyInputs) { for (int i = 0; i < N; ++i) { float x = float(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log2, x, - __llvm_libc::log2f(x), 0.5); + LIBC_NAMESPACE::log2f(x), 0.5); } } @@ -51,7 +53,7 @@ TEST(LlvmLibcLog2fTest, InFloatRange) { if (isnan(x) || isinf(x)) continue; libc_errno = 0; - float result = __llvm_libc::log2f(x); + float result = LIBC_NAMESPACE::log2f(x); // If the computation resulted in an error or did not produce valid result // in the single-precision floating point range, then ignore comparing with // MPFR result as MPFR can still produce valid results because of its @@ -59,6 +61,6 @@ TEST(LlvmLibcLog2fTest, InFloatRange) { if (isnan(result) || isinf(result) || libc_errno != 0) continue; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log2, x, - __llvm_libc::log2f(x), 0.5); + LIBC_NAMESPACE::log2f(x), 0.5); } } diff --git a/libc/test/src/math/log_test.cpp b/libc/test/src/math/log_test.cpp index 5b662534bbf580e1b2f1188f700f03ce212cc9a7..caa274828fd66ac496cc8f3e72290f9c06ad86f1 100644 --- a/libc/test/src/math/log_test.cpp +++ b/libc/test/src/math/log_test.cpp @@ -17,19 +17,19 @@ #include #include -namespace mpfr = __llvm_libc::testing::mpfr; -using __llvm_libc::testing::tlog; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(double) TEST(LlvmLibcLogTest, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::log(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::log(inf)); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log(neg_inf), FE_INVALID); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log(0.0), FE_DIVBYZERO); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log(-0.0), FE_DIVBYZERO); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log(-1.0), FE_INVALID); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log(1.0)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log(inf)); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log(neg_inf), FE_INVALID); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log(0.0), FE_DIVBYZERO); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log(-0.0), FE_DIVBYZERO); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log(-1.0), FE_INVALID); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log(1.0)); } TEST(LlvmLibcLogTest, TrickyInputs) { @@ -64,16 +64,16 @@ TEST(LlvmLibcLogTest, TrickyInputs) { }; for (int i = 0; i < N; ++i) { double x = double(FPBits(INPUTS[i])); - EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log, x, __llvm_libc::log(x), - 0.5); + EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log, x, + LIBC_NAMESPACE::log(x), 0.5); } } TEST(LlvmLibcLogTest, AllExponents) { double x = 0x1.0p-1074; for (int i = -1074; i < 1024; ++i, x *= 2.0) { - ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log, x, __llvm_libc::log(x), - 0.5); + ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log, x, + LIBC_NAMESPACE::log(x), 0.5); } } @@ -101,7 +101,7 @@ TEST(LlvmLibcLogTest, InDoubleRange) { if (isnan(x) || isinf(x) || x < 0.0) continue; libc_errno = 0; - double result = __llvm_libc::log(x); + double result = LIBC_NAMESPACE::log(x); ++cc; if (isnan(result) || isinf(result)) continue; diff --git a/libc/test/src/math/logb_test.cpp b/libc/test/src/math/logb_test.cpp index b90348522aa3aa6785760edc3713fc15ad8e0183..2dc56c2e613ccb2ea3e0f1e07c0b35b2b06bf880 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 727eefffbb1740c9d8e20f1e38040fe512891fcb..c25485ca78b065b3bcf4a665f0a5a942ba52a3ea 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 1c7b0d4e66e84ec6cc3eea3eb5cc24b3b164cd4c..b26cee65783c42037c2d8d002685945927c589b5 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 6f8983c4645dff60e21d82c169d754ac43edd004..832bdd21edd417a3eb02cd1c02df1199071a3d29 100644 --- a/libc/test/src/math/logf_test.cpp +++ b/libc/test/src/math/logf_test.cpp @@ -15,18 +15,20 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcLogfTest, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::logf(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::logf(inf)); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::logf(neg_inf), FE_INVALID); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::logf(0.0f), FE_DIVBYZERO); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::logf(-0.0f), FE_DIVBYZERO); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::logf(-1.0f), FE_INVALID); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::logf(1.0f)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::logf(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::logf(inf)); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::logf(neg_inf), FE_INVALID); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::logf(0.0f), + FE_DIVBYZERO); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::logf(-0.0f), + FE_DIVBYZERO); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::logf(-1.0f), FE_INVALID); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::logf(1.0f)); } TEST(LlvmLibcLogfTest, TrickyInputs) { @@ -71,7 +73,7 @@ TEST(LlvmLibcLogfTest, TrickyInputs) { for (int i = 0; i < N; ++i) { float x = float(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log, x, - __llvm_libc::logf(x), 0.5); + LIBC_NAMESPACE::logf(x), 0.5); } } @@ -83,6 +85,6 @@ TEST(LlvmLibcLogfTest, InFloatRange) { if (isnan(x) || isinf(x)) continue; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Log, x, - __llvm_libc::logf(x), 0.5); + LIBC_NAMESPACE::logf(x), 0.5); } } diff --git a/libc/test/src/math/lrint_test.cpp b/libc/test/src/math/lrint_test.cpp index 0dbfa3dd466d99fc1fe5618f703cc98950b1fc97..9cff2661225361a28f0a086bbac867091e5e8c52 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 407813aa83c0feb0a5e5c1cdf4221c4736fb16ed..9c696a39e6928cb8122555491037cf3b8d5d31b7 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 a4551c38de10663c60b549d148615db8f3ee0f2a..e44dd30d2c6cccca3f00685c63acfca625ed6a0a 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 0ee580f316b44ac4a0e768535514b95dfc6c2fb0..1fb2fc71e20ccbb311136b0fc1f4025b118fb6e6 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 7a2aad20e4f664bd6e9f71e94b814cae0198b3c8..38fe5c7d1a52dc574bba119cae188db768da54e1 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 c0ea339782052360f2602d7940611d938e3ea07b..8a29ba95a61732dc541552dec8876b6c8b2250c9 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 ff89517506b4f274e93894f3a821414abd508ce8..b4b03bad848de57ae945402d586be3b7e9d5b816 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 440304ab95ac78f1e285883b20f336f26e12dad4..068dbc3f5313590cd3809e59795d8402efa4fb58 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 c98678b3e9243e3921dbc94d32d2570edb2bd8fc..ae8a72642c5871e734b31d08d637ee0d454c0f70 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 2dde48ceb053c6c8a1d708f2ad4ba1cf0b0a7375..998b19fb1dccd375a294f16071340478d7879a54 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 14234c717797eb50829da0cd9640cc230d13a3df..31770bc591ec1fab0a7d7fa1fb0a42a2946680d4 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 db85d83edc690ef61602505cfdbf7bf121b7d14b..4c8577f2690a1fdb000deb6b23bb1f180ebb1c76 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 8efec397f39d33b6285df6a6dfe439c77c42ed69..4358331a8f76e2b87e5c1cf7e7833741c5c6bbcd 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 1af4ba4e0153b559957399fbd2ee219d5a045261..590b4ffb4595fdf0432126383156c35d6adcc948 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 e4438e83fe18ce1f5291a0dde07843c667b8de8c..ae2db449304105496a29314d3136dadd85d927ec 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 eafa1a7fe6119fe52644274cd8d0d7b5d601505a..9c89b7acec56d5e5127fa288708311394be92292 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 c15a697fac9208c863cedd502e05ad582d46d2cf..f875bab2556cadd11007f6d2168626ee5fd00804 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 6c50873a272d046a791620de4b4a5689fe23c022..458ca05a985af5772ee2db44a5a81e8f76504de9 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 87ce079e89afc29560198b88e4e5c1d7e2a308c2..dbcb56717e208339bddb78b93b1cb56d606cc1ea 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 0a182dd02deee6fea6e7b34ac564b9e5e71004e4..053596a16e22f6c595f440f4094c4ae766456565 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 32cf724fb7c4f3baf8919779d2527058fb5e250d..2a2a213a8181cdaead38056692c487dca5836ac5 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 d4d60bf8afca180c0fc982592f1830d6e5042c4b..413a2395ca3c57d3a997ce641a029c8646080a01 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 cbf2e7e1361e10cccef05bb134920ac64a36ea76..e97781c2b2354643215fa27261dcbe9f0d65dcea 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 197887b2448c057f625ec95fe57d6164a47addca..b0e0053790902491845f33311d2d83a7e4277511 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 284578b8f78568e3c6015c87ea5eb4a6d9945ce8..4a77b2a4cd078ad37db082e0e6a17eb282905f04 100644 --- a/libc/test/src/math/sdcomp26094.h +++ b/libc/test/src/math/sdcomp26094.h @@ -13,15 +13,15 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { -static constexpr __llvm_libc::cpp::array SDCOMP26094_VALUES{ +static constexpr LIBC_NAMESPACE::cpp::array SDCOMP26094_VALUES{ 0x46427f1b, 0x4647e568, 0x46428bac, 0x4647f1f9, 0x4647fe8a, 0x45d8d7f1, 0x45d371a4, 0x45ce0b57, 0x45d35882, 0x45cdf235, }; } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LLVM_LIBC_TEST_SRC_MATH_SDCOMP26094_H diff --git a/libc/test/src/math/sin_test.cpp b/libc/test/src/math/sin_test.cpp index d92bd8553a2ef0156fb9fd5cc62f94d888a89c25..ee8451f5008106ab1086684c129a6f9b9ea4c060 100644 --- a/libc/test/src/math/sin_test.cpp +++ b/libc/test/src/math/sin_test.cpp @@ -14,7 +14,7 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(double) @@ -28,6 +28,6 @@ TEST(LlvmLibcSinTest, Range) { if (isnan(x) || isinf(x) || x > _2pi || x < -_2pi) continue; - ASSERT_MPFR_MATCH(mpfr::Operation::Sin, x, __llvm_libc::sin(x), 1.0); + ASSERT_MPFR_MATCH(mpfr::Operation::Sin, x, LIBC_NAMESPACE::sin(x), 1.0); } } diff --git a/libc/test/src/math/sincosf_test.cpp b/libc/test/src/math/sincosf_test.cpp index 3a5bdd12fbc38a7778598293cd3c079005d4e1b1..f67fba1d31dfcdbc849abcbd2c32db5c1539d2d3 100644 --- a/libc/test/src/math/sincosf_test.cpp +++ b/libc/test/src/math/sincosf_test.cpp @@ -18,10 +18,10 @@ #include #include -using __llvm_libc::testing::SDCOMP26094_VALUES; -using FPBits = __llvm_libc::fputil::FPBits; +using LIBC_NAMESPACE::testing::SDCOMP26094_VALUES; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) @@ -29,27 +29,27 @@ TEST(LlvmLibcSinCosfTest, SpecialNumbers) { libc_errno = 0; float sin, cos; - __llvm_libc::sincosf(aNaN, &sin, &cos); + LIBC_NAMESPACE::sincosf(aNaN, &sin, &cos); EXPECT_FP_EQ(aNaN, cos); EXPECT_FP_EQ(aNaN, sin); EXPECT_MATH_ERRNO(0); - __llvm_libc::sincosf(0.0f, &sin, &cos); + LIBC_NAMESPACE::sincosf(0.0f, &sin, &cos); EXPECT_FP_EQ(1.0f, cos); EXPECT_FP_EQ(0.0f, sin); EXPECT_MATH_ERRNO(0); - __llvm_libc::sincosf(-0.0f, &sin, &cos); + LIBC_NAMESPACE::sincosf(-0.0f, &sin, &cos); EXPECT_FP_EQ(1.0f, cos); EXPECT_FP_EQ(-0.0f, sin); EXPECT_MATH_ERRNO(0); - __llvm_libc::sincosf(inf, &sin, &cos); + LIBC_NAMESPACE::sincosf(inf, &sin, &cos); EXPECT_FP_EQ(aNaN, cos); EXPECT_FP_EQ(aNaN, sin); EXPECT_MATH_ERRNO(EDOM); - __llvm_libc::sincosf(neg_inf, &sin, &cos); + LIBC_NAMESPACE::sincosf(neg_inf, &sin, &cos); EXPECT_FP_EQ(aNaN, cos); EXPECT_FP_EQ(aNaN, sin); EXPECT_MATH_ERRNO(EDOM); @@ -58,11 +58,11 @@ TEST(LlvmLibcSinCosfTest, SpecialNumbers) { #define EXPECT_SINCOS_MATCH_ALL_ROUNDING(input) \ { \ float sin, cos; \ - namespace mpfr = __llvm_libc::testing::mpfr; \ + namespace mpfr = LIBC_NAMESPACE::testing::mpfr; \ \ mpfr::ForceRoundingMode __r1(mpfr::RoundingMode::Nearest); \ if (__r1.success) { \ - __llvm_libc::sincosf(input, &sin, &cos); \ + LIBC_NAMESPACE::sincosf(input, &sin, &cos); \ EXPECT_MPFR_MATCH(mpfr::Operation::Sin, input, sin, 0.5, \ mpfr::RoundingMode::Nearest); \ EXPECT_MPFR_MATCH(mpfr::Operation::Cos, input, cos, 0.5, \ @@ -71,7 +71,7 @@ TEST(LlvmLibcSinCosfTest, SpecialNumbers) { \ mpfr::ForceRoundingMode __r2(mpfr::RoundingMode::Upward); \ if (__r2.success) { \ - __llvm_libc::sincosf(input, &sin, &cos); \ + LIBC_NAMESPACE::sincosf(input, &sin, &cos); \ EXPECT_MPFR_MATCH(mpfr::Operation::Sin, input, sin, 0.5, \ mpfr::RoundingMode::Upward); \ EXPECT_MPFR_MATCH(mpfr::Operation::Cos, input, cos, 0.5, \ @@ -80,7 +80,7 @@ TEST(LlvmLibcSinCosfTest, SpecialNumbers) { \ mpfr::ForceRoundingMode __r3(mpfr::RoundingMode::Downward); \ if (__r3.success) { \ - __llvm_libc::sincosf(input, &sin, &cos); \ + LIBC_NAMESPACE::sincosf(input, &sin, &cos); \ EXPECT_MPFR_MATCH(mpfr::Operation::Sin, input, sin, 0.5, \ mpfr::RoundingMode::Downward); \ EXPECT_MPFR_MATCH(mpfr::Operation::Cos, input, cos, 0.5, \ @@ -89,7 +89,7 @@ TEST(LlvmLibcSinCosfTest, SpecialNumbers) { \ mpfr::ForceRoundingMode __r4(mpfr::RoundingMode::TowardZero); \ if (__r4.success) { \ - __llvm_libc::sincosf(input, &sin, &cos); \ + LIBC_NAMESPACE::sincosf(input, &sin, &cos); \ EXPECT_MPFR_MATCH(mpfr::Operation::Sin, input, sin, 0.5, \ mpfr::RoundingMode::TowardZero); \ EXPECT_MPFR_MATCH(mpfr::Operation::Cos, input, cos, 0.5, \ diff --git a/libc/test/src/math/sinf_test.cpp b/libc/test/src/math/sinf_test.cpp index 3c94ae86a21c4e17b1a36e2e5d265af643adbeca..24251104421269c2331ac285f8004147a40f8e24 100644 --- a/libc/test/src/math/sinf_test.cpp +++ b/libc/test/src/math/sinf_test.cpp @@ -18,29 +18,29 @@ #include #include -using __llvm_libc::testing::SDCOMP26094_VALUES; -using FPBits = __llvm_libc::fputil::FPBits; +using LIBC_NAMESPACE::testing::SDCOMP26094_VALUES; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcSinfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ(aNaN, __llvm_libc::sinf(aNaN)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(0.0f, __llvm_libc::sinf(0.0f)); + EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::sinf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(-0.0f, __llvm_libc::sinf(-0.0f)); + EXPECT_FP_EQ(-0.0f, LIBC_NAMESPACE::sinf(-0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(aNaN, __llvm_libc::sinf(inf)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinf(inf)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ(aNaN, __llvm_libc::sinf(neg_inf)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinf(neg_inf)); EXPECT_MATH_ERRNO(EDOM); } @@ -52,7 +52,7 @@ TEST(LlvmLibcSinfTest, InFloatRange) { if (isnan(x) || isinf(x)) continue; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sin, x, - __llvm_libc::sinf(x), 0.5); + LIBC_NAMESPACE::sinf(x), 0.5); } } @@ -100,21 +100,21 @@ TEST(LlvmLibcSinfTest, SpecificBitPatterns) { for (int i = 0; i < N; ++i) { float x = float(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sin, x, - __llvm_libc::sinf(x), 0.5); + LIBC_NAMESPACE::sinf(x), 0.5); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sin, -x, - __llvm_libc::sinf(-x), 0.5); + LIBC_NAMESPACE::sinf(-x), 0.5); } } // For small values, sin(x) is x. TEST(LlvmLibcSinfTest, SmallValues) { float x = float(FPBits(0x1780'0000U)); - EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sin, x, __llvm_libc::sinf(x), - 0.5); + EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sin, x, + LIBC_NAMESPACE::sinf(x), 0.5); x = float(FPBits(0x0040'0000U)); - EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sin, x, __llvm_libc::sinf(x), - 0.5); + EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sin, x, + LIBC_NAMESPACE::sinf(x), 0.5); } // SDCOMP-26094: check sinf in the cases for which the range reducer @@ -123,6 +123,6 @@ TEST(LlvmLibcSinfTest, SDCOMP_26094) { for (uint32_t v : SDCOMP26094_VALUES) { float x = float(FPBits((v))); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sin, x, - __llvm_libc::sinf(x), 0.5); + LIBC_NAMESPACE::sinf(x), 0.5); } } diff --git a/libc/test/src/math/sinhf_test.cpp b/libc/test/src/math/sinhf_test.cpp index f42b8318af8241cb5526fb8d6ebe8f5b7665484a..92284ca7d0988df4e31917b38642df5de290947e 100644 --- a/libc/test/src/math/sinhf_test.cpp +++ b/libc/test/src/math/sinhf_test.cpp @@ -18,28 +18,28 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcSinhfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ(aNaN, __llvm_libc::sinhf(aNaN)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinhf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(0.0f, __llvm_libc::sinhf(0.0f)); + EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::sinhf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(-0.0f, __llvm_libc::sinhf(-0.0f)); + EXPECT_FP_EQ(-0.0f, LIBC_NAMESPACE::sinhf(-0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(inf, __llvm_libc::sinhf(inf)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::sinhf(inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(neg_inf, __llvm_libc::sinhf(neg_inf)); + EXPECT_FP_EQ(neg_inf, LIBC_NAMESPACE::sinhf(neg_inf)); EXPECT_MATH_ERRNO(0); } @@ -50,19 +50,19 @@ TEST(LlvmLibcSinhfTest, InFloatRange) { float x = float(FPBits(v)); if (isnan(x) || isinf(x)) continue; - ASSERT_MPFR_MATCH(mpfr::Operation::Sinh, x, __llvm_libc::sinhf(x), 0.5); + ASSERT_MPFR_MATCH(mpfr::Operation::Sinh, x, LIBC_NAMESPACE::sinhf(x), 0.5); } } // For small values, sinh(x) is x. TEST(LlvmLibcSinhfTest, SmallValues) { float x = float(FPBits(uint32_t(0x17800000))); - float result = __llvm_libc::sinhf(x); + float result = LIBC_NAMESPACE::sinhf(x); EXPECT_MPFR_MATCH(mpfr::Operation::Sinh, x, result, 0.5); EXPECT_FP_EQ(x, result); x = float(FPBits(uint32_t(0x00400000))); - result = __llvm_libc::sinhf(x); + result = LIBC_NAMESPACE::sinhf(x); EXPECT_MPFR_MATCH(mpfr::Operation::Sinh, x, result, 0.5); EXPECT_FP_EQ(x, result); } @@ -70,24 +70,24 @@ TEST(LlvmLibcSinhfTest, SmallValues) { TEST(LlvmLibcSinhfTest, Overflow) { libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::sinhf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::sinhf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::sinhf(float(FPBits(0x42cffff8U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::sinhf(float(FPBits(0x42cffff8U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::sinhf(float(FPBits(0x42d00008U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::sinhf(float(FPBits(0x42d00008U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); } TEST(LlvmLibcSinhfTest, ExceptionalValues) { float x = float(FPBits(uint32_t(0x3a12'85ffU))); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sinh, x, - __llvm_libc::sinhf(x), 0.5); + LIBC_NAMESPACE::sinhf(x), 0.5); x = -float(FPBits(uint32_t(0x3a12'85ffU))); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sinh, x, - __llvm_libc::sinhf(x), 0.5); + LIBC_NAMESPACE::sinhf(x), 0.5); } diff --git a/libc/test/src/math/smoke/CeilTest.h b/libc/test/src/math/smoke/CeilTest.h index 053218386cbcf31c6d09d153f0a1ffe971ef5eb5..c10fd281601435879c82f3d40ce84cd614a44d02 100644 --- a/libc/test/src/math/smoke/CeilTest.h +++ b/libc/test/src/math/smoke/CeilTest.h @@ -11,7 +11,7 @@ #include -template class CeilTest : public __llvm_libc::testing::Test { +template class CeilTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/smoke/CopySignTest.h b/libc/test/src/math/smoke/CopySignTest.h index 2d50dd4877b10a76bdde645e80ce401b331df030..c33f78038a3cff9dbe398517a83a5f0981845438 100644 --- a/libc/test/src/math/smoke/CopySignTest.h +++ b/libc/test/src/math/smoke/CopySignTest.h @@ -11,7 +11,8 @@ #include -template class CopySignTest : public __llvm_libc::testing::Test { +template +class CopySignTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/smoke/FAbsTest.h b/libc/test/src/math/smoke/FAbsTest.h index df79703d42b1eb855bef2df93fc6f468ee8d55e0..7d905baefe851457d2eed80e3e5b282e9079462c 100644 --- a/libc/test/src/math/smoke/FAbsTest.h +++ b/libc/test/src/math/smoke/FAbsTest.h @@ -11,7 +11,7 @@ #include -template class FAbsTest : public __llvm_libc::testing::Test { +template class FAbsTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/smoke/FDimTest.h b/libc/test/src/math/smoke/FDimTest.h index c0dbda10b318b9744147de1c5bff137526979827..3118c3661013e7cf97101e8cdb28adba09145972 100644 --- a/libc/test/src/math/smoke/FDimTest.h +++ b/libc/test/src/math/smoke/FDimTest.h @@ -13,10 +13,10 @@ #include template -class FDimTestTemplate : public __llvm_libc::testing::Test { +class FDimTestTemplate : public LIBC_NAMESPACE::testing::Test { public: using FuncPtr = T (*)(T, T); - using FPBits = __llvm_libc::fputil::FPBits; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; using UIntType = typename FPBits::UIntType; void test_na_n_arg(FuncPtr func) { @@ -74,9 +74,9 @@ 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::build_quiet_nan(1)); - const T inf = T(__llvm_libc::fputil::FPBits::inf()); - const T neg_inf = T(__llvm_libc::fputil::FPBits::neg_inf()); - const T zero = T(__llvm_libc::fputil::FPBits::zero()); - const T neg_zero = T(__llvm_libc::fputil::FPBits::neg_zero()); + const T nan = T(LIBC_NAMESPACE::fputil::FPBits::build_quiet_nan(1)); + const T inf = T(LIBC_NAMESPACE::fputil::FPBits::inf()); + const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits::neg_inf()); + const T zero = T(LIBC_NAMESPACE::fputil::FPBits::zero()); + const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits::neg_zero()); }; diff --git a/libc/test/src/math/smoke/FMaxTest.h b/libc/test/src/math/smoke/FMaxTest.h index 5c353a6b7e0efc29ff8b442e768cd015d9a44f62..e1192a4e0a7d1aef69c685a90b12f0a18f8d7119 100644 --- a/libc/test/src/math/smoke/FMaxTest.h +++ b/libc/test/src/math/smoke/FMaxTest.h @@ -11,7 +11,7 @@ #include -template class FMaxTest : public __llvm_libc::testing::Test { +template class FMaxTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/smoke/FMinTest.h b/libc/test/src/math/smoke/FMinTest.h index 071ab75928c4bcb79a0690d04394d345e004ccea..f0764ec3855b23c4eaac0d3a2e8d8091639d8c70 100644 --- a/libc/test/src/math/smoke/FMinTest.h +++ b/libc/test/src/math/smoke/FMinTest.h @@ -11,7 +11,7 @@ #include -template class FMinTest : public __llvm_libc::testing::Test { +template class FMinTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/smoke/FModTest.h b/libc/test/src/math/smoke/FModTest.h index 6bff888294d2b0fa5c2522bf87df10967c247ad9..5fc0ebf6d33e40787a335e071b2236b823269f0a 100644 --- a/libc/test/src/math/smoke/FModTest.h +++ b/libc/test/src/math/smoke/FModTest.h @@ -21,11 +21,11 @@ EXPECT_FP_EQ(expected, f(x, y)); \ EXPECT_MATH_ERRNO((dom_err) ? EDOM : 0); \ EXPECT_FP_EXCEPTION(expected_exception); \ - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT) + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT) #define TEST_REGULAR(x, y, expected) TEST_SPECIAL(x, y, expected, false, 0) -template class FmodTest : public __llvm_libc::testing::Test { +template class FmodTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/smoke/FloorTest.h b/libc/test/src/math/smoke/FloorTest.h index b1125b0517e5e3c7406e850d470f3595158d4bfc..1c1b62c2dcda2a120a731d197f1260776ea5e9d4 100644 --- a/libc/test/src/math/smoke/FloorTest.h +++ b/libc/test/src/math/smoke/FloorTest.h @@ -11,7 +11,7 @@ #include -template class FloorTest : public __llvm_libc::testing::Test { +template class FloorTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/smoke/FmaTest.h b/libc/test/src/math/smoke/FmaTest.h index d276dba4291a67d92b02db4b0872ddb27d8245bf..3c1c120d77d450864efdb08040e0524bb0ada331 100644 --- a/libc/test/src/math/smoke/FmaTest.h +++ b/libc/test/src/math/smoke/FmaTest.h @@ -14,16 +14,16 @@ #include "test/UnitTest/Test.h" template -class FmaTestTemplate : public __llvm_libc::testing::Test { +class FmaTestTemplate : public LIBC_NAMESPACE::testing::Test { private: using Func = T (*)(T, T, T); - using FPBits = __llvm_libc::fputil::FPBits; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; using UIntType = typename FPBits::UIntType; - const T nan = T(__llvm_libc::fputil::FPBits::build_quiet_nan(1)); - const T inf = T(__llvm_libc::fputil::FPBits::inf()); - const T neg_inf = T(__llvm_libc::fputil::FPBits::neg_inf()); - const T zero = T(__llvm_libc::fputil::FPBits::zero()); - const T neg_zero = T(__llvm_libc::fputil::FPBits::neg_zero()); + const T nan = T(LIBC_NAMESPACE::fputil::FPBits::build_quiet_nan(1)); + const T inf = T(LIBC_NAMESPACE::fputil::FPBits::inf()); + const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits::neg_inf()); + const T zero = T(LIBC_NAMESPACE::fputil::FPBits::zero()); + const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits::neg_zero()); public: void test_special_numbers(Func func) { diff --git a/libc/test/src/math/smoke/FrexpTest.h b/libc/test/src/math/smoke/FrexpTest.h index 7a3a948912bb873cc3f946eff877ba1c687afdab..1740770fd6c4787184f225af0b71f3c0f866bf3b 100644 --- a/libc/test/src/math/smoke/FrexpTest.h +++ b/libc/test/src/math/smoke/FrexpTest.h @@ -12,12 +12,12 @@ #include -template class FrexpTest : public __llvm_libc::testing::Test { +template class FrexpTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) static constexpr UIntType HIDDEN_BIT = - UIntType(1) << __llvm_libc::fputil::MantissaWidth::VALUE; + UIntType(1) << LIBC_NAMESPACE::fputil::MantissaWidth::VALUE; public: typedef T (*FrexpFunc)(T, int *); diff --git a/libc/test/src/math/smoke/HypotTest.h b/libc/test/src/math/smoke/HypotTest.h index 084dbc4d83d750bdd3c54b643e2dd71564c684fb..22c2fe4d1c3593bdca09e7c58dc333e20820dd6a 100644 --- a/libc/test/src/math/smoke/HypotTest.h +++ b/libc/test/src/math/smoke/HypotTest.h @@ -16,10 +16,10 @@ #include template -class HypotTestTemplate : public __llvm_libc::testing::Test { +class HypotTestTemplate : public LIBC_NAMESPACE::testing::Test { private: using Func = T (*)(T, T); - using FPBits = __llvm_libc::fputil::FPBits; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; using UIntType = typename FPBits::UIntType; const T nan = T(FPBits::build_quiet_nan(1)); const T inf = T(FPBits::inf()); diff --git a/libc/test/src/math/smoke/ILogbTest.h b/libc/test/src/math/smoke/ILogbTest.h index 6ad5eb065c8aa4475f57b27b5a88efcdc55179af..e51a5d7a2544cdc3877c8a93cb7c49d10563ddfd 100644 --- a/libc/test/src/math/smoke/ILogbTest.h +++ b/libc/test/src/math/smoke/ILogbTest.h @@ -16,7 +16,7 @@ #include -class LlvmLibcILogbTest : public __llvm_libc::testing::Test { +class LlvmLibcILogbTest : public LIBC_NAMESPACE::testing::Test { public: template struct ILogbFunc { typedef int (*Func)(T); @@ -24,14 +24,15 @@ public: template void test_special_numbers(typename ILogbFunc::Func func) { - EXPECT_EQ(FP_ILOGB0, func(T(__llvm_libc::fputil::FPBits::zero()))); - EXPECT_EQ(FP_ILOGB0, func(T(__llvm_libc::fputil::FPBits::neg_zero()))); + EXPECT_EQ(FP_ILOGB0, func(T(LIBC_NAMESPACE::fputil::FPBits::zero()))); + EXPECT_EQ(FP_ILOGB0, + func(T(LIBC_NAMESPACE::fputil::FPBits::neg_zero()))); EXPECT_EQ(FP_ILOGBNAN, - func(T(__llvm_libc::fputil::FPBits::build_quiet_nan(1)))); + func(T(LIBC_NAMESPACE::fputil::FPBits::build_quiet_nan(1)))); - EXPECT_EQ(INT_MAX, func(T(__llvm_libc::fputil::FPBits::inf()))); - EXPECT_EQ(INT_MAX, func(T(__llvm_libc::fputil::FPBits::neg_inf()))); + EXPECT_EQ(INT_MAX, func(T(LIBC_NAMESPACE::fputil::FPBits::inf()))); + EXPECT_EQ(INT_MAX, func(T(LIBC_NAMESPACE::fputil::FPBits::neg_inf()))); } template @@ -75,7 +76,7 @@ public: template void test_subnormal_range(typename ILogbFunc::Func func) { - using FPBits = __llvm_libc::fputil::FPBits; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; using UIntType = typename FPBits::UIntType; constexpr UIntType COUNT = 10'001; constexpr UIntType STEP = @@ -88,14 +89,14 @@ public: continue; int exponent; - __llvm_libc::fputil::frexp(x, exponent); + LIBC_NAMESPACE::fputil::frexp(x, exponent); ASSERT_EQ(exponent, func(x) + 1); } } template void test_normal_range(typename ILogbFunc::Func func) { - using FPBits = __llvm_libc::fputil::FPBits; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; using UIntType = typename FPBits::UIntType; constexpr UIntType COUNT = 10'001; constexpr UIntType STEP = @@ -106,7 +107,7 @@ 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 2e592995ae792e9b97e02434717e8bf77164bd3b..bffa7335fb25b17f206535adc602e83401dfc265 100644 --- a/libc/test/src/math/smoke/LdExpTest.h +++ b/libc/test/src/math/smoke/LdExpTest.h @@ -19,20 +19,20 @@ #include template -class LdExpTestTemplate : public __llvm_libc::testing::Test { - using FPBits = __llvm_libc::fputil::FPBits; - using NormalFloat = __llvm_libc::fputil::NormalFloat; +class LdExpTestTemplate : public LIBC_NAMESPACE::testing::Test { + using FPBits = LIBC_NAMESPACE::fputil::FPBits; + using NormalFloat = LIBC_NAMESPACE::fputil::NormalFloat; using UIntType = typename FPBits::UIntType; static constexpr UIntType MANTISSA_WIDTH = - __llvm_libc::fputil::MantissaWidth::VALUE; + LIBC_NAMESPACE::fputil::MantissaWidth::VALUE; // A normalized mantissa to be used with tests. static constexpr UIntType MANTISSA = NormalFloat::ONE + 0x1234; - const T zero = T(__llvm_libc::fputil::FPBits::zero()); - const T neg_zero = T(__llvm_libc::fputil::FPBits::neg_zero()); - const T inf = T(__llvm_libc::fputil::FPBits::inf()); - const T neg_inf = T(__llvm_libc::fputil::FPBits::neg_inf()); - const T nan = T(__llvm_libc::fputil::FPBits::build_quiet_nan(1)); + const T zero = T(LIBC_NAMESPACE::fputil::FPBits::zero()); + const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits::neg_zero()); + const T inf = T(LIBC_NAMESPACE::fputil::FPBits::inf()); + const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits::neg_inf()); + const T nan = T(LIBC_NAMESPACE::fputil::FPBits::build_quiet_nan(1)); public: typedef T (*LdExpFunc)(T, int); diff --git a/libc/test/src/math/smoke/LogbTest.h b/libc/test/src/math/smoke/LogbTest.h index 885bd7c8a6371c3c2deb8073e0adb35c54452907..34cf92c19ed8b1b1e7532de7bdd55f00c35cc71a 100644 --- a/libc/test/src/math/smoke/LogbTest.h +++ b/libc/test/src/math/smoke/LogbTest.h @@ -12,12 +12,12 @@ #include -template class LogbTest : public __llvm_libc::testing::Test { +template class LogbTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) static constexpr UIntType HIDDEN_BIT = - UIntType(1) << __llvm_libc::fputil::MantissaWidth::VALUE; + UIntType(1) << LIBC_NAMESPACE::fputil::MantissaWidth::VALUE; public: typedef T (*LogbFunc)(T); @@ -77,7 +77,7 @@ 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 687d0dd74ab67bf6554ad94399329544eb9e2124..012a3247f92ead6228495a7ea25bf2b12aecea7a 100644 --- a/libc/test/src/math/smoke/ModfTest.h +++ b/libc/test/src/math/smoke/ModfTest.h @@ -13,7 +13,7 @@ #include -template class ModfTest : public __llvm_libc::testing::Test { +template class ModfTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) @@ -90,8 +90,8 @@ 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 e6de9419d9904019175bf1684f994934219314cb..4e450cf5bc1e9e79cd97709b29c68b5b0596f761 100644 --- a/libc/test/src/math/smoke/NextAfterTest.h +++ b/libc/test/src/math/smoke/NextAfterTest.h @@ -18,13 +18,13 @@ #include template -class NextAfterTestTemplate : public __llvm_libc::testing::Test { - using FPBits = __llvm_libc::fputil::FPBits; - using MantissaWidth = __llvm_libc::fputil::MantissaWidth; +class NextAfterTestTemplate : public LIBC_NAMESPACE::testing::Test { + using FPBits = LIBC_NAMESPACE::fputil::FPBits; + using MantissaWidth = LIBC_NAMESPACE::fputil::MantissaWidth; using UIntType = typename FPBits::UIntType; static constexpr int BIT_WIDTH_OF_TYPE = - __llvm_libc::fputil::FloatProperties::BIT_WIDTH; + LIBC_NAMESPACE::fputil::FloatProperties::BIT_WIDTH; const T zero = T(FPBits::zero()); const T neg_zero = T(FPBits::neg_zero()); @@ -52,54 +52,54 @@ public: T x = zero; T result = func(x, T(1)); UIntType expected_bits = 1; - T expected = __llvm_libc::cpp::bit_cast(expected_bits); + T expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); result = func(x, T(-1)); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + 1; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); x = neg_zero; result = func(x, 1); expected_bits = 1; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); result = func(x, -1); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + 1; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); // 'from' is max subnormal value. - x = __llvm_libc::cpp::bit_cast(max_subnormal); + x = LIBC_NAMESPACE::cpp::bit_cast(max_subnormal); result = func(x, 1); - expected = __llvm_libc::cpp::bit_cast(min_normal); + expected = LIBC_NAMESPACE::cpp::bit_cast(min_normal); ASSERT_FP_EQ(result, expected); result = func(x, 0); expected_bits = max_subnormal - 1; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); x = -x; result = func(x, -1); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + min_normal; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); result = func(x, 0); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + max_subnormal - 1; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); // 'from' is min subnormal value. - x = __llvm_libc::cpp::bit_cast(min_subnormal); + x = LIBC_NAMESPACE::cpp::bit_cast(min_subnormal); result = func(x, 1); expected_bits = min_subnormal + 1; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); ASSERT_FP_EQ(func(x, 0), 0); @@ -107,35 +107,35 @@ public: result = func(x, -1); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + min_subnormal + 1; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); ASSERT_FP_EQ(func(x, 0), T(-0.0)); // 'from' is min normal. - x = __llvm_libc::cpp::bit_cast(min_normal); + x = LIBC_NAMESPACE::cpp::bit_cast(min_normal); result = func(x, 0); expected_bits = max_subnormal; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); result = func(x, inf); expected_bits = min_normal + 1; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); x = -x; result = func(x, 0); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + max_subnormal; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); result = func(x, -inf); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + min_normal + 1; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); // 'from' is max normal and 'to' is infinity. - x = __llvm_libc::cpp::bit_cast(max_normal); + x = LIBC_NAMESPACE::cpp::bit_cast(max_normal); result = func(x, inf); ASSERT_FP_EQ(result, inf); @@ -146,14 +146,14 @@ public: x = inf; result = func(x, 0); expected_bits = max_normal; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); ASSERT_FP_EQ(func(x, inf), inf); x = neg_inf; result = func(x, 0); expected_bits = (UIntType(1) << (BIT_WIDTH_OF_TYPE - 1)) + max_normal; - expected = __llvm_libc::cpp::bit_cast(expected_bits); + expected = LIBC_NAMESPACE::cpp::bit_cast(expected_bits); ASSERT_FP_EQ(result, expected); ASSERT_FP_EQ(func(x, neg_inf), neg_inf); diff --git a/libc/test/src/math/smoke/RIntTest.h b/libc/test/src/math/smoke/RIntTest.h index 7a6d5c7ed78c96f24ad31028a110d87f07660ffc..839240fa9c98202c67c00c76acff6f590d0a2889 100644 --- a/libc/test/src/math/smoke/RIntTest.h +++ b/libc/test/src/math/smoke/RIntTest.h @@ -22,12 +22,12 @@ static constexpr int ROUNDING_MODES[4] = {FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO, FE_TONEAREST}; template -class RIntTestTemplate : public __llvm_libc::testing::Test { +class RIntTestTemplate : public LIBC_NAMESPACE::testing::Test { public: typedef T (*RIntFunc)(T); private: - using FPBits = __llvm_libc::fputil::FPBits; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; using UIntType = typename FPBits::UIntType; const T zero = T(FPBits::zero()); @@ -39,7 +39,7 @@ 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 4d49fd7dedc402e6e4642239463a27990c27ac91..5a5d143777502351321ae86d7a97e5f5e4e31b5e 100644 --- a/libc/test/src/math/smoke/RemQuoTest.h +++ b/libc/test/src/math/smoke/RemQuoTest.h @@ -16,15 +16,15 @@ #include template -class RemQuoTestTemplate : public __llvm_libc::testing::Test { - using FPBits = __llvm_libc::fputil::FPBits; +class RemQuoTestTemplate : public LIBC_NAMESPACE::testing::Test { + using FPBits = LIBC_NAMESPACE::fputil::FPBits; using UIntType = typename FPBits::UIntType; - const T zero = T(__llvm_libc::fputil::FPBits::zero()); - const T neg_zero = T(__llvm_libc::fputil::FPBits::neg_zero()); - const T inf = T(__llvm_libc::fputil::FPBits::inf()); - const T neg_inf = T(__llvm_libc::fputil::FPBits::neg_inf()); - const T nan = T(__llvm_libc::fputil::FPBits::build_quiet_nan(1)); + const T zero = T(LIBC_NAMESPACE::fputil::FPBits::zero()); + const T neg_zero = T(LIBC_NAMESPACE::fputil::FPBits::neg_zero()); + const T inf = T(LIBC_NAMESPACE::fputil::FPBits::inf()); + const T neg_inf = T(LIBC_NAMESPACE::fputil::FPBits::neg_inf()); + const T nan = T(LIBC_NAMESPACE::fputil::FPBits::build_quiet_nan(1)); public: typedef T (*RemQuoFunc)(T, T, int *); diff --git a/libc/test/src/math/smoke/RoundTest.h b/libc/test/src/math/smoke/RoundTest.h index c67f1ce48220a9a628098a8e236c2f5c496cb441..2e95f182ce948b780d64c868050da6c396a608b7 100644 --- a/libc/test/src/math/smoke/RoundTest.h +++ b/libc/test/src/math/smoke/RoundTest.h @@ -11,7 +11,7 @@ #include -template class RoundTest : public __llvm_libc::testing::Test { +template class RoundTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/smoke/RoundToIntegerTest.h b/libc/test/src/math/smoke/RoundToIntegerTest.h index c37186bff57b3c8c1d71ff52d70c4edfe813ae39..31ce852fb75df2e1325c4c4e4c6313557ae46fd5 100644 --- a/libc/test/src/math/smoke/RoundToIntegerTest.h +++ b/libc/test/src/math/smoke/RoundToIntegerTest.h @@ -21,26 +21,26 @@ static constexpr int ROUNDING_MODES[4] = {FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO, FE_TONEAREST}; template -class RoundToIntegerTestTemplate : public __llvm_libc::testing::Test { +class RoundToIntegerTestTemplate : public LIBC_NAMESPACE::testing::Test { public: typedef I (*RoundToIntegerFunc)(F); private: - using FPBits = __llvm_libc::fputil::FPBits; + using FPBits = LIBC_NAMESPACE::fputil::FPBits; using UIntType = typename FPBits::UIntType; - const F zero = F(__llvm_libc::fputil::FPBits::zero()); - const F neg_zero = F(__llvm_libc::fputil::FPBits::neg_zero()); - const F inf = F(__llvm_libc::fputil::FPBits::inf()); - const F neg_inf = F(__llvm_libc::fputil::FPBits::neg_inf()); - const F nan = F(__llvm_libc::fputil::FPBits::build_quiet_nan(1)); + const F zero = F(LIBC_NAMESPACE::fputil::FPBits::zero()); + const F neg_zero = F(LIBC_NAMESPACE::fputil::FPBits::neg_zero()); + const F inf = F(LIBC_NAMESPACE::fputil::FPBits::inf()); + const F neg_inf = F(LIBC_NAMESPACE::fputil::FPBits::neg_inf()); + const F nan = F(LIBC_NAMESPACE::fputil::FPBits::build_quiet_nan(1)); static constexpr I INTEGER_MIN = I(1) << (sizeof(I) * 8 - 1); static constexpr I INTEGER_MAX = -(INTEGER_MIN + 1); void test_one_input(RoundToIntegerFunc func, F input, I expected, bool expectError) { libc_errno = 0; - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); ASSERT_EQ(func(input), expected); @@ -59,7 +59,7 @@ 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 c3896e302373a263351e778b8a285be0c7cee0c3..d4b2f9dd2624f1d1e10ad62bdf93c53bcae621b8 100644 --- a/libc/test/src/math/smoke/SqrtTest.h +++ b/libc/test/src/math/smoke/SqrtTest.h @@ -12,12 +12,12 @@ #include -template class SqrtTest : public __llvm_libc::testing::Test { +template class SqrtTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) static constexpr UIntType HIDDEN_BIT = - UIntType(1) << __llvm_libc::fputil::MantissaWidth::VALUE; + UIntType(1) << LIBC_NAMESPACE::fputil::MantissaWidth::VALUE; public: typedef T (*SqrtFunc)(T); diff --git a/libc/test/src/math/smoke/TruncTest.h b/libc/test/src/math/smoke/TruncTest.h index 32b5503589ca7a045c25d726af2f85e39e7f798f..8334a7b7c0f90daf333ada6929a501820796835d 100644 --- a/libc/test/src/math/smoke/TruncTest.h +++ b/libc/test/src/math/smoke/TruncTest.h @@ -11,7 +11,7 @@ #include -template class TruncTest : public __llvm_libc::testing::Test { +template class TruncTest : public LIBC_NAMESPACE::testing::Test { DECLARE_SPECIAL_CONSTANTS(T) diff --git a/libc/test/src/math/smoke/acosf_test.cpp b/libc/test/src/math/smoke/acosf_test.cpp index 0fc20970232f7bcb4bc502b278843d793f6e983f..b8ba3d5f85cee7f80aaaffd9b38f5c43e4e2235b 100644 --- a/libc/test/src/math/smoke/acosf_test.cpp +++ b/libc/test/src/math/smoke/acosf_test.cpp @@ -16,28 +16,28 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcAcosfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(aNaN)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(inf)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(neg_inf)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(neg_inf)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::acosf(1.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::acosf(1.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(2.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(2.0f)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acosf(-2.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acosf(-2.0f)); EXPECT_MATH_ERRNO(EDOM); } diff --git a/libc/test/src/math/smoke/acoshf_test.cpp b/libc/test/src/math/smoke/acoshf_test.cpp index ac3021ff3154e4188cc898c3b5b245b823000ec4..b8d7453bfdb212a3709ec3f897c4a23bfae6f57a 100644 --- a/libc/test/src/math/smoke/acoshf_test.cpp +++ b/libc/test/src/math/smoke/acoshf_test.cpp @@ -16,25 +16,25 @@ #include #include -using FPBits_t = __llvm_libc::fputil::FPBits; +using FPBits_t = LIBC_NAMESPACE::fputil::FPBits; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcAcoshfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acoshf(aNaN)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acoshf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acoshf(0.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acoshf(0.0f)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::acoshf(1.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::acoshf(1.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::acoshf(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(inf, LIBC_NAMESPACE::acoshf(inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::acoshf(neg_inf)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::acoshf(neg_inf)); EXPECT_MATH_ERRNO(EDOM); } diff --git a/libc/test/src/math/smoke/asinf_test.cpp b/libc/test/src/math/smoke/asinf_test.cpp index f6455475947a3e2fbf1a6575371bbcb5e2c41cf8..e2eca352e1d882424c2f84331195852f15686b8f 100644 --- a/libc/test/src/math/smoke/asinf_test.cpp +++ b/libc/test/src/math/smoke/asinf_test.cpp @@ -16,31 +16,31 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcAsinfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinf(aNaN)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::asinf(0.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::asinf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, __llvm_libc::asinf(-0.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, LIBC_NAMESPACE::asinf(-0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinf(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinf(inf)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinf(neg_inf)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinf(neg_inf)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinf(2.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinf(2.0f)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinf(-2.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinf(-2.0f)); EXPECT_MATH_ERRNO(EDOM); } diff --git a/libc/test/src/math/smoke/asinhf_test.cpp b/libc/test/src/math/smoke/asinhf_test.cpp index 6b5f9437b4149a708a3cea51e70f1d02d6845d71..f10cf934c533af68679a6892df983c7c6420024d 100644 --- a/libc/test/src/math/smoke/asinhf_test.cpp +++ b/libc/test/src/math/smoke/asinhf_test.cpp @@ -16,25 +16,25 @@ #include #include -using FPBits_t = __llvm_libc::fputil::FPBits; +using FPBits_t = LIBC_NAMESPACE::fputil::FPBits; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcAsinhfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::asinhf(aNaN)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::asinhf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::asinhf(0.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::asinhf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, __llvm_libc::asinhf(-0.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, LIBC_NAMESPACE::asinhf(-0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::asinhf(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(inf, LIBC_NAMESPACE::asinhf(inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(neg_inf, __llvm_libc::asinhf(neg_inf)); + EXPECT_FP_EQ_ALL_ROUNDING(neg_inf, LIBC_NAMESPACE::asinhf(neg_inf)); EXPECT_MATH_ERRNO(0); } diff --git a/libc/test/src/math/smoke/atanf_test.cpp b/libc/test/src/math/smoke/atanf_test.cpp index 7d3f38682e8c01c813d389e8f3d8d4dc725ba863..6e6f854002cc500bdcef6659e9b72515600e4362 100644 --- a/libc/test/src/math/smoke/atanf_test.cpp +++ b/libc/test/src/math/smoke/atanf_test.cpp @@ -16,25 +16,25 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcAtanfTest, SpecialNumbers) { libc_errno = 0; - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanf(aNaN)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanf(aNaN)); EXPECT_FP_EXCEPTION(0); EXPECT_MATH_ERRNO(0); - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::atanf(0.0f)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::atanf(0.0f)); EXPECT_FP_EXCEPTION(0); EXPECT_MATH_ERRNO(0); - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, __llvm_libc::atanf(-0.0f)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, LIBC_NAMESPACE::atanf(-0.0f)); EXPECT_FP_EXCEPTION(0); EXPECT_MATH_ERRNO(0); } diff --git a/libc/test/src/math/smoke/atanhf_test.cpp b/libc/test/src/math/smoke/atanhf_test.cpp index ac2d47babe4eb0d825fd40301e5b9726962bd84f..841cb884c37fe5ebb0630a9e6f35bf7489fd5758 100644 --- a/libc/test/src/math/smoke/atanhf_test.cpp +++ b/libc/test/src/math/smoke/atanhf_test.cpp @@ -16,57 +16,57 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcAtanhfTest, SpecialNumbers) { libc_errno = 0; - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::atanhf(aNaN)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::atanhf(aNaN)); EXPECT_FP_EXCEPTION(0); EXPECT_MATH_ERRNO(0); - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(0.0f, __llvm_libc::atanhf(0.0f)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(0.0f, LIBC_NAMESPACE::atanhf(0.0f)); EXPECT_FP_EXCEPTION(0); EXPECT_MATH_ERRNO(0); - __llvm_libc::fputil::clear_except(FE_ALL_EXCEPT); - EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, __llvm_libc::atanhf(-0.0f)); + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); + EXPECT_FP_EQ_ALL_ROUNDING(-0.0f, LIBC_NAMESPACE::atanhf(-0.0f)); EXPECT_FP_EXCEPTION(0); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_WITH_EXCEPTION(inf, __llvm_libc::atanhf(1.0f), FE_DIVBYZERO); + EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::atanhf(1.0f), FE_DIVBYZERO); EXPECT_MATH_ERRNO(ERANGE); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::atanhf(-1.0f), + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::atanhf(-1.0f), FE_DIVBYZERO); EXPECT_MATH_ERRNO(ERANGE); auto bt = FPBits(1.0f); bt.bits += 1; - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::atanhf(bt.get_val()), + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::atanhf(bt.get_val()), FE_INVALID); EXPECT_MATH_ERRNO(EDOM); bt.set_sign(true); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::atanhf(bt.get_val()), + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::atanhf(bt.get_val()), FE_INVALID); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::atanhf(2.0f), FE_INVALID); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::atanhf(2.0f), FE_INVALID); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::atanhf(-2.0f), FE_INVALID); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::atanhf(-2.0f), FE_INVALID); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::atanhf(inf), FE_INVALID); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::atanhf(inf), FE_INVALID); EXPECT_MATH_ERRNO(EDOM); bt.set_sign(true); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::atanhf(neg_inf), FE_INVALID); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::atanhf(neg_inf), FE_INVALID); EXPECT_MATH_ERRNO(EDOM); } diff --git a/libc/test/src/math/smoke/ceil_test.cpp b/libc/test/src/math/smoke/ceil_test.cpp index 2a592e3ee85b0cc32e3e937bed42c77d92c28986..800452a43426c7c5b477d4721b141f405c2ec034 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 cfa8cb2c5aa6dd4d7e69ab98a426d6eb12b76867..2a2504228adb0ad007af91750e6bf2285ee11450 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 6fe30465edc85744d47b2fea639c07a9e25d77e1..0f766602a0f6d41d0a3144edbc8f244ef5351bd6 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 37bfa0d90c378966c9d511732b8843e1e417cdef..5b3d812c02da4d194fa92147dc9891fbda12e33d 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 fec283ccd0c7acd73d6c01e81cd8723aad2c80ac..344ffee2359ec8b6bbf8db3a19f318d02d5dfc4a 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 d1de911196b62b784e3272377ada928bb7e719c0..bed60678dc161da133a4e22e0a9f27f54fd8db34 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 4ef96677eb4d1ca5cb7fa0961288f60075c3faaf..6a2c6a5b252995557b3253fb14dc9637e22d5a6c 100644 --- a/libc/test/src/math/smoke/cosf_test.cpp +++ b/libc/test/src/math/smoke/cosf_test.cpp @@ -16,25 +16,25 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcCosfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::cosf(aNaN)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::cosf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::cosf(0.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(1.0f, LIBC_NAMESPACE::cosf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::cosf(-0.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(1.0f, LIBC_NAMESPACE::cosf(-0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::cosf(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::cosf(inf)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::cosf(neg_inf)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::cosf(neg_inf)); EXPECT_MATH_ERRNO(EDOM); } diff --git a/libc/test/src/math/smoke/coshf_test.cpp b/libc/test/src/math/smoke/coshf_test.cpp index 7198aa266aa8d3bf56ab513dfb98e7ac404d0af2..dd08f1924abc38c844ebc5e6b8408a7d70353aec 100644 --- a/libc/test/src/math/smoke/coshf_test.cpp +++ b/libc/test/src/math/smoke/coshf_test.cpp @@ -17,40 +17,40 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcCoshfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::coshf(aNaN)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::coshf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::coshf(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(inf, LIBC_NAMESPACE::coshf(inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(inf, __llvm_libc::coshf(neg_inf)); + EXPECT_FP_EQ_ALL_ROUNDING(inf, LIBC_NAMESPACE::coshf(neg_inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::coshf(0.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(1.0f, LIBC_NAMESPACE::coshf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::coshf(-0.0f)); + EXPECT_FP_EQ_ALL_ROUNDING(1.0f, LIBC_NAMESPACE::coshf(-0.0f)); EXPECT_MATH_ERRNO(0); } TEST(LlvmLibcCoshfTest, Overflow) { libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::coshf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::coshf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::coshf(float(FPBits(0x42cffff8U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::coshf(float(FPBits(0x42cffff8U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::coshf(float(FPBits(0x42d00008U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::coshf(float(FPBits(0x42d00008U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); } diff --git a/libc/test/src/math/smoke/erff_test.cpp b/libc/test/src/math/smoke/erff_test.cpp index c2a247b6e6672ff44a200a19b0a18e01ed5e371a..9c9105167b8c7111882d4c4852a86ebb46261f32 100644 --- a/libc/test/src/math/smoke/erff_test.cpp +++ b/libc/test/src/math/smoke/erff_test.cpp @@ -15,14 +15,14 @@ #include #include -using __llvm_libc::testing::tlog; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcErffTest, SpecialNumbers) { - EXPECT_FP_EQ_ALL_ROUNDING(aNaN, __llvm_libc::erff(aNaN)); - EXPECT_FP_EQ_ALL_ROUNDING(1.0f, __llvm_libc::erff(inf)); - EXPECT_FP_EQ_ALL_ROUNDING(-1.0f, __llvm_libc::erff(neg_inf)); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::erff(zero)); - EXPECT_FP_EQ_ALL_ROUNDING(neg_zero, __llvm_libc::erff(neg_zero)); + EXPECT_FP_EQ_ALL_ROUNDING(aNaN, LIBC_NAMESPACE::erff(aNaN)); + EXPECT_FP_EQ_ALL_ROUNDING(1.0f, LIBC_NAMESPACE::erff(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(-1.0f, LIBC_NAMESPACE::erff(neg_inf)); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::erff(zero)); + EXPECT_FP_EQ_ALL_ROUNDING(neg_zero, LIBC_NAMESPACE::erff(neg_zero)); } diff --git a/libc/test/src/math/smoke/exp10_test.cpp b/libc/test/src/math/smoke/exp10_test.cpp index 21ba51d32345a78dc0a5875a81d143aa87182768..cf699bab6ebeeefcd5c49df6d4ac5429fd65a376 100644 --- a/libc/test/src/math/smoke/exp10_test.cpp +++ b/libc/test/src/math/smoke/exp10_test.cpp @@ -16,21 +16,22 @@ #include #include -using __llvm_libc::testing::tlog; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(double) TEST(LlvmLibcExp10Test, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::exp10(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::exp10(inf)); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::exp10(neg_inf)); - EXPECT_FP_EQ_WITH_EXCEPTION(zero, __llvm_libc::exp10(-0x1.0p20), + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp10(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::exp10(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::exp10(neg_inf)); + EXPECT_FP_EQ_WITH_EXCEPTION(zero, LIBC_NAMESPACE::exp10(-0x1.0p20), FE_UNDERFLOW); - EXPECT_FP_EQ_WITH_EXCEPTION(inf, __llvm_libc::exp10(0x1.0p20), FE_OVERFLOW); - EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp10(0.0)); - EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp10(-0.0)); + EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp10(0x1.0p20), + FE_OVERFLOW); + EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp10(0.0)); + EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp10(-0.0)); - EXPECT_FP_EQ_ALL_ROUNDING(10.0, __llvm_libc::exp10(1.0)); - EXPECT_FP_EQ_ALL_ROUNDING(100.0, __llvm_libc::exp10(2.0)); - EXPECT_FP_EQ_ALL_ROUNDING(1000.0, __llvm_libc::exp10(3.0)); + EXPECT_FP_EQ_ALL_ROUNDING(10.0, LIBC_NAMESPACE::exp10(1.0)); + EXPECT_FP_EQ_ALL_ROUNDING(100.0, LIBC_NAMESPACE::exp10(2.0)); + EXPECT_FP_EQ_ALL_ROUNDING(1000.0, LIBC_NAMESPACE::exp10(3.0)); } diff --git a/libc/test/src/math/smoke/exp10f_test.cpp b/libc/test/src/math/smoke/exp10f_test.cpp index 4de0074ab8269296a07057cb1ec37124a6f40433..c4d3cb6002df97b7e5740c7f27b44a4a9c5881f9 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 13b24b01261096afe0fb0f95088cbecf0a52e79c..ec076c15fed019ab02c66846c7d3ab3b3bc4d224 100644 --- a/libc/test/src/math/smoke/exp2_test.cpp +++ b/libc/test/src/math/smoke/exp2_test.cpp @@ -16,20 +16,21 @@ #include #include -using __llvm_libc::testing::tlog; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(double) TEST(LlvmLibcExp2Test, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::exp2(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::exp2(inf)); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::exp2(neg_inf)); - EXPECT_FP_EQ_WITH_EXCEPTION(zero, __llvm_libc::exp2(-0x1.0p20), FE_UNDERFLOW); - EXPECT_FP_EQ_WITH_EXCEPTION(inf, __llvm_libc::exp2(0x1.0p20), FE_OVERFLOW); - EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp2(0.0)); - EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp2(-0.0)); - EXPECT_FP_EQ_ALL_ROUNDING(2.0, __llvm_libc::exp2(1.0)); - EXPECT_FP_EQ_ALL_ROUNDING(0.5, __llvm_libc::exp2(-1.0)); - EXPECT_FP_EQ_ALL_ROUNDING(4.0, __llvm_libc::exp2(2.0)); - EXPECT_FP_EQ_ALL_ROUNDING(0.25, __llvm_libc::exp2(-2.0)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp2(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::exp2(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::exp2(neg_inf)); + EXPECT_FP_EQ_WITH_EXCEPTION(zero, LIBC_NAMESPACE::exp2(-0x1.0p20), + FE_UNDERFLOW); + EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp2(0x1.0p20), FE_OVERFLOW); + EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp2(0.0)); + EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp2(-0.0)); + EXPECT_FP_EQ_ALL_ROUNDING(2.0, LIBC_NAMESPACE::exp2(1.0)); + EXPECT_FP_EQ_ALL_ROUNDING(0.5, LIBC_NAMESPACE::exp2(-1.0)); + EXPECT_FP_EQ_ALL_ROUNDING(4.0, LIBC_NAMESPACE::exp2(2.0)); + EXPECT_FP_EQ_ALL_ROUNDING(0.25, LIBC_NAMESPACE::exp2(-2.0)); } diff --git a/libc/test/src/math/smoke/exp2f_test.cpp b/libc/test/src/math/smoke/exp2f_test.cpp index c22a5eb294100b4d0844570575632fdce3969c51..f26f155cc870a5d6d6f9d994ffed0fc3878cdb3b 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 3406f0afd73ebe0ca969c922881bfd44b90798b0..7973c37257c53d896aa72fb1b77d7c9b358bd317 100644 --- a/libc/test/src/math/smoke/exp_test.cpp +++ b/libc/test/src/math/smoke/exp_test.cpp @@ -16,16 +16,17 @@ #include #include -using __llvm_libc::testing::tlog; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(double) TEST(LlvmLibcExpTest, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::exp(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::exp(inf)); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::exp(neg_inf)); - EXPECT_FP_EQ_WITH_EXCEPTION(zero, __llvm_libc::exp(-0x1.0p20), FE_UNDERFLOW); - EXPECT_FP_EQ_WITH_EXCEPTION(inf, __llvm_libc::exp(0x1.0p20), FE_OVERFLOW); - EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp(0.0)); - EXPECT_FP_EQ_ALL_ROUNDING(1.0, __llvm_libc::exp(-0.0)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::exp(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::exp(inf)); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::exp(neg_inf)); + EXPECT_FP_EQ_WITH_EXCEPTION(zero, LIBC_NAMESPACE::exp(-0x1.0p20), + FE_UNDERFLOW); + EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::exp(0x1.0p20), FE_OVERFLOW); + EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp(0.0)); + EXPECT_FP_EQ_ALL_ROUNDING(1.0, LIBC_NAMESPACE::exp(-0.0)); } diff --git a/libc/test/src/math/smoke/expf_test.cpp b/libc/test/src/math/smoke/expf_test.cpp index 174d58013cc06470c4a315d37b56136eb39dd5d4..e5c5afbd182238d0d7b8acf0d91f99a465a263c9 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 f34562434eb3480f788a4b919d465ca847b7f498..03fe1413e95e12f986fa1dc722cceaa970ed3743 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 2bf0ddda44ade35962b98d3059221f94ec2778f1..0447040ddae3061c9f42629e3d7951bcaac33ac2 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 6374a1018f1da420537dd754d8dd07a4cd7a7658..9f1e2a66d47655cf623de4cf3a54a91ad3607a9d 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 ff1320225452a920561a5b6c2cff0f09d2e62e81..37d2b54a4c53e111dd40dc788665f91dd36d88f5 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 80174b79b95b83ce713a1d2f1bd14ec59dbbdacc..2f00a30ad1ee6f76e231ee525917916013f6bfe6 100644 --- a/libc/test/src/math/smoke/fdim_test.cpp +++ b/libc/test/src/math/smoke/fdim_test.cpp @@ -16,16 +16,18 @@ using LlvmLibcFDimTest = FDimTestTemplate; -TEST_F(LlvmLibcFDimTest, NaNArg_fdim) { test_na_n_arg(&__llvm_libc::fdim); } +TEST_F(LlvmLibcFDimTest, NaNArg_fdim) { test_na_n_arg(&LIBC_NAMESPACE::fdim); } -TEST_F(LlvmLibcFDimTest, InfArg_fdim) { test_inf_arg(&__llvm_libc::fdim); } +TEST_F(LlvmLibcFDimTest, InfArg_fdim) { test_inf_arg(&LIBC_NAMESPACE::fdim); } TEST_F(LlvmLibcFDimTest, NegInfArg_fdim) { - test_neg_inf_arg(&__llvm_libc::fdim); + test_neg_inf_arg(&LIBC_NAMESPACE::fdim); } -TEST_F(LlvmLibcFDimTest, BothZero_fdim) { test_both_zero(&__llvm_libc::fdim); } +TEST_F(LlvmLibcFDimTest, BothZero_fdim) { + test_both_zero(&LIBC_NAMESPACE::fdim); +} TEST_F(LlvmLibcFDimTest, InDoubleRange_fdim) { - test_in_range(&__llvm_libc::fdim); + test_in_range(&LIBC_NAMESPACE::fdim); } diff --git a/libc/test/src/math/smoke/fdimf_test.cpp b/libc/test/src/math/smoke/fdimf_test.cpp index 531b89b81ffc9edc249dc2d4591e2faf2f1d00f8..27511baf25b6da8aef9cdc3e00a99e43bb2160e0 100644 --- a/libc/test/src/math/smoke/fdimf_test.cpp +++ b/libc/test/src/math/smoke/fdimf_test.cpp @@ -16,18 +16,20 @@ using LlvmLibcFDimTest = FDimTestTemplate; -TEST_F(LlvmLibcFDimTest, NaNArg_fdimf) { test_na_n_arg(&__llvm_libc::fdimf); } +TEST_F(LlvmLibcFDimTest, NaNArg_fdimf) { + test_na_n_arg(&LIBC_NAMESPACE::fdimf); +} -TEST_F(LlvmLibcFDimTest, InfArg_fdimf) { test_inf_arg(&__llvm_libc::fdimf); } +TEST_F(LlvmLibcFDimTest, InfArg_fdimf) { test_inf_arg(&LIBC_NAMESPACE::fdimf); } TEST_F(LlvmLibcFDimTest, NegInfArg_fdimf) { - test_neg_inf_arg(&__llvm_libc::fdimf); + test_neg_inf_arg(&LIBC_NAMESPACE::fdimf); } TEST_F(LlvmLibcFDimTest, BothZero_fdimf) { - test_both_zero(&__llvm_libc::fdimf); + test_both_zero(&LIBC_NAMESPACE::fdimf); } TEST_F(LlvmLibcFDimTest, InFloatRange_fdimf) { - test_in_range(&__llvm_libc::fdimf); + test_in_range(&LIBC_NAMESPACE::fdimf); } diff --git a/libc/test/src/math/smoke/fdiml_test.cpp b/libc/test/src/math/smoke/fdiml_test.cpp index bb6c54d567a0b2842c6e87cfa27f1ca04b6b6595..45aedb0a1cdea61c050fe6a52eb47a4c4651c576 100644 --- a/libc/test/src/math/smoke/fdiml_test.cpp +++ b/libc/test/src/math/smoke/fdiml_test.cpp @@ -16,18 +16,20 @@ using LlvmLibcFDimTest = FDimTestTemplate; -TEST_F(LlvmLibcFDimTest, NaNArg_fdiml) { test_na_n_arg(&__llvm_libc::fdiml); } +TEST_F(LlvmLibcFDimTest, NaNArg_fdiml) { + test_na_n_arg(&LIBC_NAMESPACE::fdiml); +} -TEST_F(LlvmLibcFDimTest, InfArg_fdiml) { test_inf_arg(&__llvm_libc::fdiml); } +TEST_F(LlvmLibcFDimTest, InfArg_fdiml) { test_inf_arg(&LIBC_NAMESPACE::fdiml); } TEST_F(LlvmLibcFDimTest, NegInfArg_fdiml) { - test_neg_inf_arg(&__llvm_libc::fdiml); + test_neg_inf_arg(&LIBC_NAMESPACE::fdiml); } TEST_F(LlvmLibcFDimTest, BothZero_fdiml) { - test_both_zero(&__llvm_libc::fdiml); + test_both_zero(&LIBC_NAMESPACE::fdiml); } TEST_F(LlvmLibcFDimTest, InLongDoubleRange_fdiml) { - test_in_range(&__llvm_libc::fdiml); + test_in_range(&LIBC_NAMESPACE::fdiml); } diff --git a/libc/test/src/math/smoke/floor_test.cpp b/libc/test/src/math/smoke/floor_test.cpp index e68ed3ecbb603e05b2341776222c0c23d4802e91..9231d07aeb7f8f4a810a3be3b10dad2acada380e 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 f0538f7b97b22f4668c9eb151d7970bc86861d53..cbb11f36f58da3c89aa80e2e781a825050338a5c 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 1b244fd62a117be3a0c17adc593d37039a5aa39f..26f6a7703ed0f6eb52d38b73487e28fac397fb6f 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 f33860f65236bded61e72bf97a1d8bbfb30637d1..4460b80d9ad650f03723609eacac1b23691e2cb8 100644 --- a/libc/test/src/math/smoke/fma_test.cpp +++ b/libc/test/src/math/smoke/fma_test.cpp @@ -13,5 +13,5 @@ using LlvmLibcFmaTest = FmaTestTemplate; TEST_F(LlvmLibcFmaTest, SpecialNumbers) { - test_special_numbers(&__llvm_libc::fma); + test_special_numbers(&LIBC_NAMESPACE::fma); } diff --git a/libc/test/src/math/smoke/fmaf_test.cpp b/libc/test/src/math/smoke/fmaf_test.cpp index 38c2ea35db056db0ffa3b4ceef8e1320fc811689..a645efb8776d0fe89cd96ada08210d44a1f27cab 100644 --- a/libc/test/src/math/smoke/fmaf_test.cpp +++ b/libc/test/src/math/smoke/fmaf_test.cpp @@ -13,5 +13,5 @@ using LlvmLibcFmafTest = FmaTestTemplate; TEST_F(LlvmLibcFmafTest, SpecialNumbers) { - test_special_numbers(&__llvm_libc::fmaf); + test_special_numbers(&LIBC_NAMESPACE::fmaf); } diff --git a/libc/test/src/math/smoke/fmax_test.cpp b/libc/test/src/math/smoke/fmax_test.cpp index 9c81c09414f0139626be5a473a19d38e73d90036..6800939625ebc06a6c2d3319aa485ccb78797a0f 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 cf337d4f07e0307cb99abfefa9d6f98cd6f61517..25c6f7339e8c95e69466719df8367373f0ea25e7 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 636bc4208caef65a3c2c4bee6fe7c9feee4fb97f..9ac986c00012a01d40081bcb51194f31c2683744 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 3515f97faca33cdbf7ac954603d9487f24e4ddf4..5d241519021d43617ce3c2a35787ba47a083d409 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 1a762478af613b1a45f7088ba5e377b493b1f870..1af5b79155b1dcd2a054bd98b372c19afa4adfc7 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 ce8b705b0385e2e256c9e3121ae5d263ed9f0781..0791f8c4ad8595c983fa461a1642b5d3c59bd023 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 03790e4941e19182b3bd7bf8fe6e37ee08db09de..ec39e0567a7ca039a8cd0a3a8f8cfa3b4da50411 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 2b13379eba25235af73a15177f0d379559851d89..5c3c6286e88fef0ef4902e2854757719a27fb76a 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 a44aefc7d8b4e334b710366fcb724db6c3f59d90..4d078baffcb39371685a029fd9239a32352f84d9 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 5d78f94ec1e596a84d3b544c57c721c9b2b1bfae..577eb9609cfcc5baf2dde5c3d2553c2353a7a6f5 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 4904ccd14907bb8991595fc2fb1000d547a84f8b..e5184cd225bcfa95481e0be26bb0c2d30a27d470 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 cecfc0ee3de3aee0ba54a8e4790d633e24a1e48a..d0ab31ffd0fe63c99801a008a315e050472a2b88 100644 --- a/libc/test/src/math/smoke/generic_sqrt_test.cpp +++ b/libc/test/src/math/smoke/generic_sqrt_test.cpp @@ -10,4 +10,4 @@ #include "src/__support/FPUtil/generic/sqrt.h" -LIST_SQRT_TESTS(double, __llvm_libc::fputil::sqrt) +LIST_SQRT_TESTS(double, LIBC_NAMESPACE::fputil::sqrt) diff --git a/libc/test/src/math/smoke/generic_sqrtf_test.cpp b/libc/test/src/math/smoke/generic_sqrtf_test.cpp index 64bf92133b98f3ec59aede42d8adc9a1623b0233..f22ac8829d5ac89de67341aef967a2d937e085b3 100644 --- a/libc/test/src/math/smoke/generic_sqrtf_test.cpp +++ b/libc/test/src/math/smoke/generic_sqrtf_test.cpp @@ -10,4 +10,4 @@ #include "src/__support/FPUtil/generic/sqrt.h" -LIST_SQRT_TESTS(float, __llvm_libc::fputil::sqrt) +LIST_SQRT_TESTS(float, LIBC_NAMESPACE::fputil::sqrt) diff --git a/libc/test/src/math/smoke/generic_sqrtl_test.cpp b/libc/test/src/math/smoke/generic_sqrtl_test.cpp index 6b68aaed97004870ba8c0fddb111007074c147d2..ddc6a23695be4303b2779ccb1a80313dfdb854e4 100644 --- a/libc/test/src/math/smoke/generic_sqrtl_test.cpp +++ b/libc/test/src/math/smoke/generic_sqrtl_test.cpp @@ -10,4 +10,4 @@ #include "src/__support/FPUtil/generic/sqrt.h" -LIST_SQRT_TESTS(long double, __llvm_libc::fputil::sqrt) +LIST_SQRT_TESTS(long double, LIBC_NAMESPACE::fputil::sqrt) diff --git a/libc/test/src/math/smoke/hypot_test.cpp b/libc/test/src/math/smoke/hypot_test.cpp index f865b9f903e3563173c66644f645b7912dc5dcd2..dd127909fafc52f06308f666bbaa8c1124b78b4e 100644 --- a/libc/test/src/math/smoke/hypot_test.cpp +++ b/libc/test/src/math/smoke/hypot_test.cpp @@ -13,5 +13,5 @@ using LlvmLibcHypotTest = HypotTestTemplate; TEST_F(LlvmLibcHypotTest, SpecialNumbers) { - test_special_numbers(&__llvm_libc::hypot); + test_special_numbers(&LIBC_NAMESPACE::hypot); } diff --git a/libc/test/src/math/smoke/hypotf_test.cpp b/libc/test/src/math/smoke/hypotf_test.cpp index 0c0ee3127cd44023420e98efadbbb1a4617fedc7..768e7f75e9d678e45b9204ad98d03ab8bcbfb850 100644 --- a/libc/test/src/math/smoke/hypotf_test.cpp +++ b/libc/test/src/math/smoke/hypotf_test.cpp @@ -13,5 +13,5 @@ using LlvmLibcHypotfTest = HypotTestTemplate; TEST_F(LlvmLibcHypotfTest, SpecialNumbers) { - test_special_numbers(&__llvm_libc::hypotf); + test_special_numbers(&LIBC_NAMESPACE::hypotf); } diff --git a/libc/test/src/math/smoke/ilogb_test.cpp b/libc/test/src/math/smoke/ilogb_test.cpp index a77adec4adba44d6912fe8ccaf0cbdc6cc12a03e..7011c43386e66a5ce52a3c03d48159f739ad96b8 100644 --- a/libc/test/src/math/smoke/ilogb_test.cpp +++ b/libc/test/src/math/smoke/ilogb_test.cpp @@ -16,21 +16,21 @@ #include TEST_F(LlvmLibcILogbTest, SpecialNumbers_ilogb) { - test_special_numbers(&__llvm_libc::ilogb); + test_special_numbers(&LIBC_NAMESPACE::ilogb); } TEST_F(LlvmLibcILogbTest, PowersOfTwo_ilogb) { - test_powers_of_two(&__llvm_libc::ilogb); + test_powers_of_two(&LIBC_NAMESPACE::ilogb); } TEST_F(LlvmLibcILogbTest, SomeIntegers_ilogb) { - test_some_integers(&__llvm_libc::ilogb); + test_some_integers(&LIBC_NAMESPACE::ilogb); } TEST_F(LlvmLibcILogbTest, SubnormalRange_ilogb) { - test_subnormal_range(&__llvm_libc::ilogb); + test_subnormal_range(&LIBC_NAMESPACE::ilogb); } TEST_F(LlvmLibcILogbTest, NormalRange_ilogb) { - test_normal_range(&__llvm_libc::ilogb); + test_normal_range(&LIBC_NAMESPACE::ilogb); } diff --git a/libc/test/src/math/smoke/ilogbf_test.cpp b/libc/test/src/math/smoke/ilogbf_test.cpp index 20904a13c98a81261fa8527ba06d4f40684ba1e6..dcff8eeb1518059570a7ab4c15fa544286d4b3e1 100644 --- a/libc/test/src/math/smoke/ilogbf_test.cpp +++ b/libc/test/src/math/smoke/ilogbf_test.cpp @@ -16,21 +16,21 @@ #include TEST_F(LlvmLibcILogbTest, SpecialNumbers_ilogbf) { - test_special_numbers(&__llvm_libc::ilogbf); + test_special_numbers(&LIBC_NAMESPACE::ilogbf); } TEST_F(LlvmLibcILogbTest, PowersOfTwo_ilogbf) { - test_powers_of_two(&__llvm_libc::ilogbf); + test_powers_of_two(&LIBC_NAMESPACE::ilogbf); } TEST_F(LlvmLibcILogbTest, SomeIntegers_ilogbf) { - test_some_integers(&__llvm_libc::ilogbf); + test_some_integers(&LIBC_NAMESPACE::ilogbf); } TEST_F(LlvmLibcILogbTest, SubnormalRange_ilogbf) { - test_subnormal_range(&__llvm_libc::ilogbf); + test_subnormal_range(&LIBC_NAMESPACE::ilogbf); } TEST_F(LlvmLibcILogbTest, NormalRange_ilogbf) { - test_normal_range(&__llvm_libc::ilogbf); + test_normal_range(&LIBC_NAMESPACE::ilogbf); } diff --git a/libc/test/src/math/smoke/ilogbl_test.cpp b/libc/test/src/math/smoke/ilogbl_test.cpp index 9647f232245dc3e8fb5bc3869643f8c68bea71bc..29a221ad7f08f7af922f607d72460f071108b4d3 100644 --- a/libc/test/src/math/smoke/ilogbl_test.cpp +++ b/libc/test/src/math/smoke/ilogbl_test.cpp @@ -16,21 +16,21 @@ #include TEST_F(LlvmLibcILogbTest, SpecialNumbers_ilogbl) { - test_special_numbers(&__llvm_libc::ilogbl); + test_special_numbers(&LIBC_NAMESPACE::ilogbl); } TEST_F(LlvmLibcILogbTest, PowersOfTwo_ilogbl) { - test_powers_of_two(&__llvm_libc::ilogbl); + test_powers_of_two(&LIBC_NAMESPACE::ilogbl); } TEST_F(LlvmLibcILogbTest, SomeIntegers_ilogbl) { - test_some_integers(&__llvm_libc::ilogbl); + test_some_integers(&LIBC_NAMESPACE::ilogbl); } TEST_F(LlvmLibcILogbTest, SubnormalRange_ilogbl) { - test_subnormal_range(&__llvm_libc::ilogbl); + test_subnormal_range(&LIBC_NAMESPACE::ilogbl); } TEST_F(LlvmLibcILogbTest, NormalRange_ilogbl) { - test_normal_range(&__llvm_libc::ilogbl); + test_normal_range(&LIBC_NAMESPACE::ilogbl); } diff --git a/libc/test/src/math/smoke/ldexp_test.cpp b/libc/test/src/math/smoke/ldexp_test.cpp index c078aa4b7ef84c714dd8d5e6dced446c105f9b60..aad580f95fb99d49932e9b1e703a000c764eef90 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 4fe80fc79151cd6bf43876579c65429be46f469f..f4cce37b9277dc58f0386eef73cd6e041bec5984 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 5e6e6e75ae0855b3f48bbb27f87c68aa06af398f..405e53390e8c34dafb3bbed89ae5b550d7894cb2 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 8027004bd50a5ddf0f977f108382f19da025d5dd..8cf7d92095891bf62298bdf7f52ea0124969029b 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 9ad710e4698350c58157a5a6ded1f9ee97e6ff9f..0d9d3c4111bb245091e10a6b5ea690a24148a4c7 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 948e961e57bd4d0500fbc9721ef7d6835ff2ad52..1ceb9fecc40391f7e0790f98fb0d9dd5e75c0055 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 c86095dc9aae03b5644b83c4decb46c639125850..bda2fca6e8659f303e08158b983af2de888b128a 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 5e36258c246ae13c2283d2d8dccf43da26d46626..a35b5fabbac34c3528e9df96119a67c2972b8dac 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 8fbc840c4f2acc7d885379b00766d0bc5577d6e5..e43d49f4cbe1bf3e5714c55002c0d552e05c96da 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 8a214748fb2e0b4849a86f4b103bb07e1cc6ec70..be4900a6a4dd6be1be0e02b7966ebcc985836f88 100644 --- a/libc/test/src/math/smoke/log10_test.cpp +++ b/libc/test/src/math/smoke/log10_test.cpp @@ -16,21 +16,23 @@ #include #include -using __llvm_libc::testing::tlog; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(double) TEST(LlvmLibcLog10Test, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::log10(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::log10(inf)); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log10(neg_inf), FE_INVALID); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log10(0.0), FE_DIVBYZERO); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log10(-0.0), FE_DIVBYZERO); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log10(-1.0), FE_INVALID); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log10(1.0)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log10(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log10(inf)); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log10(neg_inf), FE_INVALID); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log10(0.0), + FE_DIVBYZERO); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log10(-0.0), + FE_DIVBYZERO); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log10(-1.0), FE_INVALID); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log10(1.0)); double x = 1.0; for (int i = 0; i < 11; ++i, x *= 10.0) { - EXPECT_FP_EQ_ALL_ROUNDING(static_cast(i), __llvm_libc::log10(x)); + EXPECT_FP_EQ_ALL_ROUNDING(static_cast(i), LIBC_NAMESPACE::log10(x)); } } diff --git a/libc/test/src/math/smoke/log10f_test.cpp b/libc/test/src/math/smoke/log10f_test.cpp index d7838140bec27f015371dce6915152dd646834dd..2369ab0458847a206c2236355fdbacb5b826ce52 100644 --- a/libc/test/src/math/smoke/log10f_test.cpp +++ b/libc/test/src/math/smoke/log10f_test.cpp @@ -18,17 +18,18 @@ DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcLog10fTest, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::log10f(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::log10f(inf)); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log10f(neg_inf), FE_INVALID); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log10f(0.0f), FE_DIVBYZERO); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log10f(-0.0f), + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log10f(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log10f(inf)); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log10f(neg_inf), FE_INVALID); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log10f(0.0f), FE_DIVBYZERO); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log10f(-1.0f), FE_INVALID); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log10f(1.0f)); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log10f(-0.0f), + FE_DIVBYZERO); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log10f(-1.0f), FE_INVALID); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log10f(1.0f)); float x = 1.0f; for (int i = 0; i < 11; ++i, x *= 10.0f) { - EXPECT_FP_EQ_ALL_ROUNDING(static_cast(i), __llvm_libc::log10f(x)); + EXPECT_FP_EQ_ALL_ROUNDING(static_cast(i), LIBC_NAMESPACE::log10f(x)); } } diff --git a/libc/test/src/math/smoke/log1p_test.cpp b/libc/test/src/math/smoke/log1p_test.cpp index 14e1977e060e7e43a7b7d1fa16b51cb2c0b167bd..9cb0cf17ff797de22fd3c7aa88699358996919ef 100644 --- a/libc/test/src/math/smoke/log1p_test.cpp +++ b/libc/test/src/math/smoke/log1p_test.cpp @@ -16,16 +16,17 @@ #include #include -using __llvm_libc::testing::tlog; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(double) TEST(LlvmLibcLog1pTest, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::log1p(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::log1p(inf)); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log1p(neg_inf), FE_INVALID); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log1p(-2.0), FE_INVALID); - EXPECT_FP_EQ(zero, __llvm_libc::log1p(0.0)); - EXPECT_FP_EQ(neg_zero, __llvm_libc::log1p(-0.0)); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log1p(-1.0), FE_DIVBYZERO); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log1p(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log1p(inf)); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log1p(neg_inf), FE_INVALID); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log1p(-2.0), FE_INVALID); + EXPECT_FP_EQ(zero, LIBC_NAMESPACE::log1p(0.0)); + EXPECT_FP_EQ(neg_zero, LIBC_NAMESPACE::log1p(-0.0)); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log1p(-1.0), + FE_DIVBYZERO); } diff --git a/libc/test/src/math/smoke/log1pf_test.cpp b/libc/test/src/math/smoke/log1pf_test.cpp index 22043ba6e278de0f2ba80184814b8043770d24b6..983601024371508ed0aaa0a479809dbbca7d7143 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 2726a6b1c3a72675a6dd3c241c7773e3869c3040..dab8929115d72600c270a39c096a8961604d5fbf 100644 --- a/libc/test/src/math/smoke/log2_test.cpp +++ b/libc/test/src/math/smoke/log2_test.cpp @@ -16,16 +16,17 @@ #include #include -using __llvm_libc::testing::tlog; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(double) TEST(LlvmLibcLog2Test, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::log2(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::log2(inf)); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log2(neg_inf), FE_INVALID); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log2(0.0), FE_DIVBYZERO); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log2(-0.0), FE_DIVBYZERO); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log2(-1.0), FE_INVALID); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log2(1.0)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log2(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log2(inf)); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log2(neg_inf), FE_INVALID); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log2(0.0), FE_DIVBYZERO); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log2(-0.0), + FE_DIVBYZERO); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log2(-1.0), FE_INVALID); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log2(1.0)); } diff --git a/libc/test/src/math/smoke/log2f_test.cpp b/libc/test/src/math/smoke/log2f_test.cpp index 6b05e6cc715ebe3b46e4402b13cf109b3354e530..d388230a801591e84cb117c9fbb579db8e988c47 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 4277123214a67f49475c27f6c16bbddfbed0cd21..34d608a81a14e0b9f022a44b9f3fe8b0436c05eb 100644 --- a/libc/test/src/math/smoke/log_test.cpp +++ b/libc/test/src/math/smoke/log_test.cpp @@ -16,16 +16,16 @@ #include #include -using __llvm_libc::testing::tlog; +using LIBC_NAMESPACE::testing::tlog; DECLARE_SPECIAL_CONSTANTS(double) TEST(LlvmLibcLogTest, SpecialNumbers) { - EXPECT_FP_EQ(aNaN, __llvm_libc::log(aNaN)); - EXPECT_FP_EQ(inf, __llvm_libc::log(inf)); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log(neg_inf), FE_INVALID); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log(0.0), FE_DIVBYZERO); - EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, __llvm_libc::log(-0.0), FE_DIVBYZERO); - EXPECT_FP_IS_NAN_WITH_EXCEPTION(__llvm_libc::log(-1.0), FE_INVALID); - EXPECT_FP_EQ_ALL_ROUNDING(zero, __llvm_libc::log(1.0)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::log(aNaN)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::log(inf)); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log(neg_inf), FE_INVALID); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log(0.0), FE_DIVBYZERO); + EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::log(-0.0), FE_DIVBYZERO); + EXPECT_FP_IS_NAN_WITH_EXCEPTION(LIBC_NAMESPACE::log(-1.0), FE_INVALID); + EXPECT_FP_EQ_ALL_ROUNDING(zero, LIBC_NAMESPACE::log(1.0)); } diff --git a/libc/test/src/math/smoke/logb_test.cpp b/libc/test/src/math/smoke/logb_test.cpp index b90348522aa3aa6785760edc3713fc15ad8e0183..2dc56c2e613ccb2ea3e0f1e07c0b35b2b06bf880 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 727eefffbb1740c9d8e20f1e38040fe512891fcb..c25485ca78b065b3bcf4a665f0a5a942ba52a3ea 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 1c7b0d4e66e84ec6cc3eea3eb5cc24b3b164cd4c..b26cee65783c42037c2d8d002685945927c589b5 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 20fa51735ad75b4b206e1178fa00de3406c82d80..0edaa8da556e2820ced1e755213814f4c2be4b47 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 0dbfa3dd466d99fc1fe5618f703cc98950b1fc97..9cff2661225361a28f0a086bbac867091e5e8c52 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 407813aa83c0feb0a5e5c1cdf4221c4736fb16ed..9c696a39e6928cb8122555491037cf3b8d5d31b7 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 a4551c38de10663c60b549d148615db8f3ee0f2a..e44dd30d2c6cccca3f00685c63acfca625ed6a0a 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 0ee580f316b44ac4a0e768535514b95dfc6c2fb0..1fb2fc71e20ccbb311136b0fc1f4025b118fb6e6 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 7a2aad20e4f664bd6e9f71e94b814cae0198b3c8..38fe5c7d1a52dc574bba119cae188db768da54e1 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 c0ea339782052360f2602d7940611d938e3ea07b..8a29ba95a61732dc541552dec8876b6c8b2250c9 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 ff89517506b4f274e93894f3a821414abd508ce8..b4b03bad848de57ae945402d586be3b7e9d5b816 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 440304ab95ac78f1e285883b20f336f26e12dad4..068dbc3f5313590cd3809e59795d8402efa4fb58 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 c98678b3e9243e3921dbc94d32d2570edb2bd8fc..ae8a72642c5871e734b31d08d637ee0d454c0f70 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 2dde48ceb053c6c8a1d708f2ad4ba1cf0b0a7375..998b19fb1dccd375a294f16071340478d7879a54 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 14234c717797eb50829da0cd9640cc230d13a3df..31770bc591ec1fab0a7d7fa1fb0a42a2946680d4 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 db85d83edc690ef61602505cfdbf7bf121b7d14b..4c8577f2690a1fdb000deb6b23bb1f180ebb1c76 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 8efec397f39d33b6285df6a6dfe439c77c42ed69..4358331a8f76e2b87e5c1cf7e7833741c5c6bbcd 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 1af4ba4e0153b559957399fbd2ee219d5a045261..590b4ffb4595fdf0432126383156c35d6adcc948 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 e4438e83fe18ce1f5291a0dde07843c667b8de8c..ae2db449304105496a29314d3136dadd85d927ec 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 eafa1a7fe6119fe52644274cd8d0d7b5d601505a..9c89b7acec56d5e5127fa288708311394be92292 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 c15a697fac9208c863cedd502e05ad582d46d2cf..f875bab2556cadd11007f6d2168626ee5fd00804 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 6c50873a272d046a791620de4b4a5689fe23c022..458ca05a985af5772ee2db44a5a81e8f76504de9 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 87ce079e89afc29560198b88e4e5c1d7e2a308c2..dbcb56717e208339bddb78b93b1cb56d606cc1ea 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 0a182dd02deee6fea6e7b34ac564b9e5e71004e4..053596a16e22f6c595f440f4094c4ae766456565 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 32cf724fb7c4f3baf8919779d2527058fb5e250d..2a2a213a8181cdaead38056692c487dca5836ac5 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 d4d60bf8afca180c0fc982592f1830d6e5042c4b..413a2395ca3c57d3a997ce641a029c8646080a01 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 cbf2e7e1361e10cccef05bb134920ac64a36ea76..e97781c2b2354643215fa27261dcbe9f0d65dcea 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 197887b2448c057f625ec95fe57d6164a47addca..b0e0053790902491845f33311d2d83a7e4277511 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 102a50c428d26ac3a539a48f44efe77a3e7addcf..4e2b1c69e41877e19ee93f312eaf277ab9182d7c 100644 --- a/libc/test/src/math/smoke/sincosf_test.cpp +++ b/libc/test/src/math/smoke/sincosf_test.cpp @@ -16,7 +16,7 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; DECLARE_SPECIAL_CONSTANTS(float) @@ -24,27 +24,27 @@ TEST(LlvmLibcSinCosfTest, SpecialNumbers) { libc_errno = 0; float sin, cos; - __llvm_libc::sincosf(aNaN, &sin, &cos); + LIBC_NAMESPACE::sincosf(aNaN, &sin, &cos); EXPECT_FP_EQ(aNaN, cos); EXPECT_FP_EQ(aNaN, sin); EXPECT_MATH_ERRNO(0); - __llvm_libc::sincosf(0.0f, &sin, &cos); + LIBC_NAMESPACE::sincosf(0.0f, &sin, &cos); EXPECT_FP_EQ(1.0f, cos); EXPECT_FP_EQ(0.0f, sin); EXPECT_MATH_ERRNO(0); - __llvm_libc::sincosf(-0.0f, &sin, &cos); + LIBC_NAMESPACE::sincosf(-0.0f, &sin, &cos); EXPECT_FP_EQ(1.0f, cos); EXPECT_FP_EQ(-0.0f, sin); EXPECT_MATH_ERRNO(0); - __llvm_libc::sincosf(inf, &sin, &cos); + LIBC_NAMESPACE::sincosf(inf, &sin, &cos); EXPECT_FP_EQ(aNaN, cos); EXPECT_FP_EQ(aNaN, sin); EXPECT_MATH_ERRNO(EDOM); - __llvm_libc::sincosf(neg_inf, &sin, &cos); + LIBC_NAMESPACE::sincosf(neg_inf, &sin, &cos); EXPECT_FP_EQ(aNaN, cos); EXPECT_FP_EQ(aNaN, sin); EXPECT_MATH_ERRNO(EDOM); diff --git a/libc/test/src/math/smoke/sinf_test.cpp b/libc/test/src/math/smoke/sinf_test.cpp index e67062d74190bb90e195984afca89b8cd13bbc47..b93011bbdc2baf7711cf3d8903918ae584433b21 100644 --- a/libc/test/src/math/smoke/sinf_test.cpp +++ b/libc/test/src/math/smoke/sinf_test.cpp @@ -16,25 +16,25 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcSinfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ(aNaN, __llvm_libc::sinf(aNaN)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(0.0f, __llvm_libc::sinf(0.0f)); + EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::sinf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(-0.0f, __llvm_libc::sinf(-0.0f)); + EXPECT_FP_EQ(-0.0f, LIBC_NAMESPACE::sinf(-0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(aNaN, __llvm_libc::sinf(inf)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinf(inf)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ(aNaN, __llvm_libc::sinf(neg_inf)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinf(neg_inf)); EXPECT_MATH_ERRNO(EDOM); } diff --git a/libc/test/src/math/smoke/sinhf_test.cpp b/libc/test/src/math/smoke/sinhf_test.cpp index 5926ea647490bc213da4eeaff741a07863494d2e..b2b6bddf91c2a5804000fba7802748f2378dd44b 100644 --- a/libc/test/src/math/smoke/sinhf_test.cpp +++ b/libc/test/src/math/smoke/sinhf_test.cpp @@ -17,51 +17,51 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcSinhfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ(aNaN, __llvm_libc::sinhf(aNaN)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::sinhf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(0.0f, __llvm_libc::sinhf(0.0f)); + EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::sinhf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(-0.0f, __llvm_libc::sinhf(-0.0f)); + EXPECT_FP_EQ(-0.0f, LIBC_NAMESPACE::sinhf(-0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(inf, __llvm_libc::sinhf(inf)); + EXPECT_FP_EQ(inf, LIBC_NAMESPACE::sinhf(inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(neg_inf, __llvm_libc::sinhf(neg_inf)); + EXPECT_FP_EQ(neg_inf, LIBC_NAMESPACE::sinhf(neg_inf)); EXPECT_MATH_ERRNO(0); } // For small values, sinh(x) is x. TEST(LlvmLibcSinhfTest, SmallValues) { float x = float(FPBits(uint32_t(0x17800000))); - float result = __llvm_libc::sinhf(x); + float result = LIBC_NAMESPACE::sinhf(x); EXPECT_FP_EQ(x, result); x = float(FPBits(uint32_t(0x00400000))); - result = __llvm_libc::sinhf(x); + result = LIBC_NAMESPACE::sinhf(x); EXPECT_FP_EQ(x, result); } TEST(LlvmLibcSinhfTest, Overflow) { libc_errno = 0; EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::sinhf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::sinhf(float(FPBits(0x7f7fffffU))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::sinhf(float(FPBits(0x42cffff8U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::sinhf(float(FPBits(0x42cffff8U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); EXPECT_FP_EQ_WITH_EXCEPTION( - inf, __llvm_libc::sinhf(float(FPBits(0x42d00008U))), FE_OVERFLOW); + inf, LIBC_NAMESPACE::sinhf(float(FPBits(0x42d00008U))), FE_OVERFLOW); EXPECT_MATH_ERRNO(ERANGE); } diff --git a/libc/test/src/math/smoke/sqrt_test.cpp b/libc/test/src/math/smoke/sqrt_test.cpp index 237264895bbd26ba8f3ea69a5130af4f503d3cfd..1551b31d6f715fd1f53d1fa71b782830e1243b0e 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 c7681d01569ae7307d2601e6129a75509e3d03b5..3f2e973325bd0f262324a280c7f94af1c41b5b63 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 c48ebb08444d051b65f4142defdb62651768eb31..f80bcfb73607824c68a89cf70d7dd94390649dc9 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 62cc42c0bef1a485e5fa0dabac5b5fd6f634bc92..60444b3ad15cc0ec6f7c05a78c54e5ef60766d9a 100644 --- a/libc/test/src/math/smoke/tanf_test.cpp +++ b/libc/test/src/math/smoke/tanf_test.cpp @@ -16,25 +16,25 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcTanfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ(aNaN, __llvm_libc::tanf(aNaN)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::tanf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(0.0f, __llvm_libc::tanf(0.0f)); + EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::tanf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(-0.0f, __llvm_libc::tanf(-0.0f)); + EXPECT_FP_EQ(-0.0f, LIBC_NAMESPACE::tanf(-0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(aNaN, __llvm_libc::tanf(inf)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::tanf(inf)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ(aNaN, __llvm_libc::tanf(neg_inf)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::tanf(neg_inf)); EXPECT_MATH_ERRNO(EDOM); } diff --git a/libc/test/src/math/smoke/tanhf_test.cpp b/libc/test/src/math/smoke/tanhf_test.cpp index 0152de2f5ea04ccf769cab0f4f646ea6dad8d103..db20be724b53f4ad200aff4181238ad30e0ece12 100644 --- a/libc/test/src/math/smoke/tanhf_test.cpp +++ b/libc/test/src/math/smoke/tanhf_test.cpp @@ -16,25 +16,25 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcTanhfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ(aNaN, __llvm_libc::tanhf(aNaN)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::tanhf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(0.0f, __llvm_libc::tanhf(0.0f)); + EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::tanhf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(-0.0f, __llvm_libc::tanhf(-0.0f)); + EXPECT_FP_EQ(-0.0f, LIBC_NAMESPACE::tanhf(-0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(1.0f, __llvm_libc::tanhf(inf)); + EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::tanhf(inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(-1.0f, __llvm_libc::tanhf(neg_inf)); + EXPECT_FP_EQ(-1.0f, LIBC_NAMESPACE::tanhf(neg_inf)); EXPECT_MATH_ERRNO(0); } diff --git a/libc/test/src/math/smoke/trunc_test.cpp b/libc/test/src/math/smoke/trunc_test.cpp index f0a808dcb23684c6c9d9b94f7be696a947513ac3..eb71f23e02f4b2009d995902e3ce58dfb9005bd6 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 cbd672cfe2e21efcabb6226d6aea2c53326a798d..9a85b8274b0e5c11fbdb798d4313d3cdbb871036 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 0cf9ab8cd5575ba340034babd313e78e30b7fc4a..d296bfe33cb077fc844e9633c1fccae8e4df721f 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 237264895bbd26ba8f3ea69a5130af4f503d3cfd..1551b31d6f715fd1f53d1fa71b782830e1243b0e 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 c7681d01569ae7307d2601e6129a75509e3d03b5..3f2e973325bd0f262324a280c7f94af1c41b5b63 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 c48ebb08444d051b65f4142defdb62651768eb31..f80bcfb73607824c68a89cf70d7dd94390649dc9 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 b22d49ef5f432ada2a48cf2681ff8a4fc6bd0e74..a6f7dcb4329303e4db5a3209583d7148aa9793c2 100644 --- a/libc/test/src/math/tan_test.cpp +++ b/libc/test/src/math/tan_test.cpp @@ -13,7 +13,7 @@ #include -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(double) @@ -27,6 +27,6 @@ TEST(LlvmLibctanTest, Range) { if (isnan(x) || isinf(x) || x > _2pi || x < -_2pi) continue; - ASSERT_MPFR_MATCH(mpfr::Operation::Tan, x, __llvm_libc::tan(x), 1.0); + ASSERT_MPFR_MATCH(mpfr::Operation::Tan, x, LIBC_NAMESPACE::tan(x), 1.0); } } diff --git a/libc/test/src/math/tanf_test.cpp b/libc/test/src/math/tanf_test.cpp index 37a1bba68412ab5defeb9761faec915d1fb8d98b..3c3694a5eb684754bc720a2072f7cba759a33d05 100644 --- a/libc/test/src/math/tanf_test.cpp +++ b/libc/test/src/math/tanf_test.cpp @@ -18,29 +18,29 @@ #include #include -using __llvm_libc::testing::SDCOMP26094_VALUES; -using FPBits = __llvm_libc::fputil::FPBits; +using LIBC_NAMESPACE::testing::SDCOMP26094_VALUES; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcTanfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ(aNaN, __llvm_libc::tanf(aNaN)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::tanf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(0.0f, __llvm_libc::tanf(0.0f)); + EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::tanf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(-0.0f, __llvm_libc::tanf(-0.0f)); + EXPECT_FP_EQ(-0.0f, LIBC_NAMESPACE::tanf(-0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(aNaN, __llvm_libc::tanf(inf)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::tanf(inf)); EXPECT_MATH_ERRNO(EDOM); - EXPECT_FP_EQ(aNaN, __llvm_libc::tanf(neg_inf)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::tanf(neg_inf)); EXPECT_MATH_ERRNO(EDOM); } @@ -52,7 +52,7 @@ TEST(LlvmLibcTanfTest, InFloatRange) { if (isnan(x) || isinf(x)) continue; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Tan, x, - __llvm_libc::tanf(x), 0.5); + LIBC_NAMESPACE::tanf(x), 0.5); } } @@ -118,9 +118,9 @@ TEST(LlvmLibcTanfTest, SpecificBitPatterns) { for (int i = 0; i < N; ++i) { float x = float(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Tan, x, - __llvm_libc::tanf(x), 0.5); + LIBC_NAMESPACE::tanf(x), 0.5); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Tan, -x, - __llvm_libc::tanf(-x), 0.5); + LIBC_NAMESPACE::tanf(-x), 0.5); } } @@ -129,6 +129,6 @@ TEST(LlvmLibcTanfTest, SpecificBitPatterns) { TEST(LlvmLibcTanfTest, SDCOMP_26094) { for (uint32_t v : SDCOMP26094_VALUES) { float x = float(FPBits(v)); - ASSERT_MPFR_MATCH(mpfr::Operation::Tan, x, __llvm_libc::tanf(x), 0.5); + ASSERT_MPFR_MATCH(mpfr::Operation::Tan, x, LIBC_NAMESPACE::tanf(x), 0.5); } } diff --git a/libc/test/src/math/tanhf_test.cpp b/libc/test/src/math/tanhf_test.cpp index 07afe14a263d0248bfc89761abba4bacd9efe4a6..06ad02c3370940c2cbe91ad91d7a1a9c4eef65be 100644 --- a/libc/test/src/math/tanhf_test.cpp +++ b/libc/test/src/math/tanhf_test.cpp @@ -17,28 +17,28 @@ #include #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; -namespace mpfr = __llvm_libc::testing::mpfr; +namespace mpfr = LIBC_NAMESPACE::testing::mpfr; DECLARE_SPECIAL_CONSTANTS(float) TEST(LlvmLibcTanhfTest, SpecialNumbers) { libc_errno = 0; - EXPECT_FP_EQ(aNaN, __llvm_libc::tanhf(aNaN)); + EXPECT_FP_EQ(aNaN, LIBC_NAMESPACE::tanhf(aNaN)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(0.0f, __llvm_libc::tanhf(0.0f)); + EXPECT_FP_EQ(0.0f, LIBC_NAMESPACE::tanhf(0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(-0.0f, __llvm_libc::tanhf(-0.0f)); + EXPECT_FP_EQ(-0.0f, LIBC_NAMESPACE::tanhf(-0.0f)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(1.0f, __llvm_libc::tanhf(inf)); + EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::tanhf(inf)); EXPECT_MATH_ERRNO(0); - EXPECT_FP_EQ(-1.0f, __llvm_libc::tanhf(neg_inf)); + EXPECT_FP_EQ(-1.0f, LIBC_NAMESPACE::tanhf(neg_inf)); EXPECT_MATH_ERRNO(0); } @@ -50,7 +50,7 @@ TEST(LlvmLibcTanhfTest, InFloatRange) { if (isnan(x) || isinf(x)) continue; ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Tanh, x, - __llvm_libc::tanhf(x), 0.5); + LIBC_NAMESPACE::tanhf(x), 0.5); } } @@ -66,8 +66,8 @@ TEST(LlvmLibcTanhfTest, ExceptionalValues) { for (int i = 0; i < N; ++i) { float x = float(FPBits(INPUTS[i])); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Tanh, x, - __llvm_libc::tanhf(x), 0.5); + LIBC_NAMESPACE::tanhf(x), 0.5); EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Tanh, -x, - __llvm_libc::tanhf(-x), 0.5); + LIBC_NAMESPACE::tanhf(-x), 0.5); } } diff --git a/libc/test/src/math/trunc_test.cpp b/libc/test/src/math/trunc_test.cpp index f0a808dcb23684c6c9d9b94f7be696a947513ac3..eb71f23e02f4b2009d995902e3ce58dfb9005bd6 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 cbd672cfe2e21efcabb6226d6aea2c53326a798d..9a85b8274b0e5c11fbdb798d4313d3cdbb871036 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 0cf9ab8cd5575ba340034babd313e78e30b7fc4a..d296bfe33cb077fc844e9633c1fccae8e4df721f 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 a8363d20d9767b93b48e8e84fc54efd8ff62674c..d3b930d0b1ea24c416dceaa7d20f5dd68e53b22c 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 f9bd77bad25d872e7bb745a06fb1f9a8df6d5180..d38fab8153b97c70bcdbef49c4a709a62b17b10a 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 bc52a97c87672039a1ffde0380f16628a80a8d5f..b06f8e19e4f45bd6a233eaec4d14dc29c56802a6 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 f10c2465539325c0e72e95c29a490b76931cf62d..654a39662ac9ce1d6a941d95337fd1e29662b351 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 af9f5d07f1155309c9ad1c6a14647e4b2a46fdbb..1af585a003e3b0ab5cdd4247b4f5477fbbea275e 100644 --- a/libc/test/src/pthread/pthread_attr_test.cpp +++ b/libc/test/src/pthread/pthread_attr_test.cpp @@ -25,89 +25,95 @@ TEST(LlvmLibcPThreadAttrTest, InitAndDestroy) { pthread_attr_t attr; - ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0); int detachstate; - ASSERT_EQ(__llvm_libc::pthread_attr_getdetachstate(&attr, &detachstate), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_getdetachstate(&attr, &detachstate), + 0); ASSERT_EQ(detachstate, int(PTHREAD_CREATE_JOINABLE)); size_t guardsize; - ASSERT_EQ(__llvm_libc::pthread_attr_getguardsize(&attr, &guardsize), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_getguardsize(&attr, &guardsize), 0); ASSERT_EQ(guardsize, size_t(EXEC_PAGESIZE)); - ASSERT_EQ(__llvm_libc::pthread_attr_destroy(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_destroy(&attr), 0); } TEST(LlvmLibcPThreadattrTest, SetAndGetDetachState) { pthread_attr_t attr; - ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0); int detachstate; - __llvm_libc::pthread_attr_getdetachstate(&attr, &detachstate); + LIBC_NAMESPACE::pthread_attr_getdetachstate(&attr, &detachstate); ASSERT_EQ(detachstate, int(PTHREAD_CREATE_JOINABLE)); - ASSERT_EQ( - __llvm_libc::pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED), - 0); - ASSERT_EQ(__llvm_libc::pthread_attr_getdetachstate(&attr, &detachstate), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setdetachstate( + &attr, PTHREAD_CREATE_DETACHED), + 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_getdetachstate(&attr, &detachstate), + 0); ASSERT_EQ(detachstate, int(PTHREAD_CREATE_DETACHED)); - ASSERT_EQ(__llvm_libc::pthread_attr_setdetachstate(&attr, 0xBAD), EINVAL); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setdetachstate(&attr, 0xBAD), EINVAL); - ASSERT_EQ(__llvm_libc::pthread_attr_destroy(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_destroy(&attr), 0); } TEST(LlvmLibcPThreadattrTest, SetAndGetGuardSize) { pthread_attr_t attr; - ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0); size_t guardsize; - ASSERT_EQ(__llvm_libc::pthread_attr_getguardsize(&attr, &guardsize), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_getguardsize(&attr, &guardsize), 0); ASSERT_EQ(guardsize, size_t(EXEC_PAGESIZE)); - ASSERT_EQ(__llvm_libc::pthread_attr_setguardsize(&attr, 2 * EXEC_PAGESIZE), + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setguardsize(&attr, 2 * EXEC_PAGESIZE), 0); - ASSERT_EQ(__llvm_libc::pthread_attr_getguardsize(&attr, &guardsize), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_getguardsize(&attr, &guardsize), 0); ASSERT_EQ(guardsize, size_t(2 * EXEC_PAGESIZE)); - ASSERT_EQ(__llvm_libc::pthread_attr_setguardsize(&attr, EXEC_PAGESIZE / 2), + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setguardsize(&attr, EXEC_PAGESIZE / 2), EINVAL); - ASSERT_EQ(__llvm_libc::pthread_attr_destroy(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_destroy(&attr), 0); } TEST(LlvmLibcPThreadattrTest, SetAndGetStackSize) { pthread_attr_t attr; - ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0); size_t stacksize; ASSERT_EQ( - __llvm_libc::pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN << 2), 0); - ASSERT_EQ(__llvm_libc::pthread_attr_getstacksize(&attr, &stacksize), 0); + LIBC_NAMESPACE::pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN << 2), + 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_getstacksize(&attr, &stacksize), 0); ASSERT_EQ(stacksize, size_t(PTHREAD_STACK_MIN << 2)); ASSERT_EQ( - __llvm_libc::pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN / 2), + LIBC_NAMESPACE::pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN / 2), EINVAL); - ASSERT_EQ(__llvm_libc::pthread_attr_destroy(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_destroy(&attr), 0); } TEST(LlvmLibcPThreadattrTest, SetAndGetStack) { pthread_attr_t attr; - ASSERT_EQ(__llvm_libc::pthread_attr_init(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_init(&attr), 0); void *stack; size_t stacksize; ASSERT_EQ( - __llvm_libc::pthread_attr_setstack(&attr, 0, PTHREAD_STACK_MIN << 2), 0); - ASSERT_EQ(__llvm_libc::pthread_attr_getstack(&attr, &stack, &stacksize), 0); + LIBC_NAMESPACE::pthread_attr_setstack(&attr, 0, PTHREAD_STACK_MIN << 2), + 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_getstack(&attr, &stack, &stacksize), + 0); ASSERT_EQ(stacksize, size_t(PTHREAD_STACK_MIN << 2)); ASSERT_EQ(reinterpret_cast(stack), uintptr_t(0)); - ASSERT_EQ(__llvm_libc::pthread_attr_setstack( + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_setstack( &attr, reinterpret_cast(1), PTHREAD_STACK_MIN << 2), EINVAL); - ASSERT_EQ(__llvm_libc::pthread_attr_setstack(&attr, 0, PTHREAD_STACK_MIN / 2), - EINVAL); + ASSERT_EQ( + LIBC_NAMESPACE::pthread_attr_setstack(&attr, 0, PTHREAD_STACK_MIN / 2), + EINVAL); - ASSERT_EQ(__llvm_libc::pthread_attr_destroy(&attr), 0); + ASSERT_EQ(LIBC_NAMESPACE::pthread_attr_destroy(&attr), 0); } diff --git a/libc/test/src/pthread/pthread_mutexattr_test.cpp b/libc/test/src/pthread/pthread_mutexattr_test.cpp index 3ecbc4f5896a4650c4bf0f06339bc9b3b6a911bf..a7acd580a6b8e55aee39740b9cb8eb54d0c35297 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 ca2821bc2bafefe9a0109476886c1c5fc3928e54..38433edecbd0c0608f3a2c585d7b130a5ca109ec 100644 --- a/libc/test/src/sched/affinity_test.cpp +++ b/libc/test/src/sched/affinity_test.cpp @@ -18,27 +18,29 @@ TEST(LlvmLibcSchedAffinityTest, SmokeTest) { cpu_set_t mask; libc_errno = 0; - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; - pid_t tid = __llvm_libc::syscall_impl(SYS_gettid); + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; + pid_t tid = LIBC_NAMESPACE::syscall_impl(SYS_gettid); ASSERT_GT(tid, pid_t(0)); // We just get and set the same mask. - ASSERT_THAT(__llvm_libc::sched_getaffinity(tid, sizeof(cpu_set_t), &mask), + ASSERT_THAT(LIBC_NAMESPACE::sched_getaffinity(tid, sizeof(cpu_set_t), &mask), Succeeds(0)); - ASSERT_THAT(__llvm_libc::sched_setaffinity(tid, sizeof(cpu_set_t), &mask), + ASSERT_THAT(LIBC_NAMESPACE::sched_setaffinity(tid, sizeof(cpu_set_t), &mask), Succeeds(0)); } TEST(LlvmLibcSchedAffinityTest, BadMask) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - pid_t tid = __llvm_libc::syscall_impl(SYS_gettid); + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + pid_t tid = LIBC_NAMESPACE::syscall_impl(SYS_gettid); libc_errno = 0; - ASSERT_THAT(__llvm_libc::sched_getaffinity(tid, sizeof(cpu_set_t), nullptr), - Fails(EFAULT)); + ASSERT_THAT( + LIBC_NAMESPACE::sched_getaffinity(tid, sizeof(cpu_set_t), nullptr), + Fails(EFAULT)); libc_errno = 0; - ASSERT_THAT(__llvm_libc::sched_setaffinity(tid, sizeof(cpu_set_t), nullptr), - Fails(EFAULT)); + ASSERT_THAT( + LIBC_NAMESPACE::sched_setaffinity(tid, sizeof(cpu_set_t), nullptr), + Fails(EFAULT)); libc_errno = 0; } diff --git a/libc/test/src/sched/cpu_count_test.cpp b/libc/test/src/sched/cpu_count_test.cpp index 4c047779baed52432ee7696f1e662b716ff35e08..ca3e80818a5c14902ea8a233890608c77509aa0e 100644 --- a/libc/test/src/sched/cpu_count_test.cpp +++ b/libc/test/src/sched/cpu_count_test.cpp @@ -18,15 +18,15 @@ TEST(LlvmLibcSchedCpuCountTest, SmokeTest) { cpu_set_t mask; libc_errno = 0; - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; - pid_t tid = __llvm_libc::syscall_impl(SYS_gettid); + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; + pid_t tid = LIBC_NAMESPACE::syscall_impl(SYS_gettid); ASSERT_GT(tid, pid_t(0)); - ASSERT_THAT(__llvm_libc::sched_getaffinity(tid, sizeof(cpu_set_t), &mask), + ASSERT_THAT(LIBC_NAMESPACE::sched_getaffinity(tid, sizeof(cpu_set_t), &mask), Succeeds(0)); // CPU_COUNT is a macro, but it expands to an LLVM-libc internal function that // needs to be in the appropriate namespace for the test. - int num_cpus = __llvm_libc::CPU_COUNT(&mask); + int num_cpus = LIBC_NAMESPACE::CPU_COUNT(&mask); ASSERT_GT(num_cpus, 0); ASSERT_LE(num_cpus, int(sizeof(cpu_set_t) * sizeof(unsigned long))); } diff --git a/libc/test/src/sched/get_priority_test.cpp b/libc/test/src/sched/get_priority_test.cpp index 15ee958ec16f44f23f77c2499cd2f61fb4a3594e..3a79a67802cf3e9c3dd2aec65270a11bfbaa9b53 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 2c5745432f579a2ab0554d06ddd8267242bfaf4a..8c6485f0789712575918e446754e4492c8583857 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 160ccd5025967e3129b2baa6da3593365a26ddc6..100100079504165eb3d65a307e2660cf21e8a84f 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 ffa7f667cadffb8b3fbec0f4389cd791951aa406..45b7a7d2d81e47abfb7a08d9bb4447eccc26f69d 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 3a8e22a68deda34ad4da10ded2aa228cce97023c..9e5f74a1734b3535e6aadd8645a29ab0ab516d22 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 ea98724dd09682ef81c2ae628f8312e9087c1278..2033543c97a2b496729d03a6e6e5e4ed1a3ece39 100644 --- a/libc/test/src/signal/kill_test.cpp +++ b/libc/test/src/signal/kill_test.cpp @@ -15,16 +15,16 @@ #include #include // For syscall numbers. -using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; TEST(LlvmLibcKillTest, TargetSelf) { - pid_t parent_pid = __llvm_libc::syscall_impl(SYS_getpid); - ASSERT_THAT(__llvm_libc::kill(parent_pid, 0), Succeeds(0)); + pid_t parent_pid = LIBC_NAMESPACE::syscall_impl(SYS_getpid); + ASSERT_THAT(LIBC_NAMESPACE::kill(parent_pid, 0), Succeeds(0)); EXPECT_DEATH( [] { - pid_t child_pid = __llvm_libc::syscall_impl(SYS_getpid); - __llvm_libc::kill(child_pid, SIGKILL); + pid_t child_pid = LIBC_NAMESPACE::syscall_impl(SYS_getpid); + LIBC_NAMESPACE::kill(child_pid, SIGKILL); }, WITH_SIGNAL(SIGKILL)); } diff --git a/libc/test/src/signal/raise_test.cpp b/libc/test/src/signal/raise_test.cpp index 080541ff2445a09ab09283404f777eb7e9f788fa..a114ac5e8379c8677f38b9fa2c825d0724d005bd 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 36160f9a37cef47b3d0a876b25c3a62be605c0dd..262469c7600e3fc1531d38113730fe594916d314 100644 --- a/libc/test/src/signal/sigaction_test.cpp +++ b/libc/test/src/signal/sigaction_test.cpp @@ -15,19 +15,20 @@ #include #include -using __llvm_libc::testing::ErrnoSetterMatcher::Fails; -using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; TEST(LlvmLibcSigaction, Invalid) { // -1 is a much larger signal that NSIG, so this should fail. - EXPECT_THAT(__llvm_libc::sigaction(-1, nullptr, nullptr), Fails(EINVAL)); + EXPECT_THAT(LIBC_NAMESPACE::sigaction(-1, nullptr, nullptr), Fails(EINVAL)); } // SIGKILL cannot have its action changed, but it can be examined. TEST(LlvmLibcSigaction, Sigkill) { struct sigaction action; - EXPECT_THAT(__llvm_libc::sigaction(SIGKILL, nullptr, &action), Succeeds()); - EXPECT_THAT(__llvm_libc::sigaction(SIGKILL, &action, nullptr), Fails(EINVAL)); + EXPECT_THAT(LIBC_NAMESPACE::sigaction(SIGKILL, nullptr, &action), Succeeds()); + EXPECT_THAT(LIBC_NAMESPACE::sigaction(SIGKILL, &action, nullptr), + Fails(EINVAL)); } static int sigusr1Count; @@ -38,29 +39,29 @@ TEST(LlvmLibcSigaction, CustomAction) { sigusr1Count = 0; struct sigaction action; - EXPECT_THAT(__llvm_libc::sigaction(SIGUSR1, nullptr, &action), Succeeds()); + EXPECT_THAT(LIBC_NAMESPACE::sigaction(SIGUSR1, nullptr, &action), Succeeds()); action.sa_handler = +[](int signal) { correctSignal = signal == SIGUSR1; sigusr1Count++; }; - EXPECT_THAT(__llvm_libc::sigaction(SIGUSR1, &action, nullptr), Succeeds()); + EXPECT_THAT(LIBC_NAMESPACE::sigaction(SIGUSR1, &action, nullptr), Succeeds()); - __llvm_libc::raise(SIGUSR1); + LIBC_NAMESPACE::raise(SIGUSR1); EXPECT_EQ(sigusr1Count, 1); EXPECT_TRUE(correctSignal); action.sa_handler = SIG_DFL; - EXPECT_THAT(__llvm_libc::sigaction(SIGUSR1, &action, nullptr), Succeeds()); + EXPECT_THAT(LIBC_NAMESPACE::sigaction(SIGUSR1, &action, nullptr), Succeeds()); - EXPECT_DEATH([] { __llvm_libc::raise(SIGUSR1); }, WITH_SIGNAL(SIGUSR1)); + EXPECT_DEATH([] { LIBC_NAMESPACE::raise(SIGUSR1); }, WITH_SIGNAL(SIGUSR1)); } TEST(LlvmLibcSigaction, Ignore) { struct sigaction action; - EXPECT_THAT(__llvm_libc::sigaction(SIGUSR1, nullptr, &action), Succeeds()); + EXPECT_THAT(LIBC_NAMESPACE::sigaction(SIGUSR1, nullptr, &action), Succeeds()); action.sa_handler = SIG_IGN; - EXPECT_THAT(__llvm_libc::sigaction(SIGUSR1, &action, nullptr), Succeeds()); + EXPECT_THAT(LIBC_NAMESPACE::sigaction(SIGUSR1, &action, nullptr), Succeeds()); - EXPECT_EXITS([] { __llvm_libc::raise(SIGUSR1); }, 0); + EXPECT_EXITS([] { LIBC_NAMESPACE::raise(SIGUSR1); }, 0); } diff --git a/libc/test/src/signal/sigaddset_test.cpp b/libc/test/src/signal/sigaddset_test.cpp index dbc0a617f4208ee90dd7fe858be6b2c4108eb4ad..ac9334f4ff68c0e78e1fcb53ddac6ed9099462f3 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 e52b3db59ddb0b87d3e7205380b3ae8aac760e45..5e1a3a4e2062c3594d2f30c2d22c033bd4854f6d 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 80f2459e223a618f9a733bd534b5dd23e42a86eb..aeae66f86bf88633457f1242ac0e7b71b684490a 100644 --- a/libc/test/src/signal/sigdelset_test.cpp +++ b/libc/test/src/signal/sigdelset_test.cpp @@ -18,20 +18,21 @@ #include TEST(LlvmLibcSigdelset, Invalid) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; // Invalid set. - EXPECT_THAT(__llvm_libc::sigdelset(nullptr, SIGUSR1), Fails(EINVAL)); + EXPECT_THAT(LIBC_NAMESPACE::sigdelset(nullptr, SIGUSR1), Fails(EINVAL)); sigset_t set; // Valid set, invalid signum. - EXPECT_THAT(__llvm_libc::sigdelset(&set, -1), Fails(EINVAL)); + EXPECT_THAT(LIBC_NAMESPACE::sigdelset(&set, -1), Fails(EINVAL)); } TEST(LlvmLibcSigdelset, UnblockOne) { - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; sigset_t set; - EXPECT_THAT(__llvm_libc::sigfillset(&set), Succeeds()); - EXPECT_THAT(__llvm_libc::sigdelset(&set, SIGUSR1), Succeeds()); - EXPECT_THAT(__llvm_libc::sigprocmask(SIG_SETMASK, &set, nullptr), Succeeds()); - EXPECT_DEATH([] { __llvm_libc::raise(SIGUSR1); }, WITH_SIGNAL(SIGUSR1)); + EXPECT_THAT(LIBC_NAMESPACE::sigfillset(&set), Succeeds()); + EXPECT_THAT(LIBC_NAMESPACE::sigdelset(&set, SIGUSR1), Succeeds()); + EXPECT_THAT(LIBC_NAMESPACE::sigprocmask(SIG_SETMASK, &set, nullptr), + Succeeds()); + EXPECT_DEATH([] { LIBC_NAMESPACE::raise(SIGUSR1); }, WITH_SIGNAL(SIGUSR1)); } diff --git a/libc/test/src/signal/sigfillset_test.cpp b/libc/test/src/signal/sigfillset_test.cpp index 52f1e27aa329030a202b5325b433ca7d142e4f16..7922b3a4e1190208197f042926c7858eaf5b6b68 100644 --- a/libc/test/src/signal/sigfillset_test.cpp +++ b/libc/test/src/signal/sigfillset_test.cpp @@ -17,14 +17,15 @@ #include TEST(LlvmLibcSigfillset, Invalid) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - EXPECT_THAT(__llvm_libc::sigfillset(nullptr), Fails(EINVAL)); + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + EXPECT_THAT(LIBC_NAMESPACE::sigfillset(nullptr), Fails(EINVAL)); } TEST(LlvmLibcSigfillset, BlocksAll) { - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; sigset_t set; - EXPECT_THAT(__llvm_libc::sigfillset(&set), Succeeds()); - EXPECT_THAT(__llvm_libc::sigprocmask(SIG_SETMASK, &set, nullptr), Succeeds()); - EXPECT_EXITS([] { __llvm_libc::raise(SIGUSR1); }, 0); + EXPECT_THAT(LIBC_NAMESPACE::sigfillset(&set), Succeeds()); + EXPECT_THAT(LIBC_NAMESPACE::sigprocmask(SIG_SETMASK, &set, nullptr), + Succeeds()); + EXPECT_EXITS([] { LIBC_NAMESPACE::raise(SIGUSR1); }, 0); } diff --git a/libc/test/src/signal/signal_test.cpp b/libc/test/src/signal/signal_test.cpp index 999933c2f8a424cc412dc64ea8f0e44310f52334..78f8bfbd719b1d0bc4df991e3c7de6f93466f95d 100644 --- a/libc/test/src/signal/signal_test.cpp +++ b/libc/test/src/signal/signal_test.cpp @@ -15,15 +15,15 @@ #include -using __llvm_libc::testing::ErrnoSetterMatcher::Fails; -using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; TEST(LlvmLibcSignal, Invalid) { libc_errno = 0; - __llvm_libc::sighandler_t valid = +[](int) {}; - EXPECT_THAT((void *)__llvm_libc::signal(0, valid), + LIBC_NAMESPACE::sighandler_t valid = +[](int) {}; + EXPECT_THAT((void *)LIBC_NAMESPACE::signal(0, valid), Fails(EINVAL, (void *)SIG_ERR)); - EXPECT_THAT((void *)__llvm_libc::signal(65, valid), + EXPECT_THAT((void *)LIBC_NAMESPACE::signal(65, valid), Fails(EINVAL, (void *)SIG_ERR)); } @@ -31,11 +31,12 @@ static int sum; TEST(LlvmLibcSignal, Basic) { // In case test get run multiple times. sum = 0; - ASSERT_NE(__llvm_libc::signal(SIGUSR1, +[](int) { sum++; }), + ASSERT_NE(LIBC_NAMESPACE::signal( + SIGUSR1, +[](int) { sum++; }), SIG_ERR); - ASSERT_THAT(__llvm_libc::raise(SIGUSR1), Succeeds()); + ASSERT_THAT(LIBC_NAMESPACE::raise(SIGUSR1), Succeeds()); EXPECT_EQ(sum, 1); for (int i = 0; i < 10; i++) - ASSERT_THAT(__llvm_libc::raise(SIGUSR1), Succeeds()); + ASSERT_THAT(LIBC_NAMESPACE::raise(SIGUSR1), Succeeds()); EXPECT_EQ(sum, 11); } diff --git a/libc/test/src/signal/sigprocmask_test.cpp b/libc/test/src/signal/sigprocmask_test.cpp index 3c334642ce0d38004d8bca93f2044001c9695d76..3e7e3a5c62db273f0daf7cee7d94e3c0dcd1be89 100644 --- a/libc/test/src/signal/sigprocmask_test.cpp +++ b/libc/test/src/signal/sigprocmask_test.cpp @@ -17,19 +17,19 @@ #include -class LlvmLibcSignalTest : public __llvm_libc::testing::Test { +class LlvmLibcSignalTest : public LIBC_NAMESPACE::testing::Test { sigset_t oldSet; public: - void SetUp() override { __llvm_libc::sigprocmask(0, nullptr, &oldSet); } + void SetUp() override { LIBC_NAMESPACE::sigprocmask(0, nullptr, &oldSet); } void TearDown() override { - __llvm_libc::sigprocmask(SIG_SETMASK, &oldSet, nullptr); + LIBC_NAMESPACE::sigprocmask(SIG_SETMASK, &oldSet, nullptr); } }; -using __llvm_libc::testing::ErrnoSetterMatcher::Fails; -using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; // This tests for invalid input. TEST_F(LlvmLibcSignalTest, SigprocmaskInvalid) { @@ -37,24 +37,24 @@ TEST_F(LlvmLibcSignalTest, SigprocmaskInvalid) { sigset_t valid; // 17 and -4 are out of the range for sigprocmask's how paramater. - EXPECT_THAT(__llvm_libc::sigprocmask(17, &valid, nullptr), Fails(EINVAL)); - EXPECT_THAT(__llvm_libc::sigprocmask(-4, &valid, nullptr), Fails(EINVAL)); + EXPECT_THAT(LIBC_NAMESPACE::sigprocmask(17, &valid, nullptr), Fails(EINVAL)); + EXPECT_THAT(LIBC_NAMESPACE::sigprocmask(-4, &valid, nullptr), Fails(EINVAL)); // This pointer is out of this processes address range. sigset_t *invalid = reinterpret_cast(-1); - EXPECT_THAT(__llvm_libc::sigprocmask(SIG_SETMASK, invalid, nullptr), + EXPECT_THAT(LIBC_NAMESPACE::sigprocmask(SIG_SETMASK, invalid, nullptr), Fails(EFAULT)); - EXPECT_THAT(__llvm_libc::sigprocmask(-4, nullptr, invalid), Fails(EFAULT)); + EXPECT_THAT(LIBC_NAMESPACE::sigprocmask(-4, nullptr, invalid), Fails(EFAULT)); } // This tests that when nothing is blocked, a process gets killed and alse tests // that when signals are blocked they are not delivered to the process. TEST_F(LlvmLibcSignalTest, BlockUnblock) { sigset_t sigset; - EXPECT_EQ(__llvm_libc::sigemptyset(&sigset), 0); - EXPECT_EQ(__llvm_libc::sigprocmask(SIG_SETMASK, &sigset, nullptr), 0); - EXPECT_DEATH([] { __llvm_libc::raise(SIGUSR1); }, WITH_SIGNAL(SIGUSR1)); - EXPECT_EQ(__llvm_libc::sigaddset(&sigset, SIGUSR1), 0); - EXPECT_EQ(__llvm_libc::sigprocmask(SIG_SETMASK, &sigset, nullptr), 0); - EXPECT_EXITS([] { __llvm_libc::raise(SIGUSR1); }, 0); + EXPECT_EQ(LIBC_NAMESPACE::sigemptyset(&sigset), 0); + EXPECT_EQ(LIBC_NAMESPACE::sigprocmask(SIG_SETMASK, &sigset, nullptr), 0); + EXPECT_DEATH([] { LIBC_NAMESPACE::raise(SIGUSR1); }, WITH_SIGNAL(SIGUSR1)); + EXPECT_EQ(LIBC_NAMESPACE::sigaddset(&sigset, SIGUSR1), 0); + EXPECT_EQ(LIBC_NAMESPACE::sigprocmask(SIG_SETMASK, &sigset, nullptr), 0); + EXPECT_EXITS([] { LIBC_NAMESPACE::raise(SIGUSR1); }, 0); } diff --git a/libc/test/src/spawn/posix_spawn_file_actions_test.cpp b/libc/test/src/spawn/posix_spawn_file_actions_test.cpp index abd2d78fdd5bb150be36183f6b256880bf09e8a5..a343710829f10b530438a285c6bea1f31925877e 100644 --- a/libc/test/src/spawn/posix_spawn_file_actions_test.cpp +++ b/libc/test/src/spawn/posix_spawn_file_actions_test.cpp @@ -20,56 +20,58 @@ TEST(LlvmLibcPosixSpawnFileActionsTest, AddActions) { posix_spawn_file_actions_t actions; - ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_init(&actions), 0); + ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_init(&actions), 0); ASSERT_EQ(uintptr_t(actions.__front), uintptr_t(nullptr)); ASSERT_EQ(uintptr_t(actions.__back), uintptr_t(nullptr)); - ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_addclose(&actions, 10), 0); + ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_addclose(&actions, 10), 0); ASSERT_NE(uintptr_t(actions.__front), uintptr_t(nullptr)); ASSERT_NE(uintptr_t(actions.__back), uintptr_t(nullptr)); - ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_adddup2(&actions, 11, 12), 0); - ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_addopen(&actions, 13, - "path/to/file", 0, 0), + ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_adddup2(&actions, 11, 12), + 0); + ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_addopen( + &actions, 13, "path/to/file", 0, 0), 0); - __llvm_libc::BaseSpawnFileAction *act = - reinterpret_cast<__llvm_libc::BaseSpawnFileAction *>(actions.__front); + LIBC_NAMESPACE::BaseSpawnFileAction *act = + reinterpret_cast(actions.__front); int action_count = 0; while (act != nullptr) { ++action_count; if (action_count == 1) - ASSERT_EQ(act->type, __llvm_libc::BaseSpawnFileAction::CLOSE); + ASSERT_EQ(act->type, LIBC_NAMESPACE::BaseSpawnFileAction::CLOSE); if (action_count == 2) - ASSERT_EQ(act->type, __llvm_libc::BaseSpawnFileAction::DUP2); + ASSERT_EQ(act->type, LIBC_NAMESPACE::BaseSpawnFileAction::DUP2); if (action_count == 3) - ASSERT_EQ(act->type, __llvm_libc::BaseSpawnFileAction::OPEN); + ASSERT_EQ(act->type, LIBC_NAMESPACE::BaseSpawnFileAction::OPEN); act = act->next; } ASSERT_EQ(action_count, 3); - ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_destroy(&actions), 0); + ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_destroy(&actions), 0); } TEST(LlvmLibcPosixSpawnFileActionsTest, InvalidActions) { - ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_addclose(nullptr, 1), EINVAL); - ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_adddup2(nullptr, 1, 2), + ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_addclose(nullptr, 1), + EINVAL); + ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_adddup2(nullptr, 1, 2), + EINVAL); + ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_addopen(nullptr, 1, + nullptr, 0, 0), EINVAL); - ASSERT_EQ( - __llvm_libc::posix_spawn_file_actions_addopen(nullptr, 1, nullptr, 0, 0), - EINVAL); - ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_destroy(nullptr), EINVAL); + ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_destroy(nullptr), EINVAL); posix_spawn_file_actions_t actions; - ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_init(&actions), 0); - ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_addclose(&actions, -1), + ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_init(&actions), 0); + ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_addclose(&actions, -1), EBADF); - ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_adddup2(&actions, -1, 2), + ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_adddup2(&actions, -1, 2), EBADF); - ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_adddup2(&actions, 1, -2), + ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_adddup2(&actions, 1, -2), EBADF); - ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_addopen(&actions, -1, nullptr, - 0, 0), + ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_addopen(&actions, -1, + nullptr, 0, 0), EBADF); - ASSERT_EQ(__llvm_libc::posix_spawn_file_actions_destroy(&actions), 0); + ASSERT_EQ(LIBC_NAMESPACE::posix_spawn_file_actions_destroy(&actions), 0); } diff --git a/libc/test/src/stdio/fgetc_test.cpp b/libc/test/src/stdio/fgetc_test.cpp index b262dda9325da5d76f8bad7ce7df1872758d17dd..6e6c0ed9b26bf6cfe991655897e69064ca9f3006 100644 --- a/libc/test/src/stdio/fgetc_test.cpp +++ b/libc/test/src/stdio/fgetc_test.cpp @@ -19,25 +19,25 @@ #include "src/errno/libc_errno.h" #include -class LlvmLibcGetcTest : public __llvm_libc::testing::Test { +class LlvmLibcGetcTest : public LIBC_NAMESPACE::testing::Test { public: using GetcFunc = int(FILE *); void test_with_func(GetcFunc *func, const char *filename) { - ::FILE *file = __llvm_libc::fopen(filename, "w"); + ::FILE *file = LIBC_NAMESPACE::fopen(filename, "w"); ASSERT_FALSE(file == nullptr); constexpr char CONTENT[] = "123456789"; constexpr size_t WRITE_SIZE = sizeof(CONTENT) - 1; - ASSERT_EQ(WRITE_SIZE, __llvm_libc::fwrite(CONTENT, 1, WRITE_SIZE, file)); + ASSERT_EQ(WRITE_SIZE, LIBC_NAMESPACE::fwrite(CONTENT, 1, WRITE_SIZE, file)); // This is a write-only file so reads should fail. ASSERT_EQ(func(file), EOF); // This is an error and not a real EOF. - ASSERT_EQ(__llvm_libc::feof(file), 0); - ASSERT_NE(__llvm_libc::ferror(file), 0); + ASSERT_EQ(LIBC_NAMESPACE::feof(file), 0); + ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0); libc_errno = 0; - ASSERT_EQ(0, __llvm_libc::fclose(file)); + ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file)); - file = __llvm_libc::fopen(filename, "r"); + file = LIBC_NAMESPACE::fopen(filename, "r"); ASSERT_FALSE(file == nullptr); for (size_t i = 0; i < WRITE_SIZE; ++i) { @@ -46,17 +46,17 @@ 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 4608be3ee35da914a111a3d03f9e4285c8c5a6e7..0d704ecee750c028543129882f368d8387484d53 100644 --- a/libc/test/src/stdio/fgetc_unlocked_test.cpp +++ b/libc/test/src/stdio/fgetc_unlocked_test.cpp @@ -22,46 +22,47 @@ #include "src/errno/libc_errno.h" #include -class LlvmLibcGetcTest : public __llvm_libc::testing::Test { +class LlvmLibcGetcTest : public LIBC_NAMESPACE::testing::Test { public: using GetcFunc = int(FILE *); void test_with_func(GetcFunc *func, const char *filename) { - ::FILE *file = __llvm_libc::fopen(filename, "w"); + ::FILE *file = LIBC_NAMESPACE::fopen(filename, "w"); ASSERT_FALSE(file == nullptr); constexpr char CONTENT[] = "123456789"; constexpr size_t WRITE_SIZE = sizeof(CONTENT) - 1; - ASSERT_EQ(WRITE_SIZE, __llvm_libc::fwrite(CONTENT, 1, WRITE_SIZE, file)); + ASSERT_EQ(WRITE_SIZE, LIBC_NAMESPACE::fwrite(CONTENT, 1, WRITE_SIZE, file)); // This is a write-only file so reads should fail. ASSERT_EQ(func(file), EOF); // This is an error and not a real EOF. - ASSERT_EQ(__llvm_libc::feof(file), 0); - ASSERT_NE(__llvm_libc::ferror(file), 0); + ASSERT_EQ(LIBC_NAMESPACE::feof(file), 0); + ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0); libc_errno = 0; - ASSERT_EQ(0, __llvm_libc::fclose(file)); + ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file)); - file = __llvm_libc::fopen(filename, "r"); + file = LIBC_NAMESPACE::fopen(filename, "r"); ASSERT_FALSE(file == nullptr); - __llvm_libc::flockfile(file); + LIBC_NAMESPACE::flockfile(file); for (size_t i = 0; i < WRITE_SIZE; ++i) { int c = func(file); ASSERT_EQ(c, int('1' + i)); } // Reading more should return EOF but not set error. ASSERT_EQ(func(file), EOF); - ASSERT_NE(__llvm_libc::feof_unlocked(file), 0); - ASSERT_EQ(__llvm_libc::ferror_unlocked(file), 0); + ASSERT_NE(LIBC_NAMESPACE::feof_unlocked(file), 0); + ASSERT_EQ(LIBC_NAMESPACE::ferror_unlocked(file), 0); - __llvm_libc::funlockfile(file); - ASSERT_EQ(0, __llvm_libc::fclose(file)); + LIBC_NAMESPACE::funlockfile(file); + ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file)); } }; TEST_F(LlvmLibcGetcTest, WriteAndReadCharactersWithFgetcUnlocked) { - test_with_func(&__llvm_libc::fgetc_unlocked, "testdata/fgetc_unlocked.test"); + test_with_func(&LIBC_NAMESPACE::fgetc_unlocked, + "testdata/fgetc_unlocked.test"); } TEST_F(LlvmLibcGetcTest, WriteAndReadCharactersWithGetcUnlocked) { - test_with_func(&__llvm_libc::getc_unlocked, "testdata/getc_unlocked.test"); + test_with_func(&LIBC_NAMESPACE::getc_unlocked, "testdata/getc_unlocked.test"); } diff --git a/libc/test/src/stdio/fgets_test.cpp b/libc/test/src/stdio/fgets_test.cpp index 150a9dd5d867d76684df759fe2037142fa581ae0..9f9841c901f4edc71cd278ffc27ebe91874ed0a0 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 68a749a6c93e73f56b847abfba413850d1e80e2a..d5478e58eecbf9368ca3aa5a24b7a9b6caa2be7a 100644 --- a/libc/test/src/stdio/fileop_test.cpp +++ b/libc/test/src/stdio/fileop_test.cpp @@ -22,136 +22,136 @@ #include "src/errno/libc_errno.h" #include -using __llvm_libc::testing::ErrnoSetterMatcher::EQ; -using __llvm_libc::testing::ErrnoSetterMatcher::NE; -using __llvm_libc::testing::ErrnoSetterMatcher::returns; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::EQ; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::NE; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::returns; TEST(LlvmLibcFILETest, SimpleFileOperations) { constexpr char FILENAME[] = "testdata/simple_operations.test"; - ::FILE *file = __llvm_libc::fopen(FILENAME, "w"); + ::FILE *file = LIBC_NAMESPACE::fopen(FILENAME, "w"); ASSERT_FALSE(file == nullptr); constexpr char CONTENT[] = "1234567890987654321"; ASSERT_EQ(sizeof(CONTENT) - 1, - __llvm_libc::fwrite(CONTENT, 1, sizeof(CONTENT) - 1, file)); + LIBC_NAMESPACE::fwrite(CONTENT, 1, sizeof(CONTENT) - 1, file)); // This is not a readable file. char read_data[sizeof(CONTENT)]; - ASSERT_THAT(__llvm_libc::fread(read_data, 1, sizeof(CONTENT), file), + ASSERT_THAT(LIBC_NAMESPACE::fread(read_data, 1, sizeof(CONTENT), file), returns(EQ(size_t(0))).with_errno(NE(0))); - ASSERT_NE(__llvm_libc::ferror(file), 0); + ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0); libc_errno = 0; - __llvm_libc::clearerr(file); - ASSERT_EQ(__llvm_libc::ferror(file), 0); + LIBC_NAMESPACE::clearerr(file); + ASSERT_EQ(LIBC_NAMESPACE::ferror(file), 0); - ASSERT_EQ(0, __llvm_libc::fclose(file)); + ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file)); - file = __llvm_libc::fopen(FILENAME, "r"); + file = LIBC_NAMESPACE::fopen(FILENAME, "r"); ASSERT_FALSE(file == nullptr); constexpr size_t READ_SIZE = 5; char data[READ_SIZE]; data[READ_SIZE - 1] = '\0'; - ASSERT_EQ(__llvm_libc::fread(data, 1, READ_SIZE - 1, file), READ_SIZE - 1); + ASSERT_EQ(LIBC_NAMESPACE::fread(data, 1, READ_SIZE - 1, file), READ_SIZE - 1); ASSERT_STREQ(data, "1234"); - ASSERT_EQ(__llvm_libc::fseek(file, 5, SEEK_CUR), 0); - ASSERT_EQ(__llvm_libc::fread(data, 1, READ_SIZE - 1, file), READ_SIZE - 1); + ASSERT_EQ(LIBC_NAMESPACE::fseek(file, 5, SEEK_CUR), 0); + ASSERT_EQ(LIBC_NAMESPACE::fread(data, 1, READ_SIZE - 1, file), READ_SIZE - 1); ASSERT_STREQ(data, "0987"); - ASSERT_EQ(__llvm_libc::fseek(file, -5, SEEK_CUR), 0); - ASSERT_EQ(__llvm_libc::fread(data, 1, READ_SIZE - 1, file), READ_SIZE - 1); + ASSERT_EQ(LIBC_NAMESPACE::fseek(file, -5, SEEK_CUR), 0); + ASSERT_EQ(LIBC_NAMESPACE::fread(data, 1, READ_SIZE - 1, file), READ_SIZE - 1); ASSERT_STREQ(data, "9098"); // Reading another time should trigger eof. ASSERT_NE(sizeof(CONTENT), - __llvm_libc::fread(read_data, 1, sizeof(CONTENT), file)); - ASSERT_NE(__llvm_libc::feof(file), 0); + LIBC_NAMESPACE::fread(read_data, 1, sizeof(CONTENT), file)); + ASSERT_NE(LIBC_NAMESPACE::feof(file), 0); // Should be an error to write. - ASSERT_THAT(__llvm_libc::fwrite(CONTENT, 1, sizeof(CONTENT), file), + ASSERT_THAT(LIBC_NAMESPACE::fwrite(CONTENT, 1, sizeof(CONTENT), file), returns(EQ(size_t(0))).with_errno(NE(0))); - ASSERT_NE(__llvm_libc::ferror(file), 0); + ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0); libc_errno = 0; - __llvm_libc::clearerr(file); + LIBC_NAMESPACE::clearerr(file); // Should be an error to puts. - ASSERT_THAT(__llvm_libc::fputs(CONTENT, file), + ASSERT_THAT(LIBC_NAMESPACE::fputs(CONTENT, file), returns(EQ(EOF)).with_errno(NE(0))); - ASSERT_NE(__llvm_libc::ferror(file), 0); + ASSERT_NE(LIBC_NAMESPACE::ferror(file), 0); libc_errno = 0; - __llvm_libc::clearerr(file); - ASSERT_EQ(__llvm_libc::ferror(file), 0); + LIBC_NAMESPACE::clearerr(file); + ASSERT_EQ(LIBC_NAMESPACE::ferror(file), 0); libc_errno = 0; - ASSERT_THAT(__llvm_libc::fwrite("nothing", 1, 1, file), + ASSERT_THAT(LIBC_NAMESPACE::fwrite("nothing", 1, 1, file), returns(EQ(0)).with_errno(NE(0))); libc_errno = 0; - ASSERT_EQ(__llvm_libc::fclose(file), 0); + ASSERT_EQ(LIBC_NAMESPACE::fclose(file), 0); // Now try puts. - file = __llvm_libc::fopen(FILENAME, "w"); + file = LIBC_NAMESPACE::fopen(FILENAME, "w"); ASSERT_FALSE(file == nullptr); // fputs returns a negative value on error (EOF) or any non-negative value on // success. This assert checks that the return value is non-negative. - ASSERT_GE(__llvm_libc::fputs(CONTENT, file), 0); + ASSERT_GE(LIBC_NAMESPACE::fputs(CONTENT, file), 0); - __llvm_libc::clearerr(file); - ASSERT_EQ(__llvm_libc::ferror(file), 0); + LIBC_NAMESPACE::clearerr(file); + ASSERT_EQ(LIBC_NAMESPACE::ferror(file), 0); // This is not a readable file. libc_errno = 0; - ASSERT_THAT(__llvm_libc::fread(data, 1, 1, file), + ASSERT_THAT(LIBC_NAMESPACE::fread(data, 1, 1, file), returns(EQ(0)).with_errno(NE(0))); libc_errno = 0; - ASSERT_EQ(0, __llvm_libc::fclose(file)); + ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file)); - file = __llvm_libc::fopen(FILENAME, "r"); + file = LIBC_NAMESPACE::fopen(FILENAME, "r"); ASSERT_FALSE(file == nullptr); - ASSERT_EQ(__llvm_libc::fread(read_data, 1, sizeof(CONTENT) - 1, file), + ASSERT_EQ(LIBC_NAMESPACE::fread(read_data, 1, sizeof(CONTENT) - 1, file), sizeof(CONTENT) - 1); read_data[sizeof(CONTENT) - 1] = '\0'; ASSERT_STREQ(read_data, CONTENT); - ASSERT_EQ(__llvm_libc::fclose(file), 0); + ASSERT_EQ(LIBC_NAMESPACE::fclose(file), 0); // Check that the other functions correctly set libc_errno. // libc_errno = 0; - // ASSERT_NE(__llvm_libc::fseek(file, 0, SEEK_SET), 0); + // ASSERT_NE(LIBC_NAMESPACE::fseek(file, 0, SEEK_SET), 0); // EXPECT_NE(libc_errno, 0); // libc_errno = 0; - // ASSERT_NE(__llvm_libc::fclose(file), 0); + // ASSERT_NE(LIBC_NAMESPACE::fclose(file), 0); // EXPECT_NE(libc_errno, 0); // libc_errno = 0; - // ASSERT_EQ(__llvm_libc::fopen("INVALID FILE NAME", "r"), + // ASSERT_EQ(LIBC_NAMESPACE::fopen("INVALID FILE NAME", "r"), // static_cast(nullptr)); // EXPECT_NE(libc_errno, 0); } TEST(LlvmLibcFILETest, FFlush) { constexpr char FILENAME[] = "testdata/fflush.test"; - ::FILE *file = __llvm_libc::fopen(FILENAME, "w+"); + ::FILE *file = LIBC_NAMESPACE::fopen(FILENAME, "w+"); ASSERT_FALSE(file == nullptr); constexpr char CONTENT[] = "1234567890987654321"; ASSERT_EQ(sizeof(CONTENT), - __llvm_libc::fwrite(CONTENT, 1, sizeof(CONTENT), file)); + LIBC_NAMESPACE::fwrite(CONTENT, 1, sizeof(CONTENT), file)); // Flushing at this point should write the data to disk. So, we should be // able to read it back. - ASSERT_EQ(0, __llvm_libc::fflush(file)); + ASSERT_EQ(0, LIBC_NAMESPACE::fflush(file)); char data[sizeof(CONTENT)]; - ASSERT_EQ(__llvm_libc::fseek(file, 0, SEEK_SET), 0); - ASSERT_EQ(__llvm_libc::fread(data, 1, sizeof(CONTENT), file), + ASSERT_EQ(LIBC_NAMESPACE::fseek(file, 0, SEEK_SET), 0); + ASSERT_EQ(LIBC_NAMESPACE::fread(data, 1, sizeof(CONTENT), file), sizeof(CONTENT)); ASSERT_STREQ(data, CONTENT); - ASSERT_EQ(__llvm_libc::fclose(file), 0); + ASSERT_EQ(LIBC_NAMESPACE::fclose(file), 0); } TEST(LlvmLibcFILETest, FOpenFWriteSizeGreaterThanOne) { @@ -164,28 +164,28 @@ TEST(LlvmLibcFILETest, FOpenFWriteSizeGreaterThanOne) { constexpr char FILENAME[] = "testdata/fread_fwrite.test"; libc_errno = 0; - FILE *file = __llvm_libc::fopen(FILENAME, "w"); + FILE *file = LIBC_NAMESPACE::fopen(FILENAME, "w"); ASSERT_FALSE(file == nullptr); - ASSERT_EQ(size_t(0), __llvm_libc::fwrite(WRITE_DATA, 0, 1, file)); + ASSERT_EQ(size_t(0), LIBC_NAMESPACE::fwrite(WRITE_DATA, 0, 1, file)); ASSERT_THAT( - __llvm_libc::fwrite(WRITE_DATA, sizeof(MyStruct), WRITE_NMEMB, file), + LIBC_NAMESPACE::fwrite(WRITE_DATA, sizeof(MyStruct), WRITE_NMEMB, file), returns(EQ(WRITE_NMEMB)).with_errno(EQ(0))); - ASSERT_EQ(__llvm_libc::fclose(file), 0); + ASSERT_EQ(LIBC_NAMESPACE::fclose(file), 0); - file = __llvm_libc::fopen(FILENAME, "r"); + file = LIBC_NAMESPACE::fopen(FILENAME, "r"); ASSERT_FALSE(file == nullptr); MyStruct read_data[WRITE_NMEMB]; - ASSERT_EQ(size_t(0), __llvm_libc::fread(read_data, 0, 1, file)); + ASSERT_EQ(size_t(0), LIBC_NAMESPACE::fread(read_data, 0, 1, file)); ASSERT_THAT( - __llvm_libc::fread(read_data, sizeof(MyStruct), WRITE_NMEMB, file), + LIBC_NAMESPACE::fread(read_data, sizeof(MyStruct), WRITE_NMEMB, file), returns(EQ(WRITE_NMEMB)).with_errno(EQ(0))); // Trying to read more should fetch nothing. ASSERT_THAT( - __llvm_libc::fread(read_data, sizeof(MyStruct), WRITE_NMEMB, file), + LIBC_NAMESPACE::fread(read_data, sizeof(MyStruct), WRITE_NMEMB, file), returns(EQ(0)).with_errno(EQ(0))); - EXPECT_NE(__llvm_libc::feof(file), 0); - EXPECT_EQ(__llvm_libc::ferror(file), 0); - ASSERT_EQ(__llvm_libc::fclose(file), 0); + EXPECT_NE(LIBC_NAMESPACE::feof(file), 0); + EXPECT_EQ(LIBC_NAMESPACE::ferror(file), 0); + ASSERT_EQ(LIBC_NAMESPACE::fclose(file), 0); // Verify that the data which was read is correct. for (size_t i = 0; i < WRITE_NMEMB; ++i) { ASSERT_EQ(read_data[i].c, WRITE_DATA[i].c); diff --git a/libc/test/src/stdio/fopen_test.cpp b/libc/test/src/stdio/fopen_test.cpp index f0de8caf673cc7e05853b3bdc98122b167d1c496..42e7c57cffe04b67541b01de6c7249b20b47eec1 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 cfdaef2149f5b013dda47eec32b8c57e67d47b45..6f3c2910cfd82354094c16dea7d96ceb6816bd68 100644 --- a/libc/test/src/stdio/fopencookie_test.cpp +++ b/libc/test/src/stdio/fopencookie_test.cpp @@ -22,7 +22,7 @@ #include #include -using MemoryView = __llvm_libc::testing::MemoryView; +using MemoryView = LIBC_NAMESPACE::testing::MemoryView; struct StringStream { char *buf; @@ -98,29 +98,29 @@ TEST(LlvmLibcFOpenCookie, ReadOnlyCookieTest) { for (size_t i = 0; i < sizeof(CONTENT); ++i) ss->buf[i] = CONTENT[i]; - ::FILE *f = __llvm_libc::fopencookie(ss, "r", STRING_STREAM_FUNCS); + ::FILE *f = LIBC_NAMESPACE::fopencookie(ss, "r", STRING_STREAM_FUNCS); ASSERT_TRUE(f != nullptr); char read_data[sizeof(CONTENT)]; ASSERT_EQ(sizeof(CONTENT), - __llvm_libc::fread(read_data, 1, sizeof(CONTENT), f)); + LIBC_NAMESPACE::fread(read_data, 1, sizeof(CONTENT), f)); ASSERT_STREQ(read_data, CONTENT); // Reading another time should trigger eof. ASSERT_NE(sizeof(CONTENT), - __llvm_libc::fread(read_data, 1, sizeof(CONTENT), f)); - ASSERT_NE(__llvm_libc::feof(f), 0); + LIBC_NAMESPACE::fread(read_data, 1, sizeof(CONTENT), f)); + ASSERT_NE(LIBC_NAMESPACE::feof(f), 0); - ASSERT_EQ(0, __llvm_libc::fseek(f, 0, SEEK_SET)); + ASSERT_EQ(0, LIBC_NAMESPACE::fseek(f, 0, SEEK_SET)); // Should be an error to write. - ASSERT_EQ(size_t(0), __llvm_libc::fwrite(CONTENT, 1, sizeof(CONTENT), f)); - ASSERT_NE(__llvm_libc::ferror(f), 0); + ASSERT_EQ(size_t(0), LIBC_NAMESPACE::fwrite(CONTENT, 1, sizeof(CONTENT), f)); + ASSERT_NE(LIBC_NAMESPACE::ferror(f), 0); ASSERT_NE(libc_errno, 0); libc_errno = 0; - __llvm_libc::clearerr(f); - ASSERT_EQ(__llvm_libc::ferror(f), 0); + LIBC_NAMESPACE::clearerr(f); + ASSERT_EQ(LIBC_NAMESPACE::ferror(f), 0); - ASSERT_EQ(0, __llvm_libc::fclose(f)); + ASSERT_EQ(0, LIBC_NAMESPACE::fclose(f)); free(ss); } @@ -132,28 +132,29 @@ TEST(LlvmLibcFOpenCookie, WriteOnlyCookieTest) { ss->offset = 0; ss->endpos = 0; - ::FILE *f = __llvm_libc::fopencookie(ss, "w", STRING_STREAM_FUNCS); + ::FILE *f = LIBC_NAMESPACE::fopencookie(ss, "w", STRING_STREAM_FUNCS); ASSERT_TRUE(f != nullptr); constexpr char WRITE_DATA[] = "Hello,writeonly!"; ASSERT_EQ(sizeof(WRITE_DATA), - __llvm_libc::fwrite(WRITE_DATA, 1, sizeof(WRITE_DATA), f)); + LIBC_NAMESPACE::fwrite(WRITE_DATA, 1, sizeof(WRITE_DATA), f)); // Flushing will ensure the data to be written to the string stream. - ASSERT_EQ(0, __llvm_libc::fflush(f)); + ASSERT_EQ(0, LIBC_NAMESPACE::fflush(f)); ASSERT_STREQ(WRITE_DATA, ss->buf); - ASSERT_EQ(0, __llvm_libc::fseek(f, 0, SEEK_SET)); + ASSERT_EQ(0, LIBC_NAMESPACE::fseek(f, 0, SEEK_SET)); char read_data[sizeof(WRITE_DATA)]; // Should be an error to read. - ASSERT_EQ(size_t(0), __llvm_libc::fread(read_data, 1, sizeof(WRITE_DATA), f)); - ASSERT_NE(__llvm_libc::ferror(f), 0); + ASSERT_EQ(size_t(0), + LIBC_NAMESPACE::fread(read_data, 1, sizeof(WRITE_DATA), f)); + ASSERT_NE(LIBC_NAMESPACE::ferror(f), 0); ASSERT_EQ(libc_errno, EBADF); libc_errno = 0; - __llvm_libc::clearerr(f); - ASSERT_EQ(__llvm_libc::ferror(f), 0); + LIBC_NAMESPACE::clearerr(f); + ASSERT_EQ(LIBC_NAMESPACE::ferror(f), 0); - ASSERT_EQ(0, __llvm_libc::fclose(f)); + ASSERT_EQ(0, LIBC_NAMESPACE::fclose(f)); free(ss); } @@ -168,26 +169,26 @@ TEST(LlvmLibcFOpenCookie, AppendOnlyCookieTest) { for (size_t i = 0; i < sizeof(INITIAL_CONTENT); ++i) ss->buf[i] = INITIAL_CONTENT[i]; - ::FILE *f = __llvm_libc::fopencookie(ss, "a", STRING_STREAM_FUNCS); + ::FILE *f = LIBC_NAMESPACE::fopencookie(ss, "a", STRING_STREAM_FUNCS); ASSERT_TRUE(f != nullptr); constexpr size_t READ_SIZE = 5; char read_data[READ_SIZE]; // This is not a readable file. - ASSERT_EQ(__llvm_libc::fread(read_data, 1, READ_SIZE, f), size_t(0)); - ASSERT_NE(__llvm_libc::ferror(f), 0); + ASSERT_EQ(LIBC_NAMESPACE::fread(read_data, 1, READ_SIZE, f), size_t(0)); + ASSERT_NE(LIBC_NAMESPACE::ferror(f), 0); EXPECT_NE(libc_errno, 0); libc_errno = 0; - __llvm_libc::clearerr(f); - ASSERT_EQ(__llvm_libc::ferror(f), 0); + LIBC_NAMESPACE::clearerr(f); + ASSERT_EQ(LIBC_NAMESPACE::ferror(f), 0); - ASSERT_EQ(__llvm_libc::fwrite(WRITE_DATA, 1, sizeof(WRITE_DATA), f), + ASSERT_EQ(LIBC_NAMESPACE::fwrite(WRITE_DATA, 1, sizeof(WRITE_DATA), f), sizeof(WRITE_DATA)); - EXPECT_EQ(__llvm_libc::fflush(f), 0); + EXPECT_EQ(LIBC_NAMESPACE::fflush(f), 0); EXPECT_EQ(ss->endpos, sizeof(WRITE_DATA) + sizeof(INITIAL_CONTENT)); - ASSERT_EQ(__llvm_libc::fclose(f), 0); + ASSERT_EQ(LIBC_NAMESPACE::fclose(f), 0); free(ss); } @@ -201,24 +202,24 @@ TEST(LlvmLibcFOpenCookie, ReadUpdateCookieTest) { for (size_t i = 0; i < sizeof(INITIAL_CONTENT); ++i) ss->buf[i] = INITIAL_CONTENT[i]; - ::FILE *f = __llvm_libc::fopencookie(ss, "r+", STRING_STREAM_FUNCS); + ::FILE *f = LIBC_NAMESPACE::fopencookie(ss, "r+", STRING_STREAM_FUNCS); ASSERT_TRUE(f != nullptr); constexpr size_t READ_SIZE = sizeof(INITIAL_CONTENT) / 2; char read_data[READ_SIZE]; - ASSERT_EQ(READ_SIZE, __llvm_libc::fread(read_data, 1, READ_SIZE, f)); + ASSERT_EQ(READ_SIZE, LIBC_NAMESPACE::fread(read_data, 1, READ_SIZE, f)); MemoryView src1(INITIAL_CONTENT, READ_SIZE), dst1(read_data, READ_SIZE); EXPECT_MEM_EQ(src1, dst1); - ASSERT_EQ(__llvm_libc::fseek(f, 0, SEEK_SET), 0); + ASSERT_EQ(LIBC_NAMESPACE::fseek(f, 0, SEEK_SET), 0); constexpr char WRITE_DATA[] = "hello, file"; ASSERT_EQ(sizeof(WRITE_DATA), - __llvm_libc::fwrite(WRITE_DATA, 1, sizeof(WRITE_DATA), f)); - ASSERT_EQ(__llvm_libc::fflush(f), 0); + LIBC_NAMESPACE::fwrite(WRITE_DATA, 1, sizeof(WRITE_DATA), f)); + ASSERT_EQ(LIBC_NAMESPACE::fflush(f), 0); EXPECT_STREQ(ss->buf, WRITE_DATA); - ASSERT_EQ(__llvm_libc::fclose(f), 0); + ASSERT_EQ(LIBC_NAMESPACE::fclose(f), 0); free(ss); } @@ -230,19 +231,19 @@ TEST(LlvmLibcFOpenCookie, WriteUpdateCookieTest) { ss->offset = 0; ss->endpos = 0; - ::FILE *f = __llvm_libc::fopencookie(ss, "w+", STRING_STREAM_FUNCS); + ::FILE *f = LIBC_NAMESPACE::fopencookie(ss, "w+", STRING_STREAM_FUNCS); ASSERT_TRUE(f != nullptr); ASSERT_EQ(sizeof(WRITE_DATA), - __llvm_libc::fwrite(WRITE_DATA, 1, sizeof(WRITE_DATA), f)); + LIBC_NAMESPACE::fwrite(WRITE_DATA, 1, sizeof(WRITE_DATA), f)); - ASSERT_EQ(__llvm_libc::fseek(f, 0, SEEK_SET), 0); + ASSERT_EQ(LIBC_NAMESPACE::fseek(f, 0, SEEK_SET), 0); char read_data[sizeof(WRITE_DATA)]; - ASSERT_EQ(__llvm_libc::fread(read_data, 1, sizeof(read_data), f), + ASSERT_EQ(LIBC_NAMESPACE::fread(read_data, 1, sizeof(read_data), f), sizeof(read_data)); EXPECT_STREQ(read_data, WRITE_DATA); - ASSERT_EQ(__llvm_libc::fclose(f), 0); + ASSERT_EQ(LIBC_NAMESPACE::fclose(f), 0); free(ss); } diff --git a/libc/test/src/stdio/fprintf_test.cpp b/libc/test/src/stdio/fprintf_test.cpp index 9a3c1f2e87206e60c0684624beb67038bc53873d..08b31795b435b21e8a6499e041cc79065cdf7215 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 e5aa7c713463bf223cf4ce9b7839c7b63b68b7fc..578403fc374b0185aa07c7192dc9f222d0468eaf 100644 --- a/libc/test/src/stdio/fputc_test.cpp +++ b/libc/test/src/stdio/fputc_test.cpp @@ -17,14 +17,14 @@ TEST(LlvmLibcPutcTest, PrintOut) { constexpr char simple[] = "A simple string written to stdout\n"; for (const char &c : simple) { - result = __llvm_libc::putchar(c); + result = LIBC_NAMESPACE::putchar(c); EXPECT_GE(result, 0); } constexpr char more[] = "A simple string written to stderr\n"; for (const char &c : simple) { - result = - __llvm_libc::fputc(c, reinterpret_cast(__llvm_libc::stderr)); + result = LIBC_NAMESPACE::fputc( + c, reinterpret_cast(LIBC_NAMESPACE::stderr)); } EXPECT_GE(result, 0); } diff --git a/libc/test/src/stdio/fputs_test.cpp b/libc/test/src/stdio/fputs_test.cpp index 8c206966b954a6a5f2c7733de39ed32439f2014e..6583738acb94c1c2647e0310b4cab2eb725ca85e 100644 --- a/libc/test/src/stdio/fputs_test.cpp +++ b/libc/test/src/stdio/fputs_test.cpp @@ -15,12 +15,12 @@ TEST(LlvmLibcPutsTest, PrintOut) { int result; constexpr char simple[] = "A simple string written to stdout\n"; - result = - __llvm_libc::fputs(simple, reinterpret_cast(__llvm_libc::stdout)); + result = LIBC_NAMESPACE::fputs( + simple, reinterpret_cast(LIBC_NAMESPACE::stdout)); EXPECT_GE(result, 0); constexpr char more[] = "A simple string written to stderr\n"; - result = - __llvm_libc::fputs(more, reinterpret_cast(__llvm_libc::stderr)); + result = LIBC_NAMESPACE::fputs( + more, reinterpret_cast(LIBC_NAMESPACE::stderr)); EXPECT_GE(result, 0); } diff --git a/libc/test/src/stdio/fscanf_test.cpp b/libc/test/src/stdio/fscanf_test.cpp index efb8f31ff11b56fc93dd6b69e4bb5911eef05f7a..701090788ca10c3db291cf1e84659ac72cfe6cad 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 fec881db4d888b6f7298185273b6f6297694c15e..61b626f53cd26ec2aca6436743a2179ce4546bee 100644 --- a/libc/test/src/stdio/ftell_test.cpp +++ b/libc/test/src/stdio/ftell_test.cpp @@ -17,41 +17,41 @@ #include -class LlvmLibcFTellTest : public __llvm_libc::testing::Test { +class LlvmLibcFTellTest : public LIBC_NAMESPACE::testing::Test { protected: void test_with_bufmode(int bufmode) { constexpr char FILENAME[] = "testdata/ftell.test"; // We will set a special buffer to the file so that we guarantee buffering. constexpr size_t BUFFER_SIZE = 1024; char buffer[BUFFER_SIZE]; - ::FILE *file = __llvm_libc::fopen(FILENAME, "w+"); + ::FILE *file = LIBC_NAMESPACE::fopen(FILENAME, "w+"); ASSERT_FALSE(file == nullptr); - ASSERT_EQ(__llvm_libc::setvbuf(file, buffer, bufmode, BUFFER_SIZE), 0); + ASSERT_EQ(LIBC_NAMESPACE::setvbuf(file, buffer, bufmode, BUFFER_SIZE), 0); // Include few '\n' chars to test when |bufmode| is _IOLBF. constexpr char CONTENT[] = "12\n345\n6789"; constexpr size_t WRITE_SIZE = sizeof(CONTENT) - 1; - ASSERT_EQ(WRITE_SIZE, __llvm_libc::fwrite(CONTENT, 1, WRITE_SIZE, file)); + ASSERT_EQ(WRITE_SIZE, LIBC_NAMESPACE::fwrite(CONTENT, 1, WRITE_SIZE, file)); // The above write should have buffered the written data and not have // trasferred it to the underlying stream. But, ftell operation should // still return the correct effective offset. - ASSERT_EQ(size_t(__llvm_libc::ftell(file)), WRITE_SIZE); + ASSERT_EQ(size_t(LIBC_NAMESPACE::ftell(file)), WRITE_SIZE); long offset = 5; - ASSERT_EQ(0, __llvm_libc::fseek(file, offset, SEEK_SET)); - ASSERT_EQ(__llvm_libc::ftell(file), offset); - ASSERT_EQ(0, __llvm_libc::fseek(file, -offset, SEEK_END)); - ASSERT_EQ(size_t(__llvm_libc::ftell(file)), size_t(WRITE_SIZE - offset)); + ASSERT_EQ(0, LIBC_NAMESPACE::fseek(file, offset, SEEK_SET)); + ASSERT_EQ(LIBC_NAMESPACE::ftell(file), offset); + ASSERT_EQ(0, LIBC_NAMESPACE::fseek(file, -offset, SEEK_END)); + ASSERT_EQ(size_t(LIBC_NAMESPACE::ftell(file)), size_t(WRITE_SIZE - offset)); - ASSERT_EQ(0, __llvm_libc::fseek(file, 0, SEEK_SET)); + ASSERT_EQ(0, LIBC_NAMESPACE::fseek(file, 0, SEEK_SET)); constexpr size_t READ_SIZE = WRITE_SIZE / 2; char data[READ_SIZE]; // Reading a small amount will actually read out much more data and // buffer it. But, ftell should return the correct effective offset. - ASSERT_EQ(READ_SIZE, __llvm_libc::fread(data, 1, READ_SIZE, file)); - ASSERT_EQ(size_t(__llvm_libc::ftell(file)), READ_SIZE); + ASSERT_EQ(READ_SIZE, LIBC_NAMESPACE::fread(data, 1, READ_SIZE, file)); + ASSERT_EQ(size_t(LIBC_NAMESPACE::ftell(file)), READ_SIZE); - ASSERT_EQ(0, __llvm_libc::fclose(file)); + ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file)); } }; diff --git a/libc/test/src/stdio/printf_core/converter_test.cpp b/libc/test/src/stdio/printf_core/converter_test.cpp index 69860d627f800dc39ac13ee4a57c7db9bbedf18d..8404ef6ec7db4dbbec9554a16d617a7d6f3a7254 100644 --- a/libc/test/src/stdio/printf_core/converter_test.cpp +++ b/libc/test/src/stdio/printf_core/converter_test.cpp @@ -12,24 +12,24 @@ #include "test/UnitTest/Test.h" -class LlvmLibcPrintfConverterTest : public __llvm_libc::testing::Test { +class LlvmLibcPrintfConverterTest : public LIBC_NAMESPACE::testing::Test { protected: // void SetUp() override {} // void TearDown() override {} char str[60]; - __llvm_libc::printf_core::WriteBuffer wb = - __llvm_libc::printf_core::WriteBuffer(str, sizeof(str) - 1); - __llvm_libc::printf_core::Writer writer = - __llvm_libc::printf_core::Writer(&wb); + LIBC_NAMESPACE::printf_core::WriteBuffer wb = + LIBC_NAMESPACE::printf_core::WriteBuffer(str, sizeof(str) - 1); + LIBC_NAMESPACE::printf_core::Writer writer = + LIBC_NAMESPACE::printf_core::Writer(&wb); }; TEST_F(LlvmLibcPrintfConverterTest, SimpleRawConversion) { - __llvm_libc::printf_core::FormatSection raw_section; + LIBC_NAMESPACE::printf_core::FormatSection raw_section; raw_section.has_conv = false; raw_section.raw_string = "abc"; - __llvm_libc::printf_core::convert(&writer, raw_section); + LIBC_NAMESPACE::printf_core::convert(&writer, raw_section); wb.buff[wb.buff_cur] = '\0'; @@ -38,12 +38,12 @@ TEST_F(LlvmLibcPrintfConverterTest, SimpleRawConversion) { } TEST_F(LlvmLibcPrintfConverterTest, PercentConversion) { - __llvm_libc::printf_core::FormatSection simple_conv; + LIBC_NAMESPACE::printf_core::FormatSection simple_conv; simple_conv.has_conv = true; simple_conv.raw_string = "%%"; simple_conv.conv_name = '%'; - __llvm_libc::printf_core::convert(&writer, simple_conv); + LIBC_NAMESPACE::printf_core::convert(&writer, simple_conv); wb.buff[wb.buff_cur] = '\0'; @@ -52,7 +52,7 @@ TEST_F(LlvmLibcPrintfConverterTest, PercentConversion) { } TEST_F(LlvmLibcPrintfConverterTest, CharConversionSimple) { - __llvm_libc::printf_core::FormatSection simple_conv; + LIBC_NAMESPACE::printf_core::FormatSection simple_conv; simple_conv.has_conv = true; // If has_conv is true, the raw string is ignored. They are not being parsed // and match the actual conversion taking place so that you can compare these @@ -61,7 +61,7 @@ TEST_F(LlvmLibcPrintfConverterTest, CharConversionSimple) { simple_conv.conv_name = 'c'; simple_conv.conv_val_raw = 'D'; - __llvm_libc::printf_core::convert(&writer, simple_conv); + LIBC_NAMESPACE::printf_core::convert(&writer, simple_conv); wb.buff[wb.buff_cur] = '\0'; @@ -70,13 +70,13 @@ TEST_F(LlvmLibcPrintfConverterTest, CharConversionSimple) { } TEST_F(LlvmLibcPrintfConverterTest, CharConversionRightJustified) { - __llvm_libc::printf_core::FormatSection right_justified_conv; + LIBC_NAMESPACE::printf_core::FormatSection right_justified_conv; right_justified_conv.has_conv = true; right_justified_conv.raw_string = "%4c"; right_justified_conv.conv_name = 'c'; right_justified_conv.min_width = 4; right_justified_conv.conv_val_raw = 'E'; - __llvm_libc::printf_core::convert(&writer, right_justified_conv); + LIBC_NAMESPACE::printf_core::convert(&writer, right_justified_conv); wb.buff[wb.buff_cur] = '\0'; @@ -85,15 +85,15 @@ TEST_F(LlvmLibcPrintfConverterTest, CharConversionRightJustified) { } TEST_F(LlvmLibcPrintfConverterTest, CharConversionLeftJustified) { - __llvm_libc::printf_core::FormatSection left_justified_conv; + LIBC_NAMESPACE::printf_core::FormatSection left_justified_conv; left_justified_conv.has_conv = true; left_justified_conv.raw_string = "%-4c"; left_justified_conv.conv_name = 'c'; left_justified_conv.flags = - __llvm_libc::printf_core::FormatFlags::LEFT_JUSTIFIED; + LIBC_NAMESPACE::printf_core::FormatFlags::LEFT_JUSTIFIED; left_justified_conv.min_width = 4; left_justified_conv.conv_val_raw = 'F'; - __llvm_libc::printf_core::convert(&writer, left_justified_conv); + LIBC_NAMESPACE::printf_core::convert(&writer, left_justified_conv); wb.buff[wb.buff_cur] = '\0'; @@ -103,13 +103,13 @@ TEST_F(LlvmLibcPrintfConverterTest, CharConversionLeftJustified) { TEST_F(LlvmLibcPrintfConverterTest, StringConversionSimple) { - __llvm_libc::printf_core::FormatSection simple_conv; + LIBC_NAMESPACE::printf_core::FormatSection simple_conv; simple_conv.has_conv = true; simple_conv.raw_string = "%s"; simple_conv.conv_name = 's'; simple_conv.conv_val_ptr = const_cast("DEF"); - __llvm_libc::printf_core::convert(&writer, simple_conv); + LIBC_NAMESPACE::printf_core::convert(&writer, simple_conv); wb.buff[wb.buff_cur] = '\0'; @@ -118,13 +118,13 @@ TEST_F(LlvmLibcPrintfConverterTest, StringConversionSimple) { } TEST_F(LlvmLibcPrintfConverterTest, StringConversionPrecisionHigh) { - __llvm_libc::printf_core::FormatSection high_precision_conv; + LIBC_NAMESPACE::printf_core::FormatSection high_precision_conv; high_precision_conv.has_conv = true; high_precision_conv.raw_string = "%4s"; high_precision_conv.conv_name = 's'; high_precision_conv.precision = 4; high_precision_conv.conv_val_ptr = const_cast("456"); - __llvm_libc::printf_core::convert(&writer, high_precision_conv); + LIBC_NAMESPACE::printf_core::convert(&writer, high_precision_conv); wb.buff[wb.buff_cur] = '\0'; @@ -133,13 +133,13 @@ TEST_F(LlvmLibcPrintfConverterTest, StringConversionPrecisionHigh) { } TEST_F(LlvmLibcPrintfConverterTest, StringConversionPrecisionLow) { - __llvm_libc::printf_core::FormatSection low_precision_conv; + LIBC_NAMESPACE::printf_core::FormatSection low_precision_conv; low_precision_conv.has_conv = true; low_precision_conv.raw_string = "%.2s"; low_precision_conv.conv_name = 's'; low_precision_conv.precision = 2; low_precision_conv.conv_val_ptr = const_cast("xyz"); - __llvm_libc::printf_core::convert(&writer, low_precision_conv); + LIBC_NAMESPACE::printf_core::convert(&writer, low_precision_conv); wb.buff[wb.buff_cur] = '\0'; @@ -148,13 +148,13 @@ TEST_F(LlvmLibcPrintfConverterTest, StringConversionPrecisionLow) { } TEST_F(LlvmLibcPrintfConverterTest, StringConversionRightJustified) { - __llvm_libc::printf_core::FormatSection right_justified_conv; + LIBC_NAMESPACE::printf_core::FormatSection right_justified_conv; right_justified_conv.has_conv = true; right_justified_conv.raw_string = "%4s"; right_justified_conv.conv_name = 's'; right_justified_conv.min_width = 4; right_justified_conv.conv_val_ptr = const_cast("789"); - __llvm_libc::printf_core::convert(&writer, right_justified_conv); + LIBC_NAMESPACE::printf_core::convert(&writer, right_justified_conv); wb.buff[wb.buff_cur] = '\0'; @@ -163,15 +163,15 @@ TEST_F(LlvmLibcPrintfConverterTest, StringConversionRightJustified) { } TEST_F(LlvmLibcPrintfConverterTest, StringConversionLeftJustified) { - __llvm_libc::printf_core::FormatSection left_justified_conv; + LIBC_NAMESPACE::printf_core::FormatSection left_justified_conv; left_justified_conv.has_conv = true; left_justified_conv.raw_string = "%-4s"; left_justified_conv.conv_name = 's'; left_justified_conv.flags = - __llvm_libc::printf_core::FormatFlags::LEFT_JUSTIFIED; + LIBC_NAMESPACE::printf_core::FormatFlags::LEFT_JUSTIFIED; left_justified_conv.min_width = 4; left_justified_conv.conv_val_ptr = const_cast("ghi"); - __llvm_libc::printf_core::convert(&writer, left_justified_conv); + LIBC_NAMESPACE::printf_core::convert(&writer, left_justified_conv); wb.buff[wb.buff_cur] = '\0'; @@ -180,12 +180,12 @@ TEST_F(LlvmLibcPrintfConverterTest, StringConversionLeftJustified) { } TEST_F(LlvmLibcPrintfConverterTest, IntConversionSimple) { - __llvm_libc::printf_core::FormatSection section; + LIBC_NAMESPACE::printf_core::FormatSection section; section.has_conv = true; section.raw_string = "%d"; section.conv_name = 'd'; section.conv_val_raw = 12345; - __llvm_libc::printf_core::convert(&writer, section); + LIBC_NAMESPACE::printf_core::convert(&writer, section); wb.buff[wb.buff_cur] = '\0'; @@ -194,16 +194,16 @@ TEST_F(LlvmLibcPrintfConverterTest, IntConversionSimple) { } TEST_F(LlvmLibcPrintfConverterTest, HexConversion) { - __llvm_libc::printf_core::FormatSection section; + LIBC_NAMESPACE::printf_core::FormatSection section; section.has_conv = true; section.raw_string = "%#018x"; section.conv_name = 'x'; - section.flags = static_cast<__llvm_libc::printf_core::FormatFlags>( - __llvm_libc::printf_core::FormatFlags::ALTERNATE_FORM | - __llvm_libc::printf_core::FormatFlags::LEADING_ZEROES); + section.flags = static_cast( + LIBC_NAMESPACE::printf_core::FormatFlags::ALTERNATE_FORM | + LIBC_NAMESPACE::printf_core::FormatFlags::LEADING_ZEROES); section.min_width = 18; section.conv_val_raw = 0x123456ab; - __llvm_libc::printf_core::convert(&writer, section); + LIBC_NAMESPACE::printf_core::convert(&writer, section); wb.buff[wb.buff_cur] = '\0'; ASSERT_STREQ(str, "0x00000000123456ab"); @@ -212,12 +212,12 @@ TEST_F(LlvmLibcPrintfConverterTest, HexConversion) { TEST_F(LlvmLibcPrintfConverterTest, PointerConversion) { - __llvm_libc::printf_core::FormatSection section; + LIBC_NAMESPACE::printf_core::FormatSection section; section.has_conv = true; section.raw_string = "%p"; section.conv_name = 'p'; section.conv_val_ptr = (void *)(0x123456ab); - __llvm_libc::printf_core::convert(&writer, section); + LIBC_NAMESPACE::printf_core::convert(&writer, section); wb.buff[wb.buff_cur] = '\0'; ASSERT_STREQ(str, "0x123456ab"); @@ -226,12 +226,12 @@ TEST_F(LlvmLibcPrintfConverterTest, PointerConversion) { TEST_F(LlvmLibcPrintfConverterTest, OctConversion) { - __llvm_libc::printf_core::FormatSection section; + LIBC_NAMESPACE::printf_core::FormatSection section; section.has_conv = true; section.raw_string = "%o"; section.conv_name = 'o'; section.conv_val_raw = 01234; - __llvm_libc::printf_core::convert(&writer, section); + LIBC_NAMESPACE::printf_core::convert(&writer, section); wb.buff[wb.buff_cur] = '\0'; ASSERT_STREQ(str, "1234"); diff --git a/libc/test/src/stdio/printf_core/parser_test.cpp b/libc/test/src/stdio/printf_core/parser_test.cpp index 910b611f5194939c3a858c1721c72deab0457654..0134277c4a1b2dde9c7fbcea1fdb3e80bcaa9a1a 100644 --- a/libc/test/src/stdio/printf_core/parser_test.cpp +++ b/libc/test/src/stdio/printf_core/parser_test.cpp @@ -16,8 +16,8 @@ #include "test/UnitTest/PrintfMatcher.h" #include "test/UnitTest/Test.h" -using __llvm_libc::cpp::string_view; -using __llvm_libc::internal::ArgList; +using LIBC_NAMESPACE::cpp::string_view; +using LIBC_NAMESPACE::internal::ArgList; void init(const char *__restrict str, ...) { va_list vlist; @@ -25,17 +25,17 @@ void init(const char *__restrict str, ...) { ArgList v(vlist); va_end(vlist); - __llvm_libc::printf_core::Parser parser(str, v); + LIBC_NAMESPACE::printf_core::Parser parser(str, v); } -void evaluate(__llvm_libc::printf_core::FormatSection *format_arr, +void evaluate(LIBC_NAMESPACE::printf_core::FormatSection *format_arr, const char *__restrict str, ...) { va_list vlist; va_start(vlist, str); ArgList v(vlist); va_end(vlist); - __llvm_libc::printf_core::Parser parser(str, v); + LIBC_NAMESPACE::printf_core::Parser parser(str, v); for (auto cur_section = parser.get_next_section(); !cur_section.raw_string.empty(); @@ -48,11 +48,11 @@ void evaluate(__llvm_libc::printf_core::FormatSection *format_arr, TEST(LlvmLibcPrintfParserTest, Constructor) { init("test", 1, 2); } TEST(LlvmLibcPrintfParserTest, EvalRaw) { - __llvm_libc::printf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::printf_core::FormatSection format_arr[10]; const char *str = "test"; evaluate(format_arr, str); - __llvm_libc::printf_core::FormatSection expected; + LIBC_NAMESPACE::printf_core::FormatSection expected; expected.has_conv = false; expected.raw_string = {str, 4}; @@ -62,11 +62,11 @@ TEST(LlvmLibcPrintfParserTest, EvalRaw) { } TEST(LlvmLibcPrintfParserTest, EvalSimple) { - __llvm_libc::printf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::printf_core::FormatSection format_arr[10]; const char *str = "test %% test"; evaluate(format_arr, str); - __llvm_libc::printf_core::FormatSection expected0, expected1, expected2; + LIBC_NAMESPACE::printf_core::FormatSection expected0, expected1, expected2; expected0.has_conv = false; expected0.raw_string = {str, 5}; @@ -88,12 +88,12 @@ TEST(LlvmLibcPrintfParserTest, EvalSimple) { } TEST(LlvmLibcPrintfParserTest, EvalOneArg) { - __llvm_libc::printf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::printf_core::FormatSection format_arr[10]; const char *str = "%d"; int arg1 = 12345; evaluate(format_arr, str, arg1); - __llvm_libc::printf_core::FormatSection expected; + LIBC_NAMESPACE::printf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = {str, 2}; @@ -104,12 +104,12 @@ TEST(LlvmLibcPrintfParserTest, EvalOneArg) { } TEST(LlvmLibcPrintfParserTest, EvalBadArg) { - __llvm_libc::printf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::printf_core::FormatSection format_arr[10]; const char *str = "%\0abc"; int arg1 = 12345; evaluate(format_arr, str, arg1); - __llvm_libc::printf_core::FormatSection expected; + LIBC_NAMESPACE::printf_core::FormatSection expected; expected.has_conv = false; expected.raw_string = {str, 1}; @@ -117,21 +117,21 @@ TEST(LlvmLibcPrintfParserTest, EvalBadArg) { } TEST(LlvmLibcPrintfParserTest, EvalOneArgWithFlags) { - __llvm_libc::printf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::printf_core::FormatSection format_arr[10]; const char *str = "%+-0 #d"; int arg1 = 12345; evaluate(format_arr, str, arg1); - __llvm_libc::printf_core::FormatSection expected; + LIBC_NAMESPACE::printf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = {str, 7}; - expected.flags = static_cast<__llvm_libc::printf_core::FormatFlags>( - __llvm_libc::printf_core::FormatFlags::FORCE_SIGN | - __llvm_libc::printf_core::FormatFlags::LEFT_JUSTIFIED | - __llvm_libc::printf_core::FormatFlags::LEADING_ZEROES | - __llvm_libc::printf_core::FormatFlags::SPACE_PREFIX | - __llvm_libc::printf_core::FormatFlags::ALTERNATE_FORM); + expected.flags = static_cast( + LIBC_NAMESPACE::printf_core::FormatFlags::FORCE_SIGN | + LIBC_NAMESPACE::printf_core::FormatFlags::LEFT_JUSTIFIED | + LIBC_NAMESPACE::printf_core::FormatFlags::LEADING_ZEROES | + LIBC_NAMESPACE::printf_core::FormatFlags::SPACE_PREFIX | + LIBC_NAMESPACE::printf_core::FormatFlags::ALTERNATE_FORM); expected.conv_val_raw = arg1; expected.conv_name = 'd'; @@ -139,12 +139,12 @@ TEST(LlvmLibcPrintfParserTest, EvalOneArgWithFlags) { } TEST(LlvmLibcPrintfParserTest, EvalOneArgWithWidth) { - __llvm_libc::printf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::printf_core::FormatSection format_arr[10]; const char *str = "%12d"; int arg1 = 12345; evaluate(format_arr, str, arg1); - __llvm_libc::printf_core::FormatSection expected; + LIBC_NAMESPACE::printf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = {str, 4}; @@ -156,12 +156,12 @@ TEST(LlvmLibcPrintfParserTest, EvalOneArgWithWidth) { } TEST(LlvmLibcPrintfParserTest, EvalOneArgWithPrecision) { - __llvm_libc::printf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::printf_core::FormatSection format_arr[10]; const char *str = "%.34d"; int arg1 = 12345; evaluate(format_arr, str, arg1); - __llvm_libc::printf_core::FormatSection expected; + LIBC_NAMESPACE::printf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = {str, 5}; @@ -173,12 +173,12 @@ TEST(LlvmLibcPrintfParserTest, EvalOneArgWithPrecision) { } TEST(LlvmLibcPrintfParserTest, EvalOneArgWithTrivialPrecision) { - __llvm_libc::printf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::printf_core::FormatSection format_arr[10]; const char *str = "%.d"; int arg1 = 12345; evaluate(format_arr, str, arg1); - __llvm_libc::printf_core::FormatSection expected; + LIBC_NAMESPACE::printf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = {str, 3}; @@ -190,16 +190,16 @@ TEST(LlvmLibcPrintfParserTest, EvalOneArgWithTrivialPrecision) { } TEST(LlvmLibcPrintfParserTest, EvalOneArgWithShortLengthModifier) { - __llvm_libc::printf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::printf_core::FormatSection format_arr[10]; const char *str = "%hd"; int arg1 = 12345; evaluate(format_arr, str, arg1); - __llvm_libc::printf_core::FormatSection expected; + LIBC_NAMESPACE::printf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = {str, 3}; - expected.length_modifier = __llvm_libc::printf_core::LengthModifier::h; + expected.length_modifier = LIBC_NAMESPACE::printf_core::LengthModifier::h; expected.conv_val_raw = arg1; expected.conv_name = 'd'; @@ -207,16 +207,16 @@ TEST(LlvmLibcPrintfParserTest, EvalOneArgWithShortLengthModifier) { } TEST(LlvmLibcPrintfParserTest, EvalOneArgWithLongLengthModifier) { - __llvm_libc::printf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::printf_core::FormatSection format_arr[10]; const char *str = "%lld"; long long arg1 = 12345; evaluate(format_arr, str, arg1); - __llvm_libc::printf_core::FormatSection expected; + LIBC_NAMESPACE::printf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = {str, 4}; - expected.length_modifier = __llvm_libc::printf_core::LengthModifier::ll; + expected.length_modifier = LIBC_NAMESPACE::printf_core::LengthModifier::ll; expected.conv_val_raw = arg1; expected.conv_name = 'd'; @@ -224,22 +224,22 @@ TEST(LlvmLibcPrintfParserTest, EvalOneArgWithLongLengthModifier) { } TEST(LlvmLibcPrintfParserTest, EvalOneArgWithAllOptions) { - __llvm_libc::printf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::printf_core::FormatSection format_arr[10]; const char *str = "% -056.78jd"; intmax_t arg1 = 12345; evaluate(format_arr, str, arg1); - __llvm_libc::printf_core::FormatSection expected; + LIBC_NAMESPACE::printf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = {str, 11}; - expected.flags = static_cast<__llvm_libc::printf_core::FormatFlags>( - __llvm_libc::printf_core::FormatFlags::LEFT_JUSTIFIED | - __llvm_libc::printf_core::FormatFlags::LEADING_ZEROES | - __llvm_libc::printf_core::FormatFlags::SPACE_PREFIX); + expected.flags = static_cast( + LIBC_NAMESPACE::printf_core::FormatFlags::LEFT_JUSTIFIED | + LIBC_NAMESPACE::printf_core::FormatFlags::LEADING_ZEROES | + LIBC_NAMESPACE::printf_core::FormatFlags::SPACE_PREFIX); expected.min_width = 56; expected.precision = 78; - expected.length_modifier = __llvm_libc::printf_core::LengthModifier::j; + expected.length_modifier = LIBC_NAMESPACE::printf_core::LengthModifier::j; expected.conv_val_raw = arg1; expected.conv_name = 'd'; @@ -247,14 +247,14 @@ TEST(LlvmLibcPrintfParserTest, EvalOneArgWithAllOptions) { } TEST(LlvmLibcPrintfParserTest, EvalThreeArgs) { - __llvm_libc::printf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::printf_core::FormatSection format_arr[10]; const char *str = "%d%f%s"; int arg1 = 12345; double arg2 = 123.45; const char *arg3 = "12345"; evaluate(format_arr, str, arg1, arg2, arg3); - __llvm_libc::printf_core::FormatSection expected0, expected1, expected2; + LIBC_NAMESPACE::printf_core::FormatSection expected0, expected1, expected2; expected0.has_conv = true; expected0.raw_string = {str, 2}; @@ -266,7 +266,7 @@ TEST(LlvmLibcPrintfParserTest, EvalThreeArgs) { expected1.has_conv = true; expected1.raw_string = {str + 2, 2}; - expected1.conv_val_raw = __llvm_libc::cpp::bit_cast(arg2); + expected1.conv_val_raw = LIBC_NAMESPACE::cpp::bit_cast(arg2); expected1.conv_name = 'f'; ASSERT_PFORMAT_EQ(expected1, format_arr[1]); @@ -283,12 +283,12 @@ TEST(LlvmLibcPrintfParserTest, EvalThreeArgs) { #ifndef LIBC_COPT_PRINTF_DISABLE_INDEX_MODE TEST(LlvmLibcPrintfParserTest, IndexModeOneArg) { - __llvm_libc::printf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::printf_core::FormatSection format_arr[10]; const char *str = "%1$d"; int arg1 = 12345; evaluate(format_arr, str, arg1); - __llvm_libc::printf_core::FormatSection expected; + LIBC_NAMESPACE::printf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = {str, 4}; @@ -299,14 +299,14 @@ TEST(LlvmLibcPrintfParserTest, IndexModeOneArg) { } TEST(LlvmLibcPrintfParserTest, IndexModeThreeArgsSequential) { - __llvm_libc::printf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::printf_core::FormatSection format_arr[10]; const char *str = "%1$d%2$f%3$s"; int arg1 = 12345; double arg2 = 123.45; const char *arg3 = "12345"; evaluate(format_arr, str, arg1, arg2, arg3); - __llvm_libc::printf_core::FormatSection expected0, expected1, expected2; + LIBC_NAMESPACE::printf_core::FormatSection expected0, expected1, expected2; expected0.has_conv = true; expected0.raw_string = {str, 4}; @@ -318,7 +318,7 @@ TEST(LlvmLibcPrintfParserTest, IndexModeThreeArgsSequential) { expected1.has_conv = true; expected1.raw_string = {str + 4, 4}; - expected1.conv_val_raw = __llvm_libc::cpp::bit_cast(arg2); + expected1.conv_val_raw = LIBC_NAMESPACE::cpp::bit_cast(arg2); expected1.conv_name = 'f'; ASSERT_PFORMAT_EQ(expected1, format_arr[1]); @@ -333,14 +333,14 @@ TEST(LlvmLibcPrintfParserTest, IndexModeThreeArgsSequential) { } TEST(LlvmLibcPrintfParserTest, IndexModeThreeArgsReverse) { - __llvm_libc::printf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::printf_core::FormatSection format_arr[10]; const char *str = "%3$d%2$f%1$s"; int arg1 = 12345; double arg2 = 123.45; const char *arg3 = "12345"; evaluate(format_arr, str, arg3, arg2, arg1); - __llvm_libc::printf_core::FormatSection expected0, expected1, expected2; + LIBC_NAMESPACE::printf_core::FormatSection expected0, expected1, expected2; expected0.has_conv = true; expected0.raw_string = {str, 4}; @@ -352,7 +352,7 @@ TEST(LlvmLibcPrintfParserTest, IndexModeThreeArgsReverse) { expected1.has_conv = true; expected1.raw_string = {str + 4, 4}; - expected1.conv_val_raw = __llvm_libc::cpp::bit_cast(arg2); + expected1.conv_val_raw = LIBC_NAMESPACE::cpp::bit_cast(arg2); expected1.conv_name = 'f'; ASSERT_PFORMAT_EQ(expected1, format_arr[1]); @@ -367,14 +367,14 @@ TEST(LlvmLibcPrintfParserTest, IndexModeThreeArgsReverse) { } TEST(LlvmLibcPrintfParserTest, IndexModeTenArgsRandom) { - __llvm_libc::printf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::printf_core::FormatSection format_arr[10]; const char *str = "%6$d%3$d%7$d%2$d%8$d%1$d%4$d%9$d%5$d%10$d"; int args[10] = {6, 4, 2, 7, 9, 1, 3, 5, 8, 10}; evaluate(format_arr, str, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]); for (size_t i = 0; i < 10; ++i) { - __llvm_libc::printf_core::FormatSection expected; + LIBC_NAMESPACE::printf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = {str + (4 * i), @@ -386,7 +386,7 @@ TEST(LlvmLibcPrintfParserTest, IndexModeTenArgsRandom) { } TEST(LlvmLibcPrintfParserTest, IndexModeComplexParsing) { - __llvm_libc::printf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::printf_core::FormatSection format_arr[10]; const char *str = "normal text %3$llu %% %2$ *4$f %2$ .*4$f %1$1.1c"; char arg1 = '1'; double arg2 = 123.45; @@ -394,7 +394,7 @@ TEST(LlvmLibcPrintfParserTest, IndexModeComplexParsing) { int arg4 = 10; evaluate(format_arr, str, arg1, arg2, arg3, arg4); - __llvm_libc::printf_core::FormatSection expected0, expected1, expected2, + LIBC_NAMESPACE::printf_core::FormatSection expected0, expected1, expected2, expected3, expected4, expected5, expected6, expected7, expected8, expected9; @@ -407,7 +407,7 @@ TEST(LlvmLibcPrintfParserTest, IndexModeComplexParsing) { expected1.has_conv = true; expected1.raw_string = {str + 12, 6}; - expected1.length_modifier = __llvm_libc::printf_core::LengthModifier::ll; + expected1.length_modifier = LIBC_NAMESPACE::printf_core::LengthModifier::ll; expected1.conv_val_raw = arg3; expected1.conv_name = 'u'; @@ -435,9 +435,9 @@ TEST(LlvmLibcPrintfParserTest, IndexModeComplexParsing) { expected5.has_conv = true; expected5.raw_string = {str + 22, 8}; - expected5.flags = __llvm_libc::printf_core::FormatFlags::SPACE_PREFIX; + expected5.flags = LIBC_NAMESPACE::printf_core::FormatFlags::SPACE_PREFIX; expected5.min_width = arg4; - expected5.conv_val_raw = __llvm_libc::cpp::bit_cast(arg2); + expected5.conv_val_raw = LIBC_NAMESPACE::cpp::bit_cast(arg2); expected5.conv_name = 'f'; EXPECT_PFORMAT_EQ(expected5, format_arr[5]); @@ -451,9 +451,9 @@ TEST(LlvmLibcPrintfParserTest, IndexModeComplexParsing) { expected7.has_conv = true; expected7.raw_string = {str + 31, 9}; - expected7.flags = __llvm_libc::printf_core::FormatFlags::SPACE_PREFIX; + expected7.flags = LIBC_NAMESPACE::printf_core::FormatFlags::SPACE_PREFIX; expected7.precision = arg4; - expected7.conv_val_raw = __llvm_libc::cpp::bit_cast(arg2); + expected7.conv_val_raw = LIBC_NAMESPACE::cpp::bit_cast(arg2); expected7.conv_name = 'f'; EXPECT_PFORMAT_EQ(expected7, format_arr[7]); @@ -476,7 +476,7 @@ TEST(LlvmLibcPrintfParserTest, IndexModeComplexParsing) { } TEST(LlvmLibcPrintfParserTest, IndexModeGapCheck) { - __llvm_libc::printf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::printf_core::FormatSection format_arr[10]; const char *str = "%1$d%2$d%4$d"; int arg1 = 1; int arg2 = 2; @@ -485,7 +485,7 @@ TEST(LlvmLibcPrintfParserTest, IndexModeGapCheck) { evaluate(format_arr, str, arg1, arg2, arg3, arg4); - __llvm_libc::printf_core::FormatSection expected0, expected1, expected2; + LIBC_NAMESPACE::printf_core::FormatSection expected0, expected1, expected2; expected0.has_conv = true; expected0.raw_string = {str, 4}; @@ -508,11 +508,11 @@ TEST(LlvmLibcPrintfParserTest, IndexModeGapCheck) { } TEST(LlvmLibcPrintfParserTest, IndexModeTrailingPercentCrash) { - __llvm_libc::printf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::printf_core::FormatSection format_arr[10]; const char *str = "%2$d%"; evaluate(format_arr, str, 1, 2); - __llvm_libc::printf_core::FormatSection expected0, expected1; + LIBC_NAMESPACE::printf_core::FormatSection expected0, expected1; expected0.has_conv = false; expected0.raw_string = {str, 4}; @@ -525,7 +525,7 @@ TEST(LlvmLibcPrintfParserTest, IndexModeTrailingPercentCrash) { } TEST(LlvmLibcPrintfParserTest, DoublePercentIsAllowedInvalidIndex) { - __llvm_libc::printf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::printf_core::FormatSection format_arr[10]; // Normally this conversion specifier would be raw (due to having a width // defined as an invalid argument) but since it's a % conversion it's allowed @@ -541,7 +541,7 @@ TEST(LlvmLibcPrintfParserTest, DoublePercentIsAllowedInvalidIndex) { evaluate(format_arr, str, 1, 2); - __llvm_libc::printf_core::FormatSection expected0; + LIBC_NAMESPACE::printf_core::FormatSection expected0; expected0.has_conv = true; expected0.raw_string = str; diff --git a/libc/test/src/stdio/printf_core/writer_test.cpp b/libc/test/src/stdio/printf_core/writer_test.cpp index f31ff91d64960e83debd84fee37833e8f86d941b..4fe5ffb4aa989124ca6d841a78308d818ff109d4 100644 --- a/libc/test/src/stdio/printf_core/writer_test.cpp +++ b/libc/test/src/stdio/printf_core/writer_test.cpp @@ -13,9 +13,9 @@ #include "test/UnitTest/Test.h" -using __llvm_libc::cpp::string_view; -using __llvm_libc::printf_core::WriteBuffer; -using __llvm_libc::printf_core::Writer; +using LIBC_NAMESPACE::cpp::string_view; +using LIBC_NAMESPACE::printf_core::WriteBuffer; +using LIBC_NAMESPACE::printf_core::Writer; TEST(LlvmLibcPrintfWriterTest, Constructor) { char str[10]; @@ -200,8 +200,8 @@ int copy_to_out(string_view new_str, void *raw_out_buff) { OutBuff *out_buff = reinterpret_cast(raw_out_buff); - __llvm_libc::inline_memcpy(out_buff->out_str + out_buff->cur_pos, - new_str.data(), new_str.size()); + LIBC_NAMESPACE::inline_memcpy(out_buff->out_str + out_buff->cur_pos, + new_str.data(), new_str.size()); out_buff->cur_pos += new_str.size(); return 0; diff --git a/libc/test/src/stdio/printf_test.cpp b/libc/test/src/stdio/printf_test.cpp index e2e3675d443dd71ab52e1cf663f5f1b2118aebd7..147d17bb4271f17eedf32b342a950e9e75e7b539 100644 --- a/libc/test/src/stdio/printf_test.cpp +++ b/libc/test/src/stdio/printf_test.cpp @@ -14,16 +14,16 @@ TEST(LlvmLibcPrintfTest, PrintOut) { int written; constexpr char simple[] = "A simple string with no conversions.\n"; - written = __llvm_libc::printf(simple); + written = LIBC_NAMESPACE::printf(simple); EXPECT_EQ(written, static_cast(sizeof(simple) - 1)); constexpr char numbers[] = "1234567890\n"; - written = __llvm_libc::printf("%s", numbers); + written = LIBC_NAMESPACE::printf("%s", numbers); EXPECT_EQ(written, static_cast(sizeof(numbers) - 1)); constexpr char format_more[] = "%s and more\n"; constexpr char short_numbers[] = "1234"; - written = __llvm_libc::printf(format_more, short_numbers); + written = LIBC_NAMESPACE::printf(format_more, short_numbers); EXPECT_EQ(written, static_cast(sizeof(format_more) + sizeof(short_numbers) - 4)); } diff --git a/libc/test/src/stdio/putc_test.cpp b/libc/test/src/stdio/putc_test.cpp index 0bd3acc70ed85ca79f6bf9faf837b0ccdafdd798..7349a97d80e19dc01a5b4177c0b0e3082bedcea1 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 a9fe1717783fd34607c6d27000e52b798fed67fe..e9ce46eaa3190a83aa31bb6b42becbe1e0a9d722 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 dab1c80943f2117058c2bbc35b3db801848c6445..ce4a1352d1cc1a55b3262962267357e0492cc488 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 97cb77e91c9b2c6cd1e36c7ba93912c2950faa43..c760debc1af4380ccef4798090ae9922629afbc2 100644 --- a/libc/test/src/stdio/scanf_core/converter_test.cpp +++ b/libc/test/src/stdio/scanf_core/converter_test.cpp @@ -16,159 +16,159 @@ TEST(LlvmLibcScanfConverterTest, RawMatchBasic) { const char *str = "abcdef"; - __llvm_libc::scanf_core::StringReader str_reader(str); - __llvm_libc::scanf_core::Reader reader(&str_reader); + LIBC_NAMESPACE::scanf_core::StringReader str_reader(str); + LIBC_NAMESPACE::scanf_core::Reader reader(&str_reader); // Reading "abc" should succeed. - ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, "abc"), - static_cast(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "abc"), + static_cast(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(3)); // Reading nothing should succeed and not advance. - ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, ""), - static_cast(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, ""), + static_cast(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(3)); // Reading a space where there is none should succeed and not advance. - ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, " "), - static_cast(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, " "), + static_cast(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(3)); // Reading "d" should succeed and advance by 1. - ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, "d"), - static_cast(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "d"), + static_cast(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(4)); // Reading "z" should fail and not advance. - ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, "z"), - static_cast(__llvm_libc::scanf_core::MATCHING_FAILURE)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "z"), + static_cast(LIBC_NAMESPACE::scanf_core::MATCHING_FAILURE)); ASSERT_EQ(reader.chars_read(), size_t(4)); // Reading "efgh" should fail but advance to the end. - ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, "efgh"), - static_cast(__llvm_libc::scanf_core::MATCHING_FAILURE)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "efgh"), + static_cast(LIBC_NAMESPACE::scanf_core::MATCHING_FAILURE)); ASSERT_EQ(reader.chars_read(), size_t(6)); } TEST(LlvmLibcScanfConverterTest, RawMatchSpaces) { const char *str = " a \t\n b cd"; - __llvm_libc::scanf_core::StringReader str_reader(str); - __llvm_libc::scanf_core::Reader reader(&str_reader); + LIBC_NAMESPACE::scanf_core::StringReader str_reader(str); + LIBC_NAMESPACE::scanf_core::Reader reader(&str_reader); // Reading "a" should fail and not advance. // Since there's nothing in the format string (the second argument to // raw_match) to match the space in the buffer it isn't consumed. - ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, "a"), - static_cast(__llvm_libc::scanf_core::MATCHING_FAILURE)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "a"), + static_cast(LIBC_NAMESPACE::scanf_core::MATCHING_FAILURE)); ASSERT_EQ(reader.chars_read(), size_t(0)); // Reading " \t\n " should succeed and advance past the space. // Any number of space characters in the format string match 0 or more space // characters in the buffer. - ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, " \t\n "), - static_cast(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, " \t\n "), + static_cast(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(1)); // Reading "ab" should fail and only advance past the a // The a characters match, but the format string doesn't have anything to // consume the spaces in the buffer, so it fails. - ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, "ab"), - static_cast(__llvm_libc::scanf_core::MATCHING_FAILURE)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "ab"), + static_cast(LIBC_NAMESPACE::scanf_core::MATCHING_FAILURE)); ASSERT_EQ(reader.chars_read(), size_t(2)); // Reading " b" should succeed and advance past the b // Any number of space characters in the format string matches 0 or more space // characters in the buffer. - ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, " b"), - static_cast(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, " b"), + static_cast(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(7)); // Reading "\t" should succeed and advance past the spaces to the c - ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, "\t"), - static_cast(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "\t"), + static_cast(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(10)); // Reading "c d" should succeed and advance past the d. // Here the space character in the format string is matching 0 space // characters in the buffer. - ASSERT_EQ(__llvm_libc::scanf_core::raw_match(&reader, "c d"), - static_cast(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::raw_match(&reader, "c d"), + static_cast(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(12)); } TEST(LlvmLibcScanfConverterTest, StringConvSimple) { const char *str = "abcDEF123 654LKJihg"; char result[20]; - __llvm_libc::scanf_core::StringReader str_reader(str); - __llvm_libc::scanf_core::Reader reader(&str_reader); + LIBC_NAMESPACE::scanf_core::StringReader str_reader(str); + LIBC_NAMESPACE::scanf_core::Reader reader(&str_reader); - __llvm_libc::scanf_core::FormatSection conv; + LIBC_NAMESPACE::scanf_core::FormatSection conv; conv.has_conv = true; conv.conv_name = 's'; conv.output_ptr = result; - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(9)); ASSERT_STREQ(result, "abcDEF123"); //%s skips all spaces before beginning to read. - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(19)); ASSERT_STREQ(result, "654LKJihg"); } TEST(LlvmLibcScanfConverterTest, StringConvNoWrite) { const char *str = "abcDEF123 654LKJihg"; - __llvm_libc::scanf_core::StringReader str_reader(str); - __llvm_libc::scanf_core::Reader reader(&str_reader); + LIBC_NAMESPACE::scanf_core::StringReader str_reader(str); + LIBC_NAMESPACE::scanf_core::Reader reader(&str_reader); - __llvm_libc::scanf_core::FormatSection conv; + LIBC_NAMESPACE::scanf_core::FormatSection conv; conv.has_conv = true; conv.conv_name = 's'; - conv.flags = __llvm_libc::scanf_core::NO_WRITE; + conv.flags = LIBC_NAMESPACE::scanf_core::NO_WRITE; - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(9)); //%s skips all spaces before beginning to read. - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(19)); } TEST(LlvmLibcScanfConverterTest, StringConvWidth) { const char *str = "abcDEF123 654LKJihg"; char result[6]; - __llvm_libc::scanf_core::StringReader str_reader(str); - __llvm_libc::scanf_core::Reader reader(&str_reader); + LIBC_NAMESPACE::scanf_core::StringReader str_reader(str); + LIBC_NAMESPACE::scanf_core::Reader reader(&str_reader); - __llvm_libc::scanf_core::FormatSection conv; + LIBC_NAMESPACE::scanf_core::FormatSection conv; conv.has_conv = true; conv.conv_name = 's'; conv.max_width = 5; // this means the result takes up 6 characters (with \0). conv.output_ptr = result; - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(5)); ASSERT_STREQ(result, "abcDE"); - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(9)); ASSERT_STREQ(result, "F123"); //%s skips all spaces before beginning to read. - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(15)); ASSERT_STREQ(result, "654LK"); - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(19)); ASSERT_STREQ(result, "Jihg"); } @@ -176,70 +176,70 @@ TEST(LlvmLibcScanfConverterTest, StringConvWidth) { TEST(LlvmLibcScanfConverterTest, CharsConv) { const char *str = "abcDEF123 654LKJihg MNOpqr&*("; char result[20]; - __llvm_libc::scanf_core::StringReader str_reader(str); - __llvm_libc::scanf_core::Reader reader(&str_reader); + LIBC_NAMESPACE::scanf_core::StringReader str_reader(str); + LIBC_NAMESPACE::scanf_core::Reader reader(&str_reader); - __llvm_libc::scanf_core::FormatSection conv; + LIBC_NAMESPACE::scanf_core::FormatSection conv; conv.has_conv = true; conv.conv_name = 'c'; conv.output_ptr = result; - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(1)); ASSERT_EQ(result[0], 'a'); - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(2)); ASSERT_EQ(result[0], 'b'); - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(3)); ASSERT_EQ(result[0], 'c'); // Switch from character by character to 8 at a time. conv.max_width = 8; - __llvm_libc::cpp::string_view result_view(result, 8); + LIBC_NAMESPACE::cpp::string_view result_view(result, 8); //%c doesn't stop on spaces. - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(11)); - ASSERT_EQ(result_view, __llvm_libc::cpp::string_view("DEF123 6", 8)); + ASSERT_EQ(result_view, LIBC_NAMESPACE::cpp::string_view("DEF123 6", 8)); - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(19)); - ASSERT_EQ(result_view, __llvm_libc::cpp::string_view("54LKJihg", 8)); + ASSERT_EQ(result_view, LIBC_NAMESPACE::cpp::string_view("54LKJihg", 8)); //%c also doesn't skip spaces at the start. - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(27)); - ASSERT_EQ(result_view, __llvm_libc::cpp::string_view(" MNOpqr&", 8)); + ASSERT_EQ(result_view, LIBC_NAMESPACE::cpp::string_view(" MNOpqr&", 8)); //%c will stop on a null byte though. - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(29)); - ASSERT_EQ(__llvm_libc::cpp::string_view(result, 2), - __llvm_libc::cpp::string_view("*(", 2)); + ASSERT_EQ(LIBC_NAMESPACE::cpp::string_view(result, 2), + LIBC_NAMESPACE::cpp::string_view("*(", 2)); } TEST(LlvmLibcScanfConverterTest, ScansetConv) { const char *str = "abcDEF[123] 654LKJihg"; char result[20]; - __llvm_libc::scanf_core::StringReader str_reader(str); - __llvm_libc::scanf_core::Reader reader(&str_reader); + LIBC_NAMESPACE::scanf_core::StringReader str_reader(str); + LIBC_NAMESPACE::scanf_core::Reader reader(&str_reader); - __llvm_libc::scanf_core::FormatSection conv; + LIBC_NAMESPACE::scanf_core::FormatSection conv; conv.has_conv = true; conv.conv_name = '['; conv.output_ptr = result; - __llvm_libc::cpp::bitset<256> bitset1; + LIBC_NAMESPACE::cpp::bitset<256> bitset1; bitset1.set_range('a', 'c'); bitset1.set_range('D', 'F'); bitset1.set_range('1', '6'); @@ -248,48 +248,48 @@ TEST(LlvmLibcScanfConverterTest, ScansetConv) { conv.scan_set = bitset1; - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(11)); - ASSERT_EQ(__llvm_libc::cpp::string_view(result, 11), - __llvm_libc::cpp::string_view("abcDEF[123]", 11)); + ASSERT_EQ(LIBC_NAMESPACE::cpp::string_view(result, 11), + LIBC_NAMESPACE::cpp::string_view("abcDEF[123]", 11)); // The scanset conversion doesn't consume leading spaces. If it did it would // return "654" here. - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast(__llvm_libc::scanf_core::MATCHING_FAILURE)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(LIBC_NAMESPACE::scanf_core::MATCHING_FAILURE)); ASSERT_EQ(reader.chars_read(), size_t(11)); // This set is everything except for a-g. - __llvm_libc::cpp::bitset<256> bitset2; + LIBC_NAMESPACE::cpp::bitset<256> bitset2; bitset2.set_range('a', 'g'); bitset2.flip(); conv.scan_set = bitset2; conv.max_width = 5; - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(16)); - ASSERT_EQ(__llvm_libc::cpp::string_view(result, 5), - __llvm_libc::cpp::string_view(" 654L", 5)); + ASSERT_EQ(LIBC_NAMESPACE::cpp::string_view(result, 5), + LIBC_NAMESPACE::cpp::string_view(" 654L", 5)); - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(20)); - ASSERT_EQ(__llvm_libc::cpp::string_view(result, 4), - __llvm_libc::cpp::string_view("KJih", 4)); + ASSERT_EQ(LIBC_NAMESPACE::cpp::string_view(result, 4), + LIBC_NAMESPACE::cpp::string_view("KJih", 4)); // This set is g and '\0'. - __llvm_libc::cpp::bitset<256> bitset3; + LIBC_NAMESPACE::cpp::bitset<256> bitset3; bitset3.set('g'); bitset3.set('\0'); conv.scan_set = bitset3; // Even though '\0' is in the scanset, it should still stop on it. - ASSERT_EQ(__llvm_libc::scanf_core::convert(&reader, conv), - static_cast(__llvm_libc::scanf_core::READ_OK)); + ASSERT_EQ(LIBC_NAMESPACE::scanf_core::convert(&reader, conv), + static_cast(LIBC_NAMESPACE::scanf_core::READ_OK)); ASSERT_EQ(reader.chars_read(), size_t(21)); - ASSERT_EQ(__llvm_libc::cpp::string_view(result, 1), - __llvm_libc::cpp::string_view("g", 1)); + ASSERT_EQ(LIBC_NAMESPACE::cpp::string_view(result, 1), + LIBC_NAMESPACE::cpp::string_view("g", 1)); } diff --git a/libc/test/src/stdio/scanf_core/parser_test.cpp b/libc/test/src/stdio/scanf_core/parser_test.cpp index b1f9efa0f8a2bc76c2bd583cc0bf34a5585397c5..c81edbd8c0963aaae85d63ac30bc93faf9e7a6c1 100644 --- a/libc/test/src/stdio/scanf_core/parser_test.cpp +++ b/libc/test/src/stdio/scanf_core/parser_test.cpp @@ -17,8 +17,8 @@ #include "test/UnitTest/ScanfMatcher.h" #include "test/UnitTest/Test.h" -using __llvm_libc::cpp::string_view; -using __llvm_libc::internal::ArgList; +using LIBC_NAMESPACE::cpp::string_view; +using LIBC_NAMESPACE::internal::ArgList; void init(const char *__restrict str, ...) { va_list vlist; @@ -26,17 +26,17 @@ void init(const char *__restrict str, ...) { ArgList v(vlist); va_end(vlist); - __llvm_libc::scanf_core::Parser parser(str, v); + LIBC_NAMESPACE::scanf_core::Parser parser(str, v); } -void evaluate(__llvm_libc::scanf_core::FormatSection *format_arr, +void evaluate(LIBC_NAMESPACE::scanf_core::FormatSection *format_arr, const char *__restrict str, ...) { va_list vlist; va_start(vlist, str); - __llvm_libc::internal::ArgList v(vlist); + LIBC_NAMESPACE::internal::ArgList v(vlist); va_end(vlist); - __llvm_libc::scanf_core::Parser parser(str, v); + LIBC_NAMESPACE::scanf_core::Parser parser(str, v); for (auto cur_section = parser.get_next_section(); !cur_section.raw_string.empty(); @@ -49,11 +49,11 @@ void evaluate(__llvm_libc::scanf_core::FormatSection *format_arr, TEST(LlvmLibcScanfParserTest, Constructor) { init("test", 1, 2); } TEST(LlvmLibcScanfParserTest, EvalRaw) { - __llvm_libc::scanf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10]; const char *str = "test"; evaluate(format_arr, str); - __llvm_libc::scanf_core::FormatSection expected; + LIBC_NAMESPACE::scanf_core::FormatSection expected; expected.has_conv = false; expected.raw_string = str; @@ -63,11 +63,11 @@ TEST(LlvmLibcScanfParserTest, EvalRaw) { } TEST(LlvmLibcScanfParserTest, EvalSimple) { - __llvm_libc::scanf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10]; const char *str = "test %% test"; evaluate(format_arr, str); - __llvm_libc::scanf_core::FormatSection expected0, expected1, expected2; + LIBC_NAMESPACE::scanf_core::FormatSection expected0, expected1, expected2; expected0.has_conv = false; expected0.raw_string = {str, 5}; @@ -89,12 +89,12 @@ TEST(LlvmLibcScanfParserTest, EvalSimple) { } TEST(LlvmLibcScanfParserTest, EvalOneArg) { - __llvm_libc::scanf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10]; const char *str = "%d"; int arg1 = 12345; evaluate(format_arr, str, &arg1); - __llvm_libc::scanf_core::FormatSection expected; + LIBC_NAMESPACE::scanf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = str; @@ -105,12 +105,12 @@ TEST(LlvmLibcScanfParserTest, EvalOneArg) { } TEST(LlvmLibcScanfParserTest, EvalBadArg) { - __llvm_libc::scanf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10]; const char *str = "%\0abc"; int arg1 = 12345; evaluate(format_arr, str, &arg1); - __llvm_libc::scanf_core::FormatSection expected; + LIBC_NAMESPACE::scanf_core::FormatSection expected; expected.has_conv = false; expected.raw_string = {str, 1}; @@ -118,7 +118,7 @@ TEST(LlvmLibcScanfParserTest, EvalBadArg) { } TEST(LlvmLibcScanfParserTest, EvalOneArgWithFlag) { - __llvm_libc::scanf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10]; const char *str = "%*d"; // Since NO_WRITE is set, the argument shouldn't be used, but I've included // one anyways because in the case that it doesn't work it's better for it to @@ -126,11 +126,11 @@ TEST(LlvmLibcScanfParserTest, EvalOneArgWithFlag) { int arg1 = 12345; evaluate(format_arr, str, &arg1); - __llvm_libc::scanf_core::FormatSection expected; + LIBC_NAMESPACE::scanf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = str; - expected.flags = __llvm_libc::scanf_core::FormatFlags::NO_WRITE; + expected.flags = LIBC_NAMESPACE::scanf_core::FormatFlags::NO_WRITE; expected.conv_name = 'd'; ASSERT_SFORMAT_EQ(expected, format_arr[0]); @@ -142,12 +142,12 @@ TEST(LlvmLibcScanfParserTest, EvalOneArgWithFlag) { } TEST(LlvmLibcScanfParserTest, EvalOneArgWithWidth) { - __llvm_libc::scanf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10]; const char *str = "%12d"; int arg1 = 12345; evaluate(format_arr, str, &arg1); - __llvm_libc::scanf_core::FormatSection expected; + LIBC_NAMESPACE::scanf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = str; @@ -159,16 +159,16 @@ TEST(LlvmLibcScanfParserTest, EvalOneArgWithWidth) { } TEST(LlvmLibcScanfParserTest, EvalOneArgWithShortLengthModifier) { - __llvm_libc::scanf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10]; const char *str = "%hd"; int arg1 = 12345; evaluate(format_arr, str, &arg1); - __llvm_libc::scanf_core::FormatSection expected; + LIBC_NAMESPACE::scanf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = str; - expected.length_modifier = __llvm_libc::scanf_core::LengthModifier::h; + expected.length_modifier = LIBC_NAMESPACE::scanf_core::LengthModifier::h; expected.output_ptr = &arg1; expected.conv_name = 'd'; @@ -176,16 +176,16 @@ TEST(LlvmLibcScanfParserTest, EvalOneArgWithShortLengthModifier) { } TEST(LlvmLibcScanfParserTest, EvalOneArgWithLongLengthModifier) { - __llvm_libc::scanf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10]; const char *str = "%lld"; long long arg1 = 12345; evaluate(format_arr, str, &arg1); - __llvm_libc::scanf_core::FormatSection expected; + LIBC_NAMESPACE::scanf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = str; - expected.length_modifier = __llvm_libc::scanf_core::LengthModifier::ll; + expected.length_modifier = LIBC_NAMESPACE::scanf_core::LengthModifier::ll; expected.output_ptr = &arg1; expected.conv_name = 'd'; @@ -193,37 +193,37 @@ TEST(LlvmLibcScanfParserTest, EvalOneArgWithLongLengthModifier) { } TEST(LlvmLibcScanfParserTest, EvalOneArgWithAllOptions) { - __llvm_libc::scanf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10]; const char *str = "%*56jd"; intmax_t arg1 = 12345; evaluate(format_arr, str, &arg1); - __llvm_libc::scanf_core::FormatSection expected; + LIBC_NAMESPACE::scanf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = str; - expected.flags = __llvm_libc::scanf_core::FormatFlags::NO_WRITE; + expected.flags = LIBC_NAMESPACE::scanf_core::FormatFlags::NO_WRITE; expected.max_width = 56; - expected.length_modifier = __llvm_libc::scanf_core::LengthModifier::j; + expected.length_modifier = LIBC_NAMESPACE::scanf_core::LengthModifier::j; expected.conv_name = 'd'; ASSERT_SFORMAT_EQ(expected, format_arr[0]); } TEST(LlvmLibcScanfParserTest, EvalSimpleBracketArg) { - __llvm_libc::scanf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10]; const char *str = "%[abc]"; char arg1 = 'a'; evaluate(format_arr, str, &arg1); - __llvm_libc::scanf_core::FormatSection expected; + LIBC_NAMESPACE::scanf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = str; expected.conv_name = '['; expected.output_ptr = &arg1; - __llvm_libc::cpp::bitset<256> scan_set; + LIBC_NAMESPACE::cpp::bitset<256> scan_set; scan_set.set('a'); scan_set.set('b'); @@ -235,19 +235,19 @@ TEST(LlvmLibcScanfParserTest, EvalSimpleBracketArg) { } TEST(LlvmLibcScanfParserTest, EvalBracketArgRange) { - __llvm_libc::scanf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10]; const char *str = "%[A-D]"; char arg1 = 'a'; evaluate(format_arr, str, &arg1); - __llvm_libc::scanf_core::FormatSection expected; + LIBC_NAMESPACE::scanf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = str; expected.conv_name = '['; expected.output_ptr = &arg1; - __llvm_libc::cpp::bitset<256> scan_set; + LIBC_NAMESPACE::cpp::bitset<256> scan_set; scan_set.set('A'); scan_set.set('B'); @@ -260,19 +260,19 @@ TEST(LlvmLibcScanfParserTest, EvalBracketArgRange) { } TEST(LlvmLibcScanfParserTest, EvalBracketArgTwoRanges) { - __llvm_libc::scanf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10]; const char *str = "%[A-De-g]"; char arg1 = 'a'; evaluate(format_arr, str, &arg1); - __llvm_libc::scanf_core::FormatSection expected; + LIBC_NAMESPACE::scanf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = str; expected.conv_name = '['; expected.output_ptr = &arg1; - __llvm_libc::cpp::bitset<256> scan_set; + LIBC_NAMESPACE::cpp::bitset<256> scan_set; scan_set.set('A'); scan_set.set('B'); @@ -286,19 +286,19 @@ TEST(LlvmLibcScanfParserTest, EvalBracketArgTwoRanges) { } TEST(LlvmLibcScanfParserTest, EvalBracketArgJustHyphen) { - __llvm_libc::scanf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10]; const char *str = "%[-]"; char arg1 = 'a'; evaluate(format_arr, str, &arg1); - __llvm_libc::scanf_core::FormatSection expected; + LIBC_NAMESPACE::scanf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = str; expected.conv_name = '['; expected.output_ptr = &arg1; - __llvm_libc::cpp::bitset<256> scan_set; + LIBC_NAMESPACE::cpp::bitset<256> scan_set; scan_set.set('-'); @@ -308,19 +308,19 @@ TEST(LlvmLibcScanfParserTest, EvalBracketArgJustHyphen) { } TEST(LlvmLibcScanfParserTest, EvalBracketArgLeftHyphen) { - __llvm_libc::scanf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10]; const char *str = "%[-A]"; char arg1 = 'a'; evaluate(format_arr, str, &arg1); - __llvm_libc::scanf_core::FormatSection expected; + LIBC_NAMESPACE::scanf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = str; expected.conv_name = '['; expected.output_ptr = &arg1; - __llvm_libc::cpp::bitset<256> scan_set; + LIBC_NAMESPACE::cpp::bitset<256> scan_set; scan_set.set('-'); scan_set.set('A'); @@ -331,19 +331,19 @@ TEST(LlvmLibcScanfParserTest, EvalBracketArgLeftHyphen) { } TEST(LlvmLibcScanfParserTest, EvalBracketArgRightHyphen) { - __llvm_libc::scanf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10]; const char *str = "%[Z-]"; char arg1 = 'a'; evaluate(format_arr, str, &arg1); - __llvm_libc::scanf_core::FormatSection expected; + LIBC_NAMESPACE::scanf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = str; expected.conv_name = '['; expected.output_ptr = &arg1; - __llvm_libc::cpp::bitset<256> scan_set; + LIBC_NAMESPACE::cpp::bitset<256> scan_set; scan_set.set('-'); scan_set.set('Z'); @@ -354,19 +354,19 @@ TEST(LlvmLibcScanfParserTest, EvalBracketArgRightHyphen) { } TEST(LlvmLibcScanfParserTest, EvalBracketArgInvertSimple) { - __llvm_libc::scanf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10]; const char *str = "%[^abc]"; char arg1 = 'a'; evaluate(format_arr, str, &arg1); - __llvm_libc::scanf_core::FormatSection expected; + LIBC_NAMESPACE::scanf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = str; expected.conv_name = '['; expected.output_ptr = &arg1; - __llvm_libc::cpp::bitset<256> scan_set; + LIBC_NAMESPACE::cpp::bitset<256> scan_set; scan_set.set('a'); scan_set.set('b'); @@ -379,19 +379,19 @@ TEST(LlvmLibcScanfParserTest, EvalBracketArgInvertSimple) { } TEST(LlvmLibcScanfParserTest, EvalBracketArgInvertRange) { - __llvm_libc::scanf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10]; const char *str = "%[^0-9]"; char arg1 = 'a'; evaluate(format_arr, str, &arg1); - __llvm_libc::scanf_core::FormatSection expected; + LIBC_NAMESPACE::scanf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = str; expected.conv_name = '['; expected.output_ptr = &arg1; - __llvm_libc::cpp::bitset<256> scan_set; + LIBC_NAMESPACE::cpp::bitset<256> scan_set; scan_set.set_range('0', '9'); scan_set.flip(); @@ -402,19 +402,19 @@ TEST(LlvmLibcScanfParserTest, EvalBracketArgInvertRange) { } TEST(LlvmLibcScanfParserTest, EvalBracketArgRightBracket) { - __llvm_libc::scanf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10]; const char *str = "%[]]"; char arg1 = 'a'; evaluate(format_arr, str, &arg1); - __llvm_libc::scanf_core::FormatSection expected; + LIBC_NAMESPACE::scanf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = str; expected.conv_name = '['; expected.output_ptr = &arg1; - __llvm_libc::cpp::bitset<256> scan_set; + LIBC_NAMESPACE::cpp::bitset<256> scan_set; scan_set.set(']'); @@ -424,19 +424,19 @@ TEST(LlvmLibcScanfParserTest, EvalBracketArgRightBracket) { } TEST(LlvmLibcScanfParserTest, EvalBracketArgRightBracketRange) { - __llvm_libc::scanf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10]; const char *str = "%[]-a]"; char arg1 = 'a'; evaluate(format_arr, str, &arg1); - __llvm_libc::scanf_core::FormatSection expected; + LIBC_NAMESPACE::scanf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = str; expected.conv_name = '['; expected.output_ptr = &arg1; - __llvm_libc::cpp::bitset<256> scan_set; + LIBC_NAMESPACE::cpp::bitset<256> scan_set; scan_set.set_range(']', 'a'); @@ -446,19 +446,19 @@ TEST(LlvmLibcScanfParserTest, EvalBracketArgRightBracketRange) { } TEST(LlvmLibcScanfParserTest, EvalBracketArgRightBracketInvert) { - __llvm_libc::scanf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10]; const char *str = "%[^]]"; char arg1 = 'a'; evaluate(format_arr, str, &arg1); - __llvm_libc::scanf_core::FormatSection expected; + LIBC_NAMESPACE::scanf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = str; expected.conv_name = '['; expected.output_ptr = &arg1; - __llvm_libc::cpp::bitset<256> scan_set; + LIBC_NAMESPACE::cpp::bitset<256> scan_set; scan_set.set(']'); scan_set.flip(); @@ -469,19 +469,19 @@ TEST(LlvmLibcScanfParserTest, EvalBracketArgRightBracketInvert) { } TEST(LlvmLibcScanfParserTest, EvalBracketArgRightBracketInvertRange) { - __llvm_libc::scanf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10]; const char *str = "%[^]-^]"; char arg1 = 'a'; evaluate(format_arr, str, &arg1); - __llvm_libc::scanf_core::FormatSection expected; + LIBC_NAMESPACE::scanf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = str; expected.conv_name = '['; expected.output_ptr = &arg1; - __llvm_libc::cpp::bitset<256> scan_set; + LIBC_NAMESPACE::cpp::bitset<256> scan_set; scan_set.set_range(']', '^'); scan_set.flip(); @@ -495,19 +495,19 @@ TEST(LlvmLibcScanfParserTest, EvalBracketArgRightBracketInvertRange) { // implementation defined, and I have defined it such that it will capture the // correct range regardless of the order of the characters. TEST(LlvmLibcScanfParserTest, EvalBracketArgBackwardsRange) { - __llvm_libc::scanf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10]; const char *str = "%[9-0]"; char arg1 = 'a'; evaluate(format_arr, str, &arg1); - __llvm_libc::scanf_core::FormatSection expected; + LIBC_NAMESPACE::scanf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = str; expected.conv_name = '['; expected.output_ptr = &arg1; - __llvm_libc::cpp::bitset<256> scan_set; + LIBC_NAMESPACE::cpp::bitset<256> scan_set; scan_set.set_range('0', '9'); @@ -517,14 +517,14 @@ TEST(LlvmLibcScanfParserTest, EvalBracketArgBackwardsRange) { } TEST(LlvmLibcScanfParserTest, EvalThreeArgs) { - __llvm_libc::scanf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10]; const char *str = "%d%f%s"; int arg1 = 12345; double arg2 = 123.45; const char *arg3 = "12345"; evaluate(format_arr, str, &arg1, &arg2, &arg3); - __llvm_libc::scanf_core::FormatSection expected0, expected1, expected2; + LIBC_NAMESPACE::scanf_core::FormatSection expected0, expected1, expected2; expected0.has_conv = true; expected0.raw_string = {str, 2}; @@ -553,12 +553,12 @@ TEST(LlvmLibcScanfParserTest, EvalThreeArgs) { #ifndef LIBC_COPT_SCANF_DISABLE_INDEX_MODE TEST(LlvmLibcScanfParserTest, IndexModeOneArg) { - __llvm_libc::scanf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10]; const char *str = "%1$d"; int arg1 = 12345; evaluate(format_arr, str, &arg1); - __llvm_libc::scanf_core::FormatSection expected; + LIBC_NAMESPACE::scanf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = {str, 4}; @@ -569,14 +569,14 @@ TEST(LlvmLibcScanfParserTest, IndexModeOneArg) { } TEST(LlvmLibcScanfParserTest, IndexModeThreeArgsSequential) { - __llvm_libc::scanf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10]; const char *str = "%1$d%2$f%3$s"; int arg1 = 12345; double arg2 = 123.45; const char *arg3 = "12345"; evaluate(format_arr, str, &arg1, &arg2, &arg3); - __llvm_libc::scanf_core::FormatSection expected0, expected1, expected2; + LIBC_NAMESPACE::scanf_core::FormatSection expected0, expected1, expected2; expected0.has_conv = true; expected0.raw_string = {str, 4}; @@ -603,14 +603,14 @@ TEST(LlvmLibcScanfParserTest, IndexModeThreeArgsSequential) { } TEST(LlvmLibcScanfParserTest, IndexModeThreeArgsReverse) { - __llvm_libc::scanf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10]; const char *str = "%3$d%2$f%1$s"; int arg1 = 12345; double arg2 = 123.45; const char *arg3 = "12345"; evaluate(format_arr, str, &arg3, &arg2, &arg1); - __llvm_libc::scanf_core::FormatSection expected0, expected1, expected2; + LIBC_NAMESPACE::scanf_core::FormatSection expected0, expected1, expected2; expected0.has_conv = true; expected0.raw_string = {str, 4}; @@ -637,14 +637,14 @@ TEST(LlvmLibcScanfParserTest, IndexModeThreeArgsReverse) { } TEST(LlvmLibcScanfParserTest, IndexModeTenArgsRandom) { - __llvm_libc::scanf_core::FormatSection format_arr[10]; + LIBC_NAMESPACE::scanf_core::FormatSection format_arr[10]; const char *str = "%6$d%3$d%7$d%2$d%8$d%1$d%4$d%9$d%5$d%10$d"; uintptr_t args[10] = {6, 4, 2, 7, 9, 1, 3, 5, 8, 10}; evaluate(format_arr, str, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]); for (size_t i = 0; i < 10; ++i) { - __llvm_libc::scanf_core::FormatSection expected; + LIBC_NAMESPACE::scanf_core::FormatSection expected; expected.has_conv = true; expected.raw_string = {str + (4 * i), @@ -656,7 +656,7 @@ TEST(LlvmLibcScanfParserTest, IndexModeTenArgsRandom) { } TEST(LlvmLibcScanfParserTest, IndexModeComplexParsing) { - __llvm_libc::scanf_core::FormatSection format_arr[11]; + LIBC_NAMESPACE::scanf_core::FormatSection format_arr[11]; const char *str = "normal text %3$llu %% %2$*f %4$d %1$1c%5$[123]"; char arg1 = '1'; double arg2 = 123.45; @@ -665,7 +665,7 @@ TEST(LlvmLibcScanfParserTest, IndexModeComplexParsing) { char arg5 = 'A'; evaluate(format_arr, str, &arg1, &arg2, &arg3, &arg4, &arg5); - __llvm_libc::scanf_core::FormatSection expected0, expected1, expected2, + LIBC_NAMESPACE::scanf_core::FormatSection expected0, expected1, expected2, expected3, expected4, expected5, expected6, expected7, expected8, expected9, expected10; @@ -679,7 +679,7 @@ TEST(LlvmLibcScanfParserTest, IndexModeComplexParsing) { expected1.has_conv = true; // "%3$llu" expected1.raw_string = {str + 12, 6}; - expected1.length_modifier = __llvm_libc::scanf_core::LengthModifier::ll; + expected1.length_modifier = LIBC_NAMESPACE::scanf_core::LengthModifier::ll; expected1.output_ptr = &arg3; expected1.conv_name = 'u'; @@ -707,7 +707,7 @@ TEST(LlvmLibcScanfParserTest, IndexModeComplexParsing) { expected5.has_conv = true; // "%2$*f" expected5.raw_string = {str + 22, 5}; - expected5.flags = __llvm_libc::scanf_core::FormatFlags::NO_WRITE; + expected5.flags = LIBC_NAMESPACE::scanf_core::FormatFlags::NO_WRITE; expected5.conv_name = 'f'; EXPECT_SFORMAT_EQ(expected5, format_arr[5]); @@ -748,7 +748,7 @@ TEST(LlvmLibcScanfParserTest, IndexModeComplexParsing) { expected10.output_ptr = &arg5; expected10.conv_name = '['; - __llvm_libc::cpp::bitset<256> scan_set; + LIBC_NAMESPACE::cpp::bitset<256> scan_set; scan_set.set_range('1', '3'); diff --git a/libc/test/src/stdio/scanf_core/reader_test.cpp b/libc/test/src/stdio/scanf_core/reader_test.cpp index 9db916c115a24247630e7a7e23e23284182ed936..43a14184c7650d58f0c08e4411ee51c010496f44 100644 --- a/libc/test/src/stdio/scanf_core/reader_test.cpp +++ b/libc/test/src/stdio/scanf_core/reader_test.cpp @@ -15,14 +15,14 @@ TEST(LlvmLibcScanfStringReaderTest, Constructor) { char str[10]; // buff_len justneeds to be a big number. The specific value isn't important // in the real world. - __llvm_libc::scanf_core::ReadBuffer rb{const_cast(str), 1000000}; - __llvm_libc::scanf_core::Reader reader(&rb); + LIBC_NAMESPACE::scanf_core::ReadBuffer rb{const_cast(str), 1000000}; + LIBC_NAMESPACE::scanf_core::Reader reader(&rb); } TEST(LlvmLibcScanfStringReaderTest, SimpleRead) { const char *str = "abc"; - __llvm_libc::scanf_core::ReadBuffer rb{const_cast(str), 1000000}; - __llvm_libc::scanf_core::Reader reader(&rb); + LIBC_NAMESPACE::scanf_core::ReadBuffer rb{const_cast(str), 1000000}; + LIBC_NAMESPACE::scanf_core::Reader reader(&rb); for (size_t i = 0; i < sizeof("abc"); ++i) { ASSERT_EQ(str[i], reader.getc()); @@ -31,8 +31,8 @@ TEST(LlvmLibcScanfStringReaderTest, SimpleRead) { TEST(LlvmLibcScanfStringReaderTest, ReadAndReverse) { const char *str = "abcDEF123"; - __llvm_libc::scanf_core::ReadBuffer rb{const_cast(str), 1000000}; - __llvm_libc::scanf_core::Reader reader(&rb); + LIBC_NAMESPACE::scanf_core::ReadBuffer rb{const_cast(str), 1000000}; + LIBC_NAMESPACE::scanf_core::Reader reader(&rb); for (size_t i = 0; i < 5; ++i) { ASSERT_EQ(str[i], reader.getc()); diff --git a/libc/test/src/stdio/setbuf_test.cpp b/libc/test/src/stdio/setbuf_test.cpp index 3c2bb379cad2845a473604aeba61f2e60b0f5cab..b0abca4acf731bfc89bd028ace582678eda28d6b 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 6b44f6b73b20fc81eb709ea2c028b98edca4983e..2faa01a15ec108fd026afce0e219589482313005 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 764be9a9ba48b41fb79dc12f98938b46250aa1b6..d898f2b80a86f9fa748ffcd0113d7d6e149e4062 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 4fda76d4a4e5a72604c9569d4d92e486c7bc11e9..8b9c919bed203d4d0aa8d3e6ddd6d015d2a3c600 100644 --- a/libc/test/src/stdio/sprintf_test.cpp +++ b/libc/test/src/stdio/sprintf_test.cpp @@ -16,18 +16,18 @@ // TODO: Add a comment here explaining the printf format string. // #include -// namespace __llvm_libc { +// namespace LIBC_NAMESPACE { // using ::sprintf; // } -class LlvmLibcSPrintfTest : public __llvm_libc::testing::Test { +class LlvmLibcSPrintfTest : public LIBC_NAMESPACE::testing::Test { protected: char buff[1000]; int written; }; -using __llvm_libc::fputil::testing::ForceRoundingMode; -using __llvm_libc::fputil::testing::RoundingMode; +using LIBC_NAMESPACE::fputil::testing::ForceRoundingMode; +using LIBC_NAMESPACE::fputil::testing::RoundingMode; // Subtract 1 from sizeof(expected_str) to account for the null byte. #define ASSERT_STREQ_LEN(actual_written, actual_str, expected_str) \ @@ -38,7 +38,8 @@ TEST(LlvmLibcSPrintfTest, SimpleNoConv) { char buff[64]; int written; - written = __llvm_libc::sprintf(buff, "A simple string with no conversions."); + written = + LIBC_NAMESPACE::sprintf(buff, "A simple string with no conversions."); EXPECT_EQ(written, 36); ASSERT_STREQ(buff, "A simple string with no conversions."); } @@ -47,15 +48,15 @@ TEST(LlvmLibcSPrintfTest, PercentConv) { char buff[64]; int written; - written = __llvm_libc::sprintf(buff, "%%"); + written = LIBC_NAMESPACE::sprintf(buff, "%%"); EXPECT_EQ(written, 1); ASSERT_STREQ(buff, "%"); - written = __llvm_libc::sprintf(buff, "abc %% def"); + written = LIBC_NAMESPACE::sprintf(buff, "abc %% def"); EXPECT_EQ(written, 9); ASSERT_STREQ(buff, "abc % def"); - written = __llvm_libc::sprintf(buff, "%%%%%%"); + written = LIBC_NAMESPACE::sprintf(buff, "%%%%%%"); EXPECT_EQ(written, 3); ASSERT_STREQ(buff, "%%%"); } @@ -64,15 +65,15 @@ TEST(LlvmLibcSPrintfTest, CharConv) { char buff[64]; int written; - written = __llvm_libc::sprintf(buff, "%c", 'a'); + written = LIBC_NAMESPACE::sprintf(buff, "%c", 'a'); EXPECT_EQ(written, 1); ASSERT_STREQ(buff, "a"); - written = __llvm_libc::sprintf(buff, "%3c %-3c", '1', '2'); + written = LIBC_NAMESPACE::sprintf(buff, "%3c %-3c", '1', '2'); EXPECT_EQ(written, 7); ASSERT_STREQ(buff, " 1 2 "); - written = __llvm_libc::sprintf(buff, "%*c", 2, '3'); + written = LIBC_NAMESPACE::sprintf(buff, "%*c", 2, '3'); EXPECT_EQ(written, 2); ASSERT_STREQ(buff, " 3"); } @@ -81,26 +82,26 @@ TEST(LlvmLibcSPrintfTest, StringConv) { char buff[64]; int written; - written = __llvm_libc::sprintf(buff, "%s", "abcDEF123"); + written = LIBC_NAMESPACE::sprintf(buff, "%s", "abcDEF123"); EXPECT_EQ(written, 9); ASSERT_STREQ(buff, "abcDEF123"); - written = __llvm_libc::sprintf(buff, "%10s %-10s", "centered", "title"); + written = LIBC_NAMESPACE::sprintf(buff, "%10s %-10s", "centered", "title"); EXPECT_EQ(written, 21); ASSERT_STREQ(buff, " centered title "); - written = __llvm_libc::sprintf(buff, "%-5.4s%-4.4s", "words can describe", - "soups most delicious"); + written = LIBC_NAMESPACE::sprintf(buff, "%-5.4s%-4.4s", "words can describe", + "soups most delicious"); EXPECT_EQ(written, 9); ASSERT_STREQ(buff, "word soup"); - written = __llvm_libc::sprintf(buff, "%*s %.*s %*.*s", 10, "beginning", 2, - "isn't", 12, 10, "important. Ever."); + written = LIBC_NAMESPACE::sprintf(buff, "%*s %.*s %*.*s", 10, "beginning", 2, + "isn't", 12, 10, "important. Ever."); EXPECT_EQ(written, 26); ASSERT_STREQ(buff, " beginning is important."); #ifndef LIBC_COPT_PRINTF_NO_NULLPTR_CHECKS - written = __llvm_libc::sprintf(buff, "%s", nullptr); + written = LIBC_NAMESPACE::sprintf(buff, "%s", nullptr); EXPECT_EQ(written, 4); ASSERT_STREQ(buff, "null"); #endif // LIBC_COPT_PRINTF_NO_NULLPTR_CHECKS @@ -112,31 +113,31 @@ TEST(LlvmLibcSPrintfTest, IntConv) { // Basic Tests. - written = __llvm_libc::sprintf(buff, "%d", 123); + written = LIBC_NAMESPACE::sprintf(buff, "%d", 123); EXPECT_EQ(written, 3); ASSERT_STREQ(buff, "123"); - written = __llvm_libc::sprintf(buff, "%i", -456); + written = LIBC_NAMESPACE::sprintf(buff, "%i", -456); EXPECT_EQ(written, 4); ASSERT_STREQ(buff, "-456"); // Length Modifier Tests. - written = __llvm_libc::sprintf(buff, "%hhu", 257); // 0x101 + written = LIBC_NAMESPACE::sprintf(buff, "%hhu", 257); // 0x101 EXPECT_EQ(written, 1); ASSERT_STREQ(buff, "1"); - written = __llvm_libc::sprintf(buff, "%llu", 18446744073709551615ull); + written = LIBC_NAMESPACE::sprintf(buff, "%llu", 18446744073709551615ull); EXPECT_EQ(written, 20); ASSERT_STREQ(buff, "18446744073709551615"); // ull max - written = __llvm_libc::sprintf(buff, "%u", ~0); + written = LIBC_NAMESPACE::sprintf(buff, "%u", ~0); if (sizeof(int) == 4) { EXPECT_EQ(written, 10); ASSERT_STREQ(buff, "4294967295"); } - written = __llvm_libc::sprintf(buff, "%tu", ~ptrdiff_t(0)); + written = LIBC_NAMESPACE::sprintf(buff, "%tu", ~ptrdiff_t(0)); if (sizeof(ptrdiff_t) == 8) { EXPECT_EQ(written, 20); ASSERT_STREQ(buff, "18446744073709551615"); @@ -145,114 +146,114 @@ TEST(LlvmLibcSPrintfTest, IntConv) { ASSERT_STREQ(buff, "4294967295"); } - written = __llvm_libc::sprintf(buff, "%lld", -9223372036854775807ll - 1ll); + written = LIBC_NAMESPACE::sprintf(buff, "%lld", -9223372036854775807ll - 1ll); EXPECT_EQ(written, 20); ASSERT_STREQ(buff, "-9223372036854775808"); // ll min // Min Width Tests. - written = __llvm_libc::sprintf(buff, "%4d", 789); + written = LIBC_NAMESPACE::sprintf(buff, "%4d", 789); EXPECT_EQ(written, 4); ASSERT_STREQ(buff, " 789"); - written = __llvm_libc::sprintf(buff, "%2d", 987); + written = LIBC_NAMESPACE::sprintf(buff, "%2d", 987); EXPECT_EQ(written, 3); ASSERT_STREQ(buff, "987"); // Precision Tests. - written = __llvm_libc::sprintf(buff, "%d", 0); + written = LIBC_NAMESPACE::sprintf(buff, "%d", 0); EXPECT_EQ(written, 1); ASSERT_STREQ(buff, "0"); - written = __llvm_libc::sprintf(buff, "%.0d", 0); + written = LIBC_NAMESPACE::sprintf(buff, "%.0d", 0); EXPECT_EQ(written, 0); ASSERT_STREQ(buff, ""); - written = __llvm_libc::sprintf(buff, "%.5d", 654); + written = LIBC_NAMESPACE::sprintf(buff, "%.5d", 654); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "00654"); - written = __llvm_libc::sprintf(buff, "%.5d", -321); + written = LIBC_NAMESPACE::sprintf(buff, "%.5d", -321); EXPECT_EQ(written, 6); ASSERT_STREQ(buff, "-00321"); - written = __llvm_libc::sprintf(buff, "%.2d", 135); + written = LIBC_NAMESPACE::sprintf(buff, "%.2d", 135); EXPECT_EQ(written, 3); ASSERT_STREQ(buff, "135"); // Flag Tests. - written = __llvm_libc::sprintf(buff, "%.5d", -321); + written = LIBC_NAMESPACE::sprintf(buff, "%.5d", -321); EXPECT_EQ(written, 6); ASSERT_STREQ(buff, "-00321"); - written = __llvm_libc::sprintf(buff, "%-5d", 246); + written = LIBC_NAMESPACE::sprintf(buff, "%-5d", 246); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "246 "); - written = __llvm_libc::sprintf(buff, "%-5d", -147); + written = LIBC_NAMESPACE::sprintf(buff, "%-5d", -147); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "-147 "); - written = __llvm_libc::sprintf(buff, "%+d", 258); + written = LIBC_NAMESPACE::sprintf(buff, "%+d", 258); EXPECT_EQ(written, 4); ASSERT_STREQ(buff, "+258"); - written = __llvm_libc::sprintf(buff, "% d", 369); + written = LIBC_NAMESPACE::sprintf(buff, "% d", 369); EXPECT_EQ(written, 4); ASSERT_STREQ(buff, " 369"); - written = __llvm_libc::sprintf(buff, "%05d", 470); + written = LIBC_NAMESPACE::sprintf(buff, "%05d", 470); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "00470"); - written = __llvm_libc::sprintf(buff, "%05d", -581); + written = LIBC_NAMESPACE::sprintf(buff, "%05d", -581); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "-0581"); // Combined Tests. - written = __llvm_libc::sprintf(buff, "%+ u", 692); + written = LIBC_NAMESPACE::sprintf(buff, "%+ u", 692); EXPECT_EQ(written, 3); ASSERT_STREQ(buff, "692"); - written = __llvm_libc::sprintf(buff, "%+ -05d", 703); + written = LIBC_NAMESPACE::sprintf(buff, "%+ -05d", 703); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "+703 "); - written = __llvm_libc::sprintf(buff, "%7.5d", 814); + written = LIBC_NAMESPACE::sprintf(buff, "%7.5d", 814); EXPECT_EQ(written, 7); ASSERT_STREQ(buff, " 00814"); - written = __llvm_libc::sprintf(buff, "%7.5d", -925); + written = LIBC_NAMESPACE::sprintf(buff, "%7.5d", -925); EXPECT_EQ(written, 7); ASSERT_STREQ(buff, " -00925"); - written = __llvm_libc::sprintf(buff, "%7.5d", 159); + written = LIBC_NAMESPACE::sprintf(buff, "%7.5d", 159); EXPECT_EQ(written, 7); ASSERT_STREQ(buff, " 00159"); - written = __llvm_libc::sprintf(buff, "% -7.5d", 260); + written = LIBC_NAMESPACE::sprintf(buff, "% -7.5d", 260); EXPECT_EQ(written, 7); ASSERT_STREQ(buff, " 00260 "); - written = __llvm_libc::sprintf(buff, "%5.4d", 10000); + written = LIBC_NAMESPACE::sprintf(buff, "%5.4d", 10000); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "10000"); // Multiple Conversion Tests. - written = __llvm_libc::sprintf(buff, "%10d %-10d", 456, -789); + written = LIBC_NAMESPACE::sprintf(buff, "%10d %-10d", 456, -789); EXPECT_EQ(written, 21); ASSERT_STREQ(buff, " 456 -789 "); - written = __llvm_libc::sprintf(buff, "%-5.4d%+.4u", 75, 25); + written = LIBC_NAMESPACE::sprintf(buff, "%-5.4d%+.4u", 75, 25); EXPECT_EQ(written, 9); ASSERT_STREQ(buff, "0075 0025"); - written = __llvm_libc::sprintf(buff, "% 05hhi %+-0.5llu %-+ 06.3zd", - 256 + 127, 68719476736ll, size_t(2)); + written = LIBC_NAMESPACE::sprintf(buff, "% 05hhi %+-0.5llu %-+ 06.3zd", + 256 + 127, 68719476736ll, size_t(2)); EXPECT_EQ(written, 24); ASSERT_STREQ(buff, " 0127 68719476736 +002 "); } @@ -263,25 +264,25 @@ TEST(LlvmLibcSPrintfTest, HexConv) { // Basic Tests. - written = __llvm_libc::sprintf(buff, "%x", 0x123a); + written = LIBC_NAMESPACE::sprintf(buff, "%x", 0x123a); EXPECT_EQ(written, 4); ASSERT_STREQ(buff, "123a"); - written = __llvm_libc::sprintf(buff, "%X", 0x456b); + written = LIBC_NAMESPACE::sprintf(buff, "%X", 0x456b); EXPECT_EQ(written, 4); ASSERT_STREQ(buff, "456B"); // Length Modifier Tests. - written = __llvm_libc::sprintf(buff, "%hhx", 0x10001); + written = LIBC_NAMESPACE::sprintf(buff, "%hhx", 0x10001); EXPECT_EQ(written, 1); ASSERT_STREQ(buff, "1"); - written = __llvm_libc::sprintf(buff, "%llx", 0xffffffffffffffffull); + written = LIBC_NAMESPACE::sprintf(buff, "%llx", 0xffffffffffffffffull); EXPECT_EQ(written, 16); ASSERT_STREQ(buff, "ffffffffffffffff"); // ull max - written = __llvm_libc::sprintf(buff, "%tX", ~ptrdiff_t(0)); + written = LIBC_NAMESPACE::sprintf(buff, "%tX", ~ptrdiff_t(0)); if (sizeof(ptrdiff_t) == 8) { EXPECT_EQ(written, 16); ASSERT_STREQ(buff, "FFFFFFFFFFFFFFFF"); @@ -292,92 +293,92 @@ TEST(LlvmLibcSPrintfTest, HexConv) { // Min Width Tests. - written = __llvm_libc::sprintf(buff, "%4x", 0x789); + written = LIBC_NAMESPACE::sprintf(buff, "%4x", 0x789); EXPECT_EQ(written, 4); ASSERT_STREQ(buff, " 789"); - written = __llvm_libc::sprintf(buff, "%2X", 0x987); + written = LIBC_NAMESPACE::sprintf(buff, "%2X", 0x987); EXPECT_EQ(written, 3); ASSERT_STREQ(buff, "987"); // Precision Tests. - written = __llvm_libc::sprintf(buff, "%x", 0); + written = LIBC_NAMESPACE::sprintf(buff, "%x", 0); EXPECT_EQ(written, 1); ASSERT_STREQ(buff, "0"); - written = __llvm_libc::sprintf(buff, "%.0x", 0); + written = LIBC_NAMESPACE::sprintf(buff, "%.0x", 0); EXPECT_EQ(written, 0); ASSERT_STREQ(buff, ""); - written = __llvm_libc::sprintf(buff, "%.5x", 0x1F3); + written = LIBC_NAMESPACE::sprintf(buff, "%.5x", 0x1F3); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "001f3"); - written = __llvm_libc::sprintf(buff, "%.2x", 0x135); + written = LIBC_NAMESPACE::sprintf(buff, "%.2x", 0x135); EXPECT_EQ(written, 3); ASSERT_STREQ(buff, "135"); // Flag Tests. - written = __llvm_libc::sprintf(buff, "%-5x", 0x246); + written = LIBC_NAMESPACE::sprintf(buff, "%-5x", 0x246); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "246 "); - written = __llvm_libc::sprintf(buff, "%#x", 0xd3f); + written = LIBC_NAMESPACE::sprintf(buff, "%#x", 0xd3f); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "0xd3f"); - written = __llvm_libc::sprintf(buff, "%#X", 0xE40); + written = LIBC_NAMESPACE::sprintf(buff, "%#X", 0xE40); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "0XE40"); - written = __llvm_libc::sprintf(buff, "%05x", 0x470); + written = LIBC_NAMESPACE::sprintf(buff, "%05x", 0x470); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "00470"); - written = __llvm_libc::sprintf(buff, "%0#6x", 0x8c3); + written = LIBC_NAMESPACE::sprintf(buff, "%0#6x", 0x8c3); EXPECT_EQ(written, 6); ASSERT_STREQ(buff, "0x08c3"); - written = __llvm_libc::sprintf(buff, "%-#6x", 0x5f0); + written = LIBC_NAMESPACE::sprintf(buff, "%-#6x", 0x5f0); EXPECT_EQ(written, 6); ASSERT_STREQ(buff, "0x5f0 "); // Combined Tests. - written = __llvm_libc::sprintf(buff, "%#-07x", 0x703); + written = LIBC_NAMESPACE::sprintf(buff, "%#-07x", 0x703); EXPECT_EQ(written, 7); ASSERT_STREQ(buff, "0x703 "); - written = __llvm_libc::sprintf(buff, "%7.5x", 0x814); + written = LIBC_NAMESPACE::sprintf(buff, "%7.5x", 0x814); EXPECT_EQ(written, 7); ASSERT_STREQ(buff, " 00814"); - written = __llvm_libc::sprintf(buff, "%#9.5X", 0x9d4); + written = LIBC_NAMESPACE::sprintf(buff, "%#9.5X", 0x9d4); EXPECT_EQ(written, 9); ASSERT_STREQ(buff, " 0X009D4"); - written = __llvm_libc::sprintf(buff, "%-7.5x", 0x260); + written = LIBC_NAMESPACE::sprintf(buff, "%-7.5x", 0x260); EXPECT_EQ(written, 7); ASSERT_STREQ(buff, "00260 "); - written = __llvm_libc::sprintf(buff, "%5.4x", 0x10000); + written = LIBC_NAMESPACE::sprintf(buff, "%5.4x", 0x10000); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "10000"); // Multiple Conversion Tests. - written = __llvm_libc::sprintf(buff, "%10X %-#10x", 0x45b, 0x789); + written = LIBC_NAMESPACE::sprintf(buff, "%10X %-#10x", 0x45b, 0x789); EXPECT_EQ(written, 21); ASSERT_STREQ(buff, " 45B 0x789 "); - written = __llvm_libc::sprintf(buff, "%-5.4x%#.4x", 0x75, 0x25); + written = LIBC_NAMESPACE::sprintf(buff, "%-5.4x%#.4x", 0x75, 0x25); EXPECT_EQ(written, 11); ASSERT_STREQ(buff, "0075 0x0025"); - written = __llvm_libc::sprintf(buff, "%04hhX %#.5llx %-6.3zX", 256 + 0x7f, - 0x1000000000ll, size_t(2)); + written = LIBC_NAMESPACE::sprintf(buff, "%04hhX %#.5llx %-6.3zX", 256 + 0x7f, + 0x1000000000ll, size_t(2)); EXPECT_EQ(written, 24); ASSERT_STREQ(buff, "007F 0x1000000000 002 "); } @@ -386,46 +387,46 @@ TEST(LlvmLibcSPrintfTest, PointerConv) { char buff[64]; int written; - written = __llvm_libc::sprintf(buff, "%p", nullptr); + written = LIBC_NAMESPACE::sprintf(buff, "%p", nullptr); EXPECT_EQ(written, 9); ASSERT_STREQ(buff, "(nullptr)"); - written = __llvm_libc::sprintf(buff, "%p", 0x1a2b3c4d); + written = LIBC_NAMESPACE::sprintf(buff, "%p", 0x1a2b3c4d); EXPECT_EQ(written, 10); ASSERT_STREQ(buff, "0x1a2b3c4d"); if constexpr (sizeof(void *) > 4) { - written = __llvm_libc::sprintf(buff, "%p", 0x1a2b3c4d5e6f7081); + written = LIBC_NAMESPACE::sprintf(buff, "%p", 0x1a2b3c4d5e6f7081); EXPECT_EQ(written, 18); ASSERT_STREQ(buff, "0x1a2b3c4d5e6f7081"); } - written = __llvm_libc::sprintf(buff, "%p", buff); + written = LIBC_NAMESPACE::sprintf(buff, "%p", buff); EXPECT_GT(written, 0); // Width tests: - written = __llvm_libc::sprintf(buff, "%20p", nullptr); + written = LIBC_NAMESPACE::sprintf(buff, "%20p", nullptr); EXPECT_EQ(written, 20); ASSERT_STREQ(buff, " (nullptr)"); - written = __llvm_libc::sprintf(buff, "%20p", 0x1a2b3c4d); + written = LIBC_NAMESPACE::sprintf(buff, "%20p", 0x1a2b3c4d); EXPECT_EQ(written, 20); ASSERT_STREQ(buff, " 0x1a2b3c4d"); // Flag tests: - written = __llvm_libc::sprintf(buff, "%-20p", nullptr); + written = LIBC_NAMESPACE::sprintf(buff, "%-20p", nullptr); EXPECT_EQ(written, 20); ASSERT_STREQ(buff, "(nullptr) "); - written = __llvm_libc::sprintf(buff, "%-20p", 0x1a2b3c4d); + written = LIBC_NAMESPACE::sprintf(buff, "%-20p", 0x1a2b3c4d); EXPECT_EQ(written, 20); ASSERT_STREQ(buff, "0x1a2b3c4d "); // Using the 0 flag is technically undefined, but here we're following the // convention of matching the behavior of %#x. - written = __llvm_libc::sprintf(buff, "%020p", 0x1a2b3c4d); + written = LIBC_NAMESPACE::sprintf(buff, "%020p", 0x1a2b3c4d); EXPECT_EQ(written, 20); ASSERT_STREQ(buff, "0x00000000001a2b3c4d"); @@ -433,13 +434,13 @@ TEST(LlvmLibcSPrintfTest, PointerConv) { // These are all undefined behavior. The precision option is undefined for %p. // Precision specifies the number of characters for a string conversion. - written = __llvm_libc::sprintf(buff, "%.5p", nullptr); + written = LIBC_NAMESPACE::sprintf(buff, "%.5p", nullptr); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "(null"); // Precision specifies the number of digits to be written for %x conversions, // and the "0x" doesn't count as part of the digits. - written = __llvm_libc::sprintf(buff, "%.20p", 0x1a2b3c4d); + written = LIBC_NAMESPACE::sprintf(buff, "%.20p", 0x1a2b3c4d); EXPECT_EQ(written, 22); ASSERT_STREQ(buff, "0x0000000000001a2b3c4d"); } @@ -450,25 +451,25 @@ TEST(LlvmLibcSPrintfTest, OctConv) { // Basic Tests. - written = __llvm_libc::sprintf(buff, "%o", 01234); + written = LIBC_NAMESPACE::sprintf(buff, "%o", 01234); EXPECT_EQ(written, 4); ASSERT_STREQ(buff, "1234"); - written = __llvm_libc::sprintf(buff, "%o", 04567); + written = LIBC_NAMESPACE::sprintf(buff, "%o", 04567); EXPECT_EQ(written, 4); ASSERT_STREQ(buff, "4567"); // Length Modifier Tests. - written = __llvm_libc::sprintf(buff, "%hho", 0401); + written = LIBC_NAMESPACE::sprintf(buff, "%hho", 0401); EXPECT_EQ(written, 1); ASSERT_STREQ(buff, "1"); - written = __llvm_libc::sprintf(buff, "%llo", 01777777777777777777777ull); + written = LIBC_NAMESPACE::sprintf(buff, "%llo", 01777777777777777777777ull); EXPECT_EQ(written, 22); ASSERT_STREQ(buff, "1777777777777777777777"); // ull max - written = __llvm_libc::sprintf(buff, "%to", ~ptrdiff_t(0)); + written = LIBC_NAMESPACE::sprintf(buff, "%to", ~ptrdiff_t(0)); if (sizeof(ptrdiff_t) == 8) { EXPECT_EQ(written, 22); ASSERT_STREQ(buff, "1777777777777777777777"); @@ -479,88 +480,88 @@ TEST(LlvmLibcSPrintfTest, OctConv) { // Min Width Tests. - written = __llvm_libc::sprintf(buff, "%4o", 0701); + written = LIBC_NAMESPACE::sprintf(buff, "%4o", 0701); EXPECT_EQ(written, 4); ASSERT_STREQ(buff, " 701"); - written = __llvm_libc::sprintf(buff, "%2o", 0107); + written = LIBC_NAMESPACE::sprintf(buff, "%2o", 0107); EXPECT_EQ(written, 3); ASSERT_STREQ(buff, "107"); // Precision Tests. - written = __llvm_libc::sprintf(buff, "%o", 0); + written = LIBC_NAMESPACE::sprintf(buff, "%o", 0); EXPECT_EQ(written, 1); ASSERT_STREQ(buff, "0"); - written = __llvm_libc::sprintf(buff, "%.0o", 0); + written = LIBC_NAMESPACE::sprintf(buff, "%.0o", 0); EXPECT_EQ(written, 0); ASSERT_STREQ(buff, ""); - written = __llvm_libc::sprintf(buff, "%.5o", 0153); + written = LIBC_NAMESPACE::sprintf(buff, "%.5o", 0153); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "00153"); - written = __llvm_libc::sprintf(buff, "%.2o", 0135); + written = LIBC_NAMESPACE::sprintf(buff, "%.2o", 0135); EXPECT_EQ(written, 3); ASSERT_STREQ(buff, "135"); // Flag Tests. - written = __llvm_libc::sprintf(buff, "%-5o", 0246); + written = LIBC_NAMESPACE::sprintf(buff, "%-5o", 0246); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "246 "); - written = __llvm_libc::sprintf(buff, "%#o", 0234); + written = LIBC_NAMESPACE::sprintf(buff, "%#o", 0234); EXPECT_EQ(written, 4); ASSERT_STREQ(buff, "0234"); - written = __llvm_libc::sprintf(buff, "%05o", 0470); + written = LIBC_NAMESPACE::sprintf(buff, "%05o", 0470); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "00470"); - written = __llvm_libc::sprintf(buff, "%0#6o", 0753); + written = LIBC_NAMESPACE::sprintf(buff, "%0#6o", 0753); EXPECT_EQ(written, 6); ASSERT_STREQ(buff, "000753"); - written = __llvm_libc::sprintf(buff, "%-#6o", 0642); + written = LIBC_NAMESPACE::sprintf(buff, "%-#6o", 0642); EXPECT_EQ(written, 6); ASSERT_STREQ(buff, "0642 "); // Combined Tests. - written = __llvm_libc::sprintf(buff, "%#-07o", 0703); + written = LIBC_NAMESPACE::sprintf(buff, "%#-07o", 0703); EXPECT_EQ(written, 7); ASSERT_STREQ(buff, "0703 "); - written = __llvm_libc::sprintf(buff, "%7.5o", 0314); + written = LIBC_NAMESPACE::sprintf(buff, "%7.5o", 0314); EXPECT_EQ(written, 7); ASSERT_STREQ(buff, " 00314"); - written = __llvm_libc::sprintf(buff, "%#9.5o", 0234); + written = LIBC_NAMESPACE::sprintf(buff, "%#9.5o", 0234); EXPECT_EQ(written, 9); ASSERT_STREQ(buff, " 00234"); - written = __llvm_libc::sprintf(buff, "%-7.5o", 0260); + written = LIBC_NAMESPACE::sprintf(buff, "%-7.5o", 0260); EXPECT_EQ(written, 7); ASSERT_STREQ(buff, "00260 "); - written = __llvm_libc::sprintf(buff, "%5.4o", 010000); + written = LIBC_NAMESPACE::sprintf(buff, "%5.4o", 010000); EXPECT_EQ(written, 5); ASSERT_STREQ(buff, "10000"); // Multiple Conversion Tests. - written = __llvm_libc::sprintf(buff, "%10o %-#10o", 0456, 0123); + written = LIBC_NAMESPACE::sprintf(buff, "%10o %-#10o", 0456, 0123); EXPECT_EQ(written, 21); ASSERT_STREQ(buff, " 456 0123 "); - written = __llvm_libc::sprintf(buff, "%-5.4o%#.4o", 075, 025); + written = LIBC_NAMESPACE::sprintf(buff, "%-5.4o%#.4o", 075, 025); EXPECT_EQ(written, 9); ASSERT_STREQ(buff, "0075 0025"); - written = __llvm_libc::sprintf(buff, "%04hho %#.5llo %-6.3zo", 256 + 077, - 01000000000000ll, size_t(2)); + written = LIBC_NAMESPACE::sprintf(buff, "%04hho %#.5llo %-6.3zo", 256 + 077, + 01000000000000ll, size_t(2)); EXPECT_EQ(written, 26); ASSERT_STREQ(buff, "0077 01000000000000 002 "); } @@ -569,64 +570,64 @@ TEST(LlvmLibcSPrintfTest, OctConv) { TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) { ForceRoundingMode r(RoundingMode::Nearest); - double inf = __llvm_libc::fputil::FPBits::inf().get_val(); - double nan = __llvm_libc::fputil::FPBits::build_nan(1); + double inf = LIBC_NAMESPACE::fputil::FPBits::inf().get_val(); + double nan = LIBC_NAMESPACE::fputil::FPBits::build_nan(1); - written = __llvm_libc::sprintf(buff, "%a", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%a", 1.0); ASSERT_STREQ_LEN(written, buff, "0x1p+0"); - written = __llvm_libc::sprintf(buff, "%A", -1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%A", -1.0); ASSERT_STREQ_LEN(written, buff, "-0X1P+0"); - written = __llvm_libc::sprintf(buff, "%a", -0x1.abcdef12345p0); + written = LIBC_NAMESPACE::sprintf(buff, "%a", -0x1.abcdef12345p0); ASSERT_STREQ_LEN(written, buff, "-0x1.abcdef12345p+0"); - written = __llvm_libc::sprintf(buff, "%A", 0x1.abcdef12345p0); + written = LIBC_NAMESPACE::sprintf(buff, "%A", 0x1.abcdef12345p0); ASSERT_STREQ_LEN(written, buff, "0X1.ABCDEF12345P+0"); - written = __llvm_libc::sprintf(buff, "%a", 0.0); + written = LIBC_NAMESPACE::sprintf(buff, "%a", 0.0); ASSERT_STREQ_LEN(written, buff, "0x0p+0"); - written = __llvm_libc::sprintf(buff, "%a", 1.0e100); + written = LIBC_NAMESPACE::sprintf(buff, "%a", 1.0e100); ASSERT_STREQ_LEN(written, buff, "0x1.249ad2594c37dp+332"); - written = __llvm_libc::sprintf(buff, "%a", 0.1); + written = LIBC_NAMESPACE::sprintf(buff, "%a", 0.1); ASSERT_STREQ_LEN(written, buff, "0x1.999999999999ap-4"); // Subnormal Tests. - written = __llvm_libc::sprintf(buff, "%a", 0x1.0p-1027); + written = LIBC_NAMESPACE::sprintf(buff, "%a", 0x1.0p-1027); ASSERT_STREQ_LEN(written, buff, "0x0.08p-1022"); - written = __llvm_libc::sprintf(buff, "%a", 0x1.0p-1025); + written = LIBC_NAMESPACE::sprintf(buff, "%a", 0x1.0p-1025); ASSERT_STREQ_LEN(written, buff, "0x0.2p-1022"); - written = __llvm_libc::sprintf(buff, "%a", 0x1.0p-1023); + written = LIBC_NAMESPACE::sprintf(buff, "%a", 0x1.0p-1023); ASSERT_STREQ_LEN(written, buff, "0x0.8p-1022"); - written = __llvm_libc::sprintf(buff, "%a", 0x1.0p-1022); + written = LIBC_NAMESPACE::sprintf(buff, "%a", 0x1.0p-1022); ASSERT_STREQ_LEN(written, buff, "0x1p-1022"); - written = __llvm_libc::sprintf(buff, "%a", 0x1.0p-1074); + written = LIBC_NAMESPACE::sprintf(buff, "%a", 0x1.0p-1074); ASSERT_STREQ_LEN(written, buff, "0x0.0000000000001p-1022"); // Inf/Nan Tests. - written = __llvm_libc::sprintf(buff, "%a", inf); + written = LIBC_NAMESPACE::sprintf(buff, "%a", inf); ASSERT_STREQ_LEN(written, buff, "inf"); - written = __llvm_libc::sprintf(buff, "%A", -inf); + written = LIBC_NAMESPACE::sprintf(buff, "%A", -inf); ASSERT_STREQ_LEN(written, buff, "-INF"); - written = __llvm_libc::sprintf(buff, "%a", nan); + written = LIBC_NAMESPACE::sprintf(buff, "%a", nan); ASSERT_STREQ_LEN(written, buff, "nan"); - written = __llvm_libc::sprintf(buff, "%A", -nan); + written = LIBC_NAMESPACE::sprintf(buff, "%A", -nan); ASSERT_STREQ_LEN(written, buff, "-NAN"); // Length Modifier Tests. - written = __llvm_libc::sprintf(buff, "%La", 0.1L); + written = LIBC_NAMESPACE::sprintf(buff, "%La", 0.1L); #if defined(SPECIAL_X86_LONG_DOUBLE) ASSERT_STREQ_LEN(written, buff, "0xc.ccccccccccccccdp-7"); #elif defined(LONG_DOUBLE_IS_DOUBLE) @@ -635,7 +636,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) { ASSERT_STREQ_LEN(written, buff, "0x1.999999999999999999999999999ap-4"); #endif - written = __llvm_libc::sprintf(buff, "%La", 1.0e1000L); + written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e1000L); #if defined(SPECIAL_X86_LONG_DOUBLE) ASSERT_STREQ_LEN(written, buff, "0xf.38db1f9dd3dac05p+3318"); #elif defined(LONG_DOUBLE_IS_DOUBLE) @@ -644,7 +645,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) { ASSERT_STREQ_LEN(written, buff, "0x1.e71b63f3ba7b580af1a52d2a7379p+3321"); #endif - written = __llvm_libc::sprintf(buff, "%La", 1.0e-1000L); + written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e-1000L); #if defined(SPECIAL_X86_LONG_DOUBLE) ASSERT_STREQ_LEN(written, buff, "0x8.68a9188a89e1467p-3325"); #elif defined(LONG_DOUBLE_IS_DOUBLE) @@ -655,99 +656,99 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) { // Min Width Tests. - written = __llvm_libc::sprintf(buff, "%15a", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%15a", 1.0); ASSERT_STREQ_LEN(written, buff, " 0x1p+0"); - written = __llvm_libc::sprintf(buff, "%15a", -1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%15a", -1.0); ASSERT_STREQ_LEN(written, buff, " -0x1p+0"); - written = __llvm_libc::sprintf(buff, "%15a", 1.0e10); + written = LIBC_NAMESPACE::sprintf(buff, "%15a", 1.0e10); ASSERT_STREQ_LEN(written, buff, " 0x1.2a05f2p+33"); - written = __llvm_libc::sprintf(buff, "%15a", -1.0e10); + written = LIBC_NAMESPACE::sprintf(buff, "%15a", -1.0e10); ASSERT_STREQ_LEN(written, buff, "-0x1.2a05f2p+33"); - written = __llvm_libc::sprintf(buff, "%10a", 1.0e10); + written = LIBC_NAMESPACE::sprintf(buff, "%10a", 1.0e10); ASSERT_STREQ_LEN(written, buff, "0x1.2a05f2p+33"); - written = __llvm_libc::sprintf(buff, "%5a", inf); + written = LIBC_NAMESPACE::sprintf(buff, "%5a", inf); ASSERT_STREQ_LEN(written, buff, " inf"); - written = __llvm_libc::sprintf(buff, "%5a", -nan); + written = LIBC_NAMESPACE::sprintf(buff, "%5a", -nan); ASSERT_STREQ_LEN(written, buff, " -nan"); // Precision Tests. - written = __llvm_libc::sprintf(buff, "%.1a", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 1.0); ASSERT_STREQ_LEN(written, buff, "0x1.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0.0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0.0); ASSERT_STREQ_LEN(written, buff, "0x0.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0.1); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0.1); ASSERT_STREQ_LEN(written, buff, "0x1.ap-4"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.0fp0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.0fp0); ASSERT_STREQ_LEN(written, buff, "0x1.1p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.07p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.07p0); ASSERT_STREQ_LEN(written, buff, "0x1.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.08p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.08p0); ASSERT_STREQ_LEN(written, buff, "0x1.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.18p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.18p0); ASSERT_STREQ_LEN(written, buff, "0x1.2p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.ffp0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.ffp0); ASSERT_STREQ_LEN(written, buff, "0x2.0p+0"); - written = __llvm_libc::sprintf(buff, "%.5a", 1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.5a", 1.25); ASSERT_STREQ_LEN(written, buff, "0x1.40000p+0"); - written = __llvm_libc::sprintf(buff, "%.0a", 1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.0a", 1.25); ASSERT_STREQ_LEN(written, buff, "0x1p+0"); - written = __llvm_libc::sprintf(buff, "%.0a", 1.75); + written = LIBC_NAMESPACE::sprintf(buff, "%.0a", 1.75); ASSERT_STREQ_LEN(written, buff, "0x2p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.0p-1023); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.0p-1023); ASSERT_STREQ_LEN(written, buff, "0x0.8p-1022"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.8p-1023); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.8p-1023); ASSERT_STREQ_LEN(written, buff, "0x0.cp-1022"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.0p-1024); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.0p-1024); ASSERT_STREQ_LEN(written, buff, "0x0.4p-1022"); - written = __llvm_libc::sprintf(buff, "%.0a", 0x1.0p-1023); + written = LIBC_NAMESPACE::sprintf(buff, "%.0a", 0x1.0p-1023); ASSERT_STREQ_LEN(written, buff, "0x0p-1022"); - written = __llvm_libc::sprintf(buff, "%.0a", 0x1.8p-1023); + written = LIBC_NAMESPACE::sprintf(buff, "%.0a", 0x1.8p-1023); ASSERT_STREQ_LEN(written, buff, "0x1p-1022"); - written = __llvm_libc::sprintf(buff, "%.0a", 0x1.0p-1024); + written = LIBC_NAMESPACE::sprintf(buff, "%.0a", 0x1.0p-1024); ASSERT_STREQ_LEN(written, buff, "0x0p-1022"); - written = __llvm_libc::sprintf(buff, "%.2a", 0x1.0p-1027); + written = LIBC_NAMESPACE::sprintf(buff, "%.2a", 0x1.0p-1027); ASSERT_STREQ_LEN(written, buff, "0x0.08p-1022"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.0p-1027); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.0p-1027); ASSERT_STREQ_LEN(written, buff, "0x0.0p-1022"); - written = __llvm_libc::sprintf(buff, "%.5a", 0.0); + written = LIBC_NAMESPACE::sprintf(buff, "%.5a", 0.0); ASSERT_STREQ_LEN(written, buff, "0x0.00000p+0"); - written = __llvm_libc::sprintf(buff, "%.5a", 0x1.008p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.5a", 0x1.008p0); ASSERT_STREQ_LEN(written, buff, "0x1.00800p+0"); - written = __llvm_libc::sprintf(buff, "%.5a", 0x1.008p10); + written = LIBC_NAMESPACE::sprintf(buff, "%.5a", 0x1.008p10); ASSERT_STREQ_LEN(written, buff, "0x1.00800p+10"); - written = __llvm_libc::sprintf(buff, "%.5a", nan); + written = LIBC_NAMESPACE::sprintf(buff, "%.5a", nan); ASSERT_STREQ_LEN(written, buff, "nan"); - written = __llvm_libc::sprintf(buff, "%.1La", 0.1L); + written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0.1L); #if defined(SPECIAL_X86_LONG_DOUBLE) ASSERT_STREQ_LEN(written, buff, "0xc.dp-7"); #elif defined(LONG_DOUBLE_IS_DOUBLE) @@ -756,7 +757,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) { ASSERT_STREQ_LEN(written, buff, "0x1.ap-4"); #endif - written = __llvm_libc::sprintf(buff, "%.1La", 0xf.fffffffffffffffp16380L); + written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0xf.fffffffffffffffp16380L); #if defined(SPECIAL_X86_LONG_DOUBLE) ASSERT_STREQ_LEN(written, buff, "0x1.0p+16384"); #elif defined(LONG_DOUBLE_IS_DOUBLE) @@ -768,162 +769,162 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) { // Rounding Mode Tests. if (ForceRoundingMode r(RoundingMode::Nearest); r.success) { - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.08p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.08p0); ASSERT_STREQ_LEN(written, buff, "0x1.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.18p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.18p0); ASSERT_STREQ_LEN(written, buff, "0x1.2p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.04p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.04p0); ASSERT_STREQ_LEN(written, buff, "0x1.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.14p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.14p0); ASSERT_STREQ_LEN(written, buff, "0x1.1p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.08p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.08p0); ASSERT_STREQ_LEN(written, buff, "-0x1.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.18p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.18p0); ASSERT_STREQ_LEN(written, buff, "-0x1.2p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.04p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.04p0); ASSERT_STREQ_LEN(written, buff, "-0x1.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.14p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.14p0); ASSERT_STREQ_LEN(written, buff, "-0x1.1p+0"); } if (ForceRoundingMode r(RoundingMode::Upward); r.success) { - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.08p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.08p0); ASSERT_STREQ_LEN(written, buff, "0x1.1p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.18p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.18p0); ASSERT_STREQ_LEN(written, buff, "0x1.2p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.04p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.04p0); ASSERT_STREQ_LEN(written, buff, "0x1.1p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.14p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.14p0); ASSERT_STREQ_LEN(written, buff, "0x1.2p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.08p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.08p0); ASSERT_STREQ_LEN(written, buff, "-0x1.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.18p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.18p0); ASSERT_STREQ_LEN(written, buff, "-0x1.1p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.04p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.04p0); ASSERT_STREQ_LEN(written, buff, "-0x1.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.14p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.14p0); ASSERT_STREQ_LEN(written, buff, "-0x1.1p+0"); } if (ForceRoundingMode r(RoundingMode::Downward); r.success) { - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.08p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.08p0); ASSERT_STREQ_LEN(written, buff, "0x1.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.18p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.18p0); ASSERT_STREQ_LEN(written, buff, "0x1.1p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.04p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.04p0); ASSERT_STREQ_LEN(written, buff, "0x1.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.14p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.14p0); ASSERT_STREQ_LEN(written, buff, "0x1.1p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.08p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.08p0); ASSERT_STREQ_LEN(written, buff, "-0x1.1p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.18p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.18p0); ASSERT_STREQ_LEN(written, buff, "-0x1.2p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.04p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.04p0); ASSERT_STREQ_LEN(written, buff, "-0x1.1p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.14p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.14p0); ASSERT_STREQ_LEN(written, buff, "-0x1.2p+0"); } if (ForceRoundingMode r(RoundingMode::TowardZero); r.success) { - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.08p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.08p0); ASSERT_STREQ_LEN(written, buff, "0x1.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.18p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.18p0); ASSERT_STREQ_LEN(written, buff, "0x1.1p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.04p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.04p0); ASSERT_STREQ_LEN(written, buff, "0x1.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", 0x1.14p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", 0x1.14p0); ASSERT_STREQ_LEN(written, buff, "0x1.1p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.08p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.08p0); ASSERT_STREQ_LEN(written, buff, "-0x1.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.18p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.18p0); ASSERT_STREQ_LEN(written, buff, "-0x1.1p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.04p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.04p0); ASSERT_STREQ_LEN(written, buff, "-0x1.0p+0"); - written = __llvm_libc::sprintf(buff, "%.1a", -0x1.14p0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1a", -0x1.14p0); ASSERT_STREQ_LEN(written, buff, "-0x1.1p+0"); } // Flag Tests. - written = __llvm_libc::sprintf(buff, "%+a", nan); + written = LIBC_NAMESPACE::sprintf(buff, "%+a", nan); ASSERT_STREQ_LEN(written, buff, "+nan"); - written = __llvm_libc::sprintf(buff, "% A", inf); + written = LIBC_NAMESPACE::sprintf(buff, "% A", inf); ASSERT_STREQ_LEN(written, buff, " INF"); - written = __llvm_libc::sprintf(buff, "%-5a", inf); + written = LIBC_NAMESPACE::sprintf(buff, "%-5a", inf); ASSERT_STREQ_LEN(written, buff, "inf "); - written = __llvm_libc::sprintf(buff, "%+-5A", nan); + written = LIBC_NAMESPACE::sprintf(buff, "%+-5A", nan); ASSERT_STREQ_LEN(written, buff, "+NAN "); - written = __llvm_libc::sprintf(buff, "%+a", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%+a", 1.0); ASSERT_STREQ_LEN(written, buff, "+0x1p+0"); - written = __llvm_libc::sprintf(buff, "% a", 0.0); + written = LIBC_NAMESPACE::sprintf(buff, "% a", 0.0); ASSERT_STREQ_LEN(written, buff, " 0x0p+0"); - written = __llvm_libc::sprintf(buff, "%-10a", 1.5); + written = LIBC_NAMESPACE::sprintf(buff, "%-10a", 1.5); ASSERT_STREQ_LEN(written, buff, "0x1.8p+0 "); - written = __llvm_libc::sprintf(buff, "%#a", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%#a", 1.0); ASSERT_STREQ_LEN(written, buff, "0x1.p+0"); - written = __llvm_libc::sprintf(buff, "%#.0a", 1.5); + written = LIBC_NAMESPACE::sprintf(buff, "%#.0a", 1.5); ASSERT_STREQ_LEN(written, buff, "0x2.p+0"); - written = __llvm_libc::sprintf(buff, "%010a", 1.5); + written = LIBC_NAMESPACE::sprintf(buff, "%010a", 1.5); ASSERT_STREQ_LEN(written, buff, "0x001.8p+0"); - written = __llvm_libc::sprintf(buff, "%+- #0a", 0.0); + written = LIBC_NAMESPACE::sprintf(buff, "%+- #0a", 0.0); ASSERT_STREQ_LEN(written, buff, "+0x0.p+0"); // Combined Tests. - written = __llvm_libc::sprintf(buff, "%12.3a %-12.3A", 0.1, 256.0); + written = LIBC_NAMESPACE::sprintf(buff, "%12.3a %-12.3A", 0.1, 256.0); ASSERT_STREQ_LEN(written, buff, " 0x1.99ap-4 0X1.000P+8 "); - written = __llvm_libc::sprintf(buff, "%+-#12.3a % 012.3a", 0.1256, 1256.0); + written = LIBC_NAMESPACE::sprintf(buff, "%+-#12.3a % 012.3a", 0.1256, 1256.0); ASSERT_STREQ_LEN(written, buff, "+0x1.014p-3 0x1.3a0p+10"); // These tests check that the padding is properly calculated based on the // min_width field. Specifically, they check that the extra zeroes added by // the high precision are accounted for correctly. - written = __llvm_libc::sprintf(buff, "%50.50a", 0x1.0p0); + written = LIBC_NAMESPACE::sprintf(buff, "%50.50a", 0x1.0p0); ASSERT_STREQ_LEN(written, buff, "0x1.00000000000000000000000000000000000000000000000000p+0"); // The difference with this test is that the formatted number is exactly 57 // characters, so padding to 58 adds a space. - written = __llvm_libc::sprintf(buff, "%58.50a", 0x1.0p0); + written = LIBC_NAMESPACE::sprintf(buff, "%58.50a", 0x1.0p0); ASSERT_STREQ_LEN( written, buff, " 0x1.00000000000000000000000000000000000000000000000000p+0"); @@ -931,28 +932,28 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) { TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { ForceRoundingMode r(RoundingMode::Nearest); - double inf = __llvm_libc::fputil::FPBits::inf().get_val(); - double nan = __llvm_libc::fputil::FPBits::build_nan(1); + double inf = LIBC_NAMESPACE::fputil::FPBits::inf().get_val(); + double nan = LIBC_NAMESPACE::fputil::FPBits::build_nan(1); char big_buff[10000]; // Used for long doubles and other extremely wide // numbers. - written = __llvm_libc::sprintf(buff, "%f", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%f", 1.0); ASSERT_STREQ_LEN(written, buff, "1.000000"); - written = __llvm_libc::sprintf(buff, "%F", -1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%F", -1.0); ASSERT_STREQ_LEN(written, buff, "-1.000000"); - written = __llvm_libc::sprintf(buff, "%f", -1.234567); + written = LIBC_NAMESPACE::sprintf(buff, "%f", -1.234567); ASSERT_STREQ_LEN(written, buff, "-1.234567"); - written = __llvm_libc::sprintf(buff, "%f", 0.0); + written = LIBC_NAMESPACE::sprintf(buff, "%f", 0.0); ASSERT_STREQ_LEN(written, buff, "0.000000"); - written = __llvm_libc::sprintf(buff, "%f", 1.5); + written = LIBC_NAMESPACE::sprintf(buff, "%f", 1.5); ASSERT_STREQ_LEN(written, buff, "1.500000"); - written = __llvm_libc::sprintf(buff, "%f", 1e300); + written = LIBC_NAMESPACE::sprintf(buff, "%f", 1e300); ASSERT_STREQ_LEN( written, buff, "100000000000000005250476025520442024870446858110815915491585411551180245" @@ -961,35 +962,35 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { "111903896764088007465274278014249457925878882005684283811566947219638686" "5459400540160.000000"); - written = __llvm_libc::sprintf(buff, "%f", 0.1); + written = LIBC_NAMESPACE::sprintf(buff, "%f", 0.1); ASSERT_STREQ_LEN(written, buff, "0.100000"); - written = __llvm_libc::sprintf(buff, "%f", 1234567890123456789.0); + written = LIBC_NAMESPACE::sprintf(buff, "%f", 1234567890123456789.0); ASSERT_STREQ_LEN(written, buff, "1234567890123456768.000000"); - written = __llvm_libc::sprintf(buff, "%f", 9999999999999.99); + written = LIBC_NAMESPACE::sprintf(buff, "%f", 9999999999999.99); ASSERT_STREQ_LEN(written, buff, "9999999999999.990234"); // Simple Subnormal Tests. - written = __llvm_libc::sprintf(buff, "%f", 0x1.0p-1027); + written = LIBC_NAMESPACE::sprintf(buff, "%f", 0x1.0p-1027); ASSERT_STREQ_LEN(written, buff, "0.000000"); - written = __llvm_libc::sprintf(buff, "%f", 0x1.0p-1074); + written = LIBC_NAMESPACE::sprintf(buff, "%f", 0x1.0p-1074); ASSERT_STREQ_LEN(written, buff, "0.000000"); // Inf/Nan Tests. - written = __llvm_libc::sprintf(buff, "%f", inf); + written = LIBC_NAMESPACE::sprintf(buff, "%f", inf); ASSERT_STREQ_LEN(written, buff, "inf"); - written = __llvm_libc::sprintf(buff, "%F", -inf); + written = LIBC_NAMESPACE::sprintf(buff, "%F", -inf); ASSERT_STREQ_LEN(written, buff, "-INF"); - written = __llvm_libc::sprintf(buff, "%f", nan); + written = LIBC_NAMESPACE::sprintf(buff, "%f", nan); ASSERT_STREQ_LEN(written, buff, "nan"); - written = __llvm_libc::sprintf(buff, "%F", -nan); + written = LIBC_NAMESPACE::sprintf(buff, "%F", -nan); ASSERT_STREQ_LEN(written, buff, "-NAN"); // Length Modifier Tests. @@ -999,17 +1000,17 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { // TODO(michaelrj): Fix the tests to only depend on the digits the long double // is accurate for. - written = __llvm_libc::sprintf(buff, "%Lf", 1.0L); + written = LIBC_NAMESPACE::sprintf(buff, "%Lf", 1.0L); ASSERT_STREQ_LEN(written, buff, "1.000000"); #if defined(SPECIAL_X86_LONG_DOUBLE) - written = __llvm_libc::sprintf(buff, "%Lf", 1e100L); + written = LIBC_NAMESPACE::sprintf(buff, "%Lf", 1e100L); ASSERT_STREQ_LEN(written, buff, "99999999999999999996693535322073426194986990198284960792713" "91541752018669482644324418977840117055488.000000"); - written = __llvm_libc::sprintf(big_buff, "%Lf", 1e1000L); + written = LIBC_NAMESPACE::sprintf(big_buff, "%Lf", 1e1000L); ASSERT_STREQ_LEN( written, big_buff, "999999999999999999973107317669562353428234857594552594925899449376328728" @@ -1028,7 +1029,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { "2431457550909271560663602154947063707982236377366647567795879936." "000000"); - written = __llvm_libc::sprintf(big_buff, "%Lf", 1e4900L); + written = LIBC_NAMESPACE::sprintf(big_buff, "%Lf", 1e4900L); ASSERT_STREQ_LEN( written, big_buff, "100000000000000000002708312230690349833224052504078834346502930111959028" @@ -1101,7 +1102,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { "231934194956788626761834746430104077432547436359522462253411168467463134" "24896.000000"); - written = __llvm_libc::sprintf(big_buff, "%Lf", 0xf.fffffffffffffffp+16380L); + written = + LIBC_NAMESPACE::sprintf(big_buff, "%Lf", 0xf.fffffffffffffffp+16380L); ASSERT_STREQ_LEN( written, big_buff, "118973149535723176502126385303097020516906332229462420044032373389173700" @@ -1174,10 +1176,10 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { "538580868883777725864856414593426212108664758848926003176234596076950884" "9149662444156604419552086811989770240.000000"); - written = __llvm_libc::sprintf(big_buff, "%.10Lf", 1e-10L); + written = LIBC_NAMESPACE::sprintf(big_buff, "%.10Lf", 1e-10L); ASSERT_STREQ_LEN(written, big_buff, "0.0000000001"); - written = __llvm_libc::sprintf(big_buff, "%.7500Lf", 1e-4900L); + written = LIBC_NAMESPACE::sprintf(big_buff, "%.7500Lf", 1e-4900L); ASSERT_STREQ_LEN( written, big_buff, "0." @@ -1289,7 +1291,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { #endif // SPECIAL_X86_LONG_DOUBLE /* - written = __llvm_libc::sprintf(buff, "%La", 0.1L); + written = LIBC_NAMESPACE::sprintf(buff, "%La", 0.1L); #if defined(SPECIAL_X86_LONG_DOUBLE) ASSERT_STREQ_LEN(written, buff, "0xc.ccccccccccccccdp-7"); #elif defined(LONG_DOUBLE_IS_DOUBLE) @@ -1298,7 +1300,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { ASSERT_STREQ_LEN(written, buff, "0x1.999999999999999999999999999ap-4"); #endif - written = __llvm_libc::sprintf(buff, "%La", 1.0e1000L); + written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e1000L); #if defined(SPECIAL_X86_LONG_DOUBLE) ASSERT_STREQ_LEN(written, buff, "0xf.38db1f9dd3dac05p+3318"); #elif defined(LONG_DOUBLE_IS_DOUBLE) @@ -1307,7 +1309,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { ASSERT_STREQ_LEN(written, buff, "0x1.e71b63f3ba7b580af1a52d2a7379p+3321"); #endif - written = __llvm_libc::sprintf(buff, "%La", 1.0e-1000L); + written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e-1000L); #if defined(SPECIAL_X86_LONG_DOUBLE) ASSERT_STREQ_LEN(written, buff, "0x8.68a9188a89e1467p-3325"); #elif defined(LONG_DOUBLE_IS_DOUBLE) @@ -1319,88 +1321,88 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { // Min Width Tests. - written = __llvm_libc::sprintf(buff, "%15f", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%15f", 1.0); ASSERT_STREQ_LEN(written, buff, " 1.000000"); - written = __llvm_libc::sprintf(buff, "%15f", -1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%15f", -1.0); ASSERT_STREQ_LEN(written, buff, " -1.000000"); - written = __llvm_libc::sprintf(buff, "%15f", 1.0e5); + written = LIBC_NAMESPACE::sprintf(buff, "%15f", 1.0e5); ASSERT_STREQ_LEN(written, buff, " 100000.000000"); - written = __llvm_libc::sprintf(buff, "%15f", -1.0e5); + written = LIBC_NAMESPACE::sprintf(buff, "%15f", -1.0e5); ASSERT_STREQ_LEN(written, buff, " -100000.000000"); - written = __llvm_libc::sprintf(buff, "%10f", 1.0e5); + written = LIBC_NAMESPACE::sprintf(buff, "%10f", 1.0e5); ASSERT_STREQ_LEN(written, buff, "100000.000000"); // Precision Tests. - written = __llvm_libc::sprintf(buff, "%.1f", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.0); ASSERT_STREQ_LEN(written, buff, "1.0"); - written = __llvm_libc::sprintf(buff, "%.1f", 0.0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 0.0); ASSERT_STREQ_LEN(written, buff, "0.0"); - written = __llvm_libc::sprintf(buff, "%.0f", 0.0); + written = LIBC_NAMESPACE::sprintf(buff, "%.0f", 0.0); ASSERT_STREQ_LEN(written, buff, "0"); - written = __llvm_libc::sprintf(buff, "%.1f", 0.1); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 0.1); ASSERT_STREQ_LEN(written, buff, "0.1"); - written = __llvm_libc::sprintf(buff, "%.1f", 1.09); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.09); ASSERT_STREQ_LEN(written, buff, "1.1"); - written = __llvm_libc::sprintf(buff, "%.1f", 1.04); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.04); ASSERT_STREQ_LEN(written, buff, "1.0"); - written = __llvm_libc::sprintf(buff, "%.1f", 1.19); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.19); ASSERT_STREQ_LEN(written, buff, "1.2"); - written = __llvm_libc::sprintf(buff, "%.1f", 1.99); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.99); ASSERT_STREQ_LEN(written, buff, "2.0"); - written = __llvm_libc::sprintf(buff, "%.1f", 9.99); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 9.99); ASSERT_STREQ_LEN(written, buff, "10.0"); - written = __llvm_libc::sprintf(buff, "%.2f", 9999999999999.99); + written = LIBC_NAMESPACE::sprintf(buff, "%.2f", 9999999999999.99); ASSERT_STREQ_LEN(written, buff, "9999999999999.99"); - written = __llvm_libc::sprintf(buff, "%.1f", 9999999999999.99); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 9999999999999.99); ASSERT_STREQ_LEN(written, buff, "10000000000000.0"); - written = __llvm_libc::sprintf(buff, "%.5f", 1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.5f", 1.25); ASSERT_STREQ_LEN(written, buff, "1.25000"); - written = __llvm_libc::sprintf(buff, "%.0f", 1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.0f", 1.25); ASSERT_STREQ_LEN(written, buff, "1"); - written = __llvm_libc::sprintf(buff, "%.0f", 1.75); + written = LIBC_NAMESPACE::sprintf(buff, "%.0f", 1.75); ASSERT_STREQ_LEN(written, buff, "2"); - written = __llvm_libc::sprintf(buff, "%.20f", 1.234e-10); + written = LIBC_NAMESPACE::sprintf(buff, "%.20f", 1.234e-10); ASSERT_STREQ_LEN(written, buff, "0.00000000012340000000"); - written = __llvm_libc::sprintf(buff, "%.2f", -9.99); + written = LIBC_NAMESPACE::sprintf(buff, "%.2f", -9.99); ASSERT_STREQ_LEN(written, buff, "-9.99"); - written = __llvm_libc::sprintf(buff, "%.1f", -9.99); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -9.99); ASSERT_STREQ_LEN(written, buff, "-10.0"); - written = __llvm_libc::sprintf(buff, "%.5f", 0.0); + written = LIBC_NAMESPACE::sprintf(buff, "%.5f", 0.0); ASSERT_STREQ_LEN(written, buff, "0.00000"); - written = __llvm_libc::sprintf(buff, "%.5f", 1.008); + written = LIBC_NAMESPACE::sprintf(buff, "%.5f", 1.008); ASSERT_STREQ_LEN(written, buff, "1.00800"); - written = __llvm_libc::sprintf(buff, "%.5f", 1.008e3); + written = LIBC_NAMESPACE::sprintf(buff, "%.5f", 1.008e3); ASSERT_STREQ_LEN(written, buff, "1008.00000"); // Found with the help of Fred Tydeman's tbin2dec test. - written = __llvm_libc::sprintf(buff, "%.1f", 0x1.1000000000006p+3); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 0x1.1000000000006p+3); ASSERT_STREQ_LEN(written, buff, "8.5"); - written = __llvm_libc::sprintf(buff, "%.0f", 0x1.1000000000006p+3); + written = LIBC_NAMESPACE::sprintf(buff, "%.0f", 0x1.1000000000006p+3); ASSERT_STREQ_LEN(written, buff, "9"); // Most of these tests are checking rounding behavior when the precision is @@ -1410,13 +1412,13 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { // since when printing the floating point numbers are broken up into "blocks" // of 9 digits. They often also have a 5 after the end of what's printed, // since in round to nearest mode, that requires checking additional digits. - written = __llvm_libc::sprintf(buff, "%.9f", 1.9999999999999514); + written = LIBC_NAMESPACE::sprintf(buff, "%.9f", 1.9999999999999514); ASSERT_STREQ_LEN(written, buff, "2.000000000"); // The number continues after the literal because floating point numbers can't // represent every value. The printed value is the closest value a double can // represent, rounded to the requested precision. - written = __llvm_libc::sprintf(buff, "%.238f", 1.131959884853339E-72); + written = LIBC_NAMESPACE::sprintf(buff, "%.238f", 1.131959884853339E-72); ASSERT_STREQ_LEN( written, buff, "0." @@ -1425,10 +1427,11 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { "824105639342441431495119762431744054912109728706985341609159156917030486" "5110665559768676757812"); - written = __llvm_libc::sprintf(buff, "%.36f", 9.9e-77); + written = LIBC_NAMESPACE::sprintf(buff, "%.36f", 9.9e-77); ASSERT_STREQ_LEN(written, buff, "0.000000000000000000000000000000000000"); - written = __llvm_libc::sprintf(big_buff, "%.1071f", 2.0226568751604562E-314); + written = + LIBC_NAMESPACE::sprintf(big_buff, "%.1071f", 2.0226568751604562E-314); ASSERT_STREQ_LEN( written, big_buff, "0." @@ -1449,12 +1452,12 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { "750016448075109469332839157162950982637994457036256790161132812"); // If no precision is specified it defaults to 6 for %f. - written = __llvm_libc::sprintf(buff, "%f", 2325885.4901960781); + written = LIBC_NAMESPACE::sprintf(buff, "%f", 2325885.4901960781); ASSERT_STREQ_LEN(written, buff, "2325885.490196"); // Subnormal Precision Tests - written = __llvm_libc::sprintf(buff, "%.310f", 0x1.0p-1022); + written = LIBC_NAMESPACE::sprintf(buff, "%.310f", 0x1.0p-1022); ASSERT_STREQ_LEN( written, buff, "0." @@ -1464,7 +1467,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { "000000000000000000000000000000000000000000000000000000000000000000000000" "0000000000000000000223"); - written = __llvm_libc::sprintf(buff, "%.310f", 0x1.0p-1023); + written = LIBC_NAMESPACE::sprintf(buff, "%.310f", 0x1.0p-1023); ASSERT_STREQ_LEN( written, buff, "0." @@ -1474,7 +1477,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { "000000000000000000000000000000000000000000000000000000000000000000000000" "0000000000000000000111"); - written = __llvm_libc::sprintf(buff, "%.315f", 9.99999e-310); + written = LIBC_NAMESPACE::sprintf(buff, "%.315f", 9.99999e-310); ASSERT_STREQ_LEN( written, buff, "0." @@ -1484,7 +1487,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { "000000000000000000000000000000000000000000000000000000000000000000000000" "000000000000000000000999999"); - written = __llvm_libc::sprintf(buff, "%.314f", 9.99999e-310); + written = LIBC_NAMESPACE::sprintf(buff, "%.314f", 9.99999e-310); ASSERT_STREQ_LEN( written, buff, "0." @@ -1494,7 +1497,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { "000000000000000000000000000000000000000000000000000000000000000000000000" "00000000000000000000100000"); - written = __llvm_libc::sprintf(buff, "%.330f", 0x1.0p-1074); + written = LIBC_NAMESPACE::sprintf(buff, "%.330f", 0x1.0p-1074); ASSERT_STREQ_LEN( written, buff, "0." @@ -1505,7 +1508,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { "000000000000000000000000000000000004940656"); /* - written = __llvm_libc::sprintf(buff, "%.1La", 0.1L); + written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0.1L); #if defined(SPECIAL_X86_LONG_DOUBLE) ASSERT_STREQ_LEN(written, buff, "0xc.dp-7"); #elif defined(LONG_DOUBLE_IS_DOUBLE) @@ -1514,8 +1517,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { ASSERT_STREQ_LEN(written, buff, "0x1.ap-4"); #endif - written = __llvm_libc::sprintf(buff, "%.1La", 0xf.fffffffffffffffp16380L); - #if defined(SPECIAL_X86_LONG_DOUBLE) + written = LIBC_NAMESPACE::sprintf(buff, "%.1La", + 0xf.fffffffffffffffp16380L); #if defined(SPECIAL_X86_LONG_DOUBLE) ASSERT_STREQ_LEN(written, buff, "0x1.0p+16384"); #elif defined(LONG_DOUBLE_IS_DOUBLE) ASSERT_STREQ_LEN(written, buff, "inf"); @@ -1527,319 +1530,319 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { // Rounding Mode Tests. if (ForceRoundingMode r(RoundingMode::Nearest); r.success) { - written = __llvm_libc::sprintf(buff, "%.1f", 1.75); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.75); ASSERT_STREQ_LEN(written, buff, "1.8"); - written = __llvm_libc::sprintf(buff, "%.1f", 1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.25); ASSERT_STREQ_LEN(written, buff, "1.2"); - written = __llvm_libc::sprintf(buff, "%.1f", 1.125); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.125); ASSERT_STREQ_LEN(written, buff, "1.1"); - written = __llvm_libc::sprintf(buff, "%.1f", 1.625); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.625); ASSERT_STREQ_LEN(written, buff, "1.6"); - written = __llvm_libc::sprintf(buff, "%.1f", 1.375); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.375); ASSERT_STREQ_LEN(written, buff, "1.4"); - written = __llvm_libc::sprintf(buff, "%.1f", 1.875); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.875); ASSERT_STREQ_LEN(written, buff, "1.9"); - written = __llvm_libc::sprintf(buff, "%.1f", -1.75); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.75); ASSERT_STREQ_LEN(written, buff, "-1.8"); - written = __llvm_libc::sprintf(buff, "%.1f", -1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.25); ASSERT_STREQ_LEN(written, buff, "-1.2"); - written = __llvm_libc::sprintf(buff, "%.1f", -1.125); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.125); ASSERT_STREQ_LEN(written, buff, "-1.1"); - written = __llvm_libc::sprintf(buff, "%.1f", -1.625); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.625); ASSERT_STREQ_LEN(written, buff, "-1.6"); - written = __llvm_libc::sprintf(buff, "%.1f", -1.375); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.375); ASSERT_STREQ_LEN(written, buff, "-1.4"); - written = __llvm_libc::sprintf(buff, "%.1f", -1.875); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.875); ASSERT_STREQ_LEN(written, buff, "-1.9"); } if (ForceRoundingMode r(RoundingMode::Upward); r.success) { - written = __llvm_libc::sprintf(buff, "%.1f", 1.75); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.75); ASSERT_STREQ_LEN(written, buff, "1.8"); - written = __llvm_libc::sprintf(buff, "%.1f", 1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.25); ASSERT_STREQ_LEN(written, buff, "1.3"); - written = __llvm_libc::sprintf(buff, "%.1f", 1.125); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.125); ASSERT_STREQ_LEN(written, buff, "1.2"); - written = __llvm_libc::sprintf(buff, "%.1f", 1.625); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.625); ASSERT_STREQ_LEN(written, buff, "1.7"); - written = __llvm_libc::sprintf(buff, "%.1f", 1.375); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.375); ASSERT_STREQ_LEN(written, buff, "1.4"); - written = __llvm_libc::sprintf(buff, "%.1f", 1.875); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.875); ASSERT_STREQ_LEN(written, buff, "1.9"); - written = __llvm_libc::sprintf(buff, "%.1f", -1.75); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.75); ASSERT_STREQ_LEN(written, buff, "-1.7"); - written = __llvm_libc::sprintf(buff, "%.1f", -1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.25); ASSERT_STREQ_LEN(written, buff, "-1.2"); - written = __llvm_libc::sprintf(buff, "%.1f", -1.125); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.125); ASSERT_STREQ_LEN(written, buff, "-1.1"); - written = __llvm_libc::sprintf(buff, "%.1f", -1.625); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.625); ASSERT_STREQ_LEN(written, buff, "-1.6"); - written = __llvm_libc::sprintf(buff, "%.1f", -1.375); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.375); ASSERT_STREQ_LEN(written, buff, "-1.3"); - written = __llvm_libc::sprintf(buff, "%.1f", -1.875); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.875); ASSERT_STREQ_LEN(written, buff, "-1.8"); } if (ForceRoundingMode r(RoundingMode::Downward); r.success) { - written = __llvm_libc::sprintf(buff, "%.1f", 1.75); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.75); ASSERT_STREQ_LEN(written, buff, "1.7"); - written = __llvm_libc::sprintf(buff, "%.1f", 1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.25); ASSERT_STREQ_LEN(written, buff, "1.2"); - written = __llvm_libc::sprintf(buff, "%.1f", 1.125); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.125); ASSERT_STREQ_LEN(written, buff, "1.1"); - written = __llvm_libc::sprintf(buff, "%.1f", 1.625); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.625); ASSERT_STREQ_LEN(written, buff, "1.6"); - written = __llvm_libc::sprintf(buff, "%.1f", 1.375); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.375); ASSERT_STREQ_LEN(written, buff, "1.3"); - written = __llvm_libc::sprintf(buff, "%.1f", 1.875); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.875); ASSERT_STREQ_LEN(written, buff, "1.8"); - written = __llvm_libc::sprintf(buff, "%.1f", -1.75); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.75); ASSERT_STREQ_LEN(written, buff, "-1.8"); - written = __llvm_libc::sprintf(buff, "%.1f", -1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.25); ASSERT_STREQ_LEN(written, buff, "-1.3"); - written = __llvm_libc::sprintf(buff, "%.1f", -1.125); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.125); ASSERT_STREQ_LEN(written, buff, "-1.2"); - written = __llvm_libc::sprintf(buff, "%.1f", -1.625); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.625); ASSERT_STREQ_LEN(written, buff, "-1.7"); - written = __llvm_libc::sprintf(buff, "%.1f", -1.375); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.375); ASSERT_STREQ_LEN(written, buff, "-1.4"); - written = __llvm_libc::sprintf(buff, "%.1f", -1.875); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.875); ASSERT_STREQ_LEN(written, buff, "-1.9"); } if (ForceRoundingMode r(RoundingMode::TowardZero); r.success) { - written = __llvm_libc::sprintf(buff, "%.1f", 1.75); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.75); ASSERT_STREQ_LEN(written, buff, "1.7"); - written = __llvm_libc::sprintf(buff, "%.1f", 1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.25); ASSERT_STREQ_LEN(written, buff, "1.2"); - written = __llvm_libc::sprintf(buff, "%.1f", 1.125); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.125); ASSERT_STREQ_LEN(written, buff, "1.1"); - written = __llvm_libc::sprintf(buff, "%.1f", 1.625); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.625); ASSERT_STREQ_LEN(written, buff, "1.6"); - written = __llvm_libc::sprintf(buff, "%.1f", 1.375); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.375); ASSERT_STREQ_LEN(written, buff, "1.3"); - written = __llvm_libc::sprintf(buff, "%.1f", 1.875); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", 1.875); ASSERT_STREQ_LEN(written, buff, "1.8"); - written = __llvm_libc::sprintf(buff, "%.1f", -1.75); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.75); ASSERT_STREQ_LEN(written, buff, "-1.7"); - written = __llvm_libc::sprintf(buff, "%.1f", -1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.25); ASSERT_STREQ_LEN(written, buff, "-1.2"); - written = __llvm_libc::sprintf(buff, "%.1f", -1.125); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.125); ASSERT_STREQ_LEN(written, buff, "-1.1"); - written = __llvm_libc::sprintf(buff, "%.1f", -1.625); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.625); ASSERT_STREQ_LEN(written, buff, "-1.6"); - written = __llvm_libc::sprintf(buff, "%.1f", -1.375); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.375); ASSERT_STREQ_LEN(written, buff, "-1.3"); - written = __llvm_libc::sprintf(buff, "%.1f", -1.875); + written = LIBC_NAMESPACE::sprintf(buff, "%.1f", -1.875); ASSERT_STREQ_LEN(written, buff, "-1.8"); } // Flag Tests. - written = __llvm_libc::sprintf(buff, "%+f", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%+f", 1.0); ASSERT_STREQ_LEN(written, buff, "+1.000000"); - written = __llvm_libc::sprintf(buff, "%+f", -1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%+f", -1.0); ASSERT_STREQ_LEN(written, buff, "-1.000000"); - written = __llvm_libc::sprintf(buff, "% f", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "% f", 1.0); ASSERT_STREQ_LEN(written, buff, " 1.000000"); - written = __llvm_libc::sprintf(buff, "% f", -1.0); + written = LIBC_NAMESPACE::sprintf(buff, "% f", -1.0); ASSERT_STREQ_LEN(written, buff, "-1.000000"); - written = __llvm_libc::sprintf(buff, "%-10f", 1.5); + written = LIBC_NAMESPACE::sprintf(buff, "%-10f", 1.5); ASSERT_STREQ_LEN(written, buff, "1.500000 "); - written = __llvm_libc::sprintf(buff, "%#.f", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%#.f", 1.0); ASSERT_STREQ_LEN(written, buff, "1."); - written = __llvm_libc::sprintf(buff, "%#.0f", 1.5); + written = LIBC_NAMESPACE::sprintf(buff, "%#.0f", 1.5); ASSERT_STREQ_LEN(written, buff, "2."); - written = __llvm_libc::sprintf(buff, "%010f", 1.5); + written = LIBC_NAMESPACE::sprintf(buff, "%010f", 1.5); ASSERT_STREQ_LEN(written, buff, "001.500000"); - written = __llvm_libc::sprintf(buff, "%010f", -1.5); + written = LIBC_NAMESPACE::sprintf(buff, "%010f", -1.5); ASSERT_STREQ_LEN(written, buff, "-01.500000"); - written = __llvm_libc::sprintf(buff, "%+- #0f", 0.0); + written = LIBC_NAMESPACE::sprintf(buff, "%+- #0f", 0.0); ASSERT_STREQ_LEN(written, buff, "+0.000000"); // Combined Tests. - written = __llvm_libc::sprintf(buff, "%10.2f", 9.99); + written = LIBC_NAMESPACE::sprintf(buff, "%10.2f", 9.99); ASSERT_STREQ_LEN(written, buff, " 9.99"); - written = __llvm_libc::sprintf(buff, "%5.1f", 9.99); + written = LIBC_NAMESPACE::sprintf(buff, "%5.1f", 9.99); ASSERT_STREQ_LEN(written, buff, " 10.0"); - written = __llvm_libc::sprintf(buff, "%-10.2f", 9.99); + written = LIBC_NAMESPACE::sprintf(buff, "%-10.2f", 9.99); ASSERT_STREQ_LEN(written, buff, "9.99 "); - written = __llvm_libc::sprintf(buff, "%-5.1f", 9.99); + written = LIBC_NAMESPACE::sprintf(buff, "%-5.1f", 9.99); ASSERT_STREQ_LEN(written, buff, "10.0 "); - written = __llvm_libc::sprintf(buff, "%-5.1f", 1.0e-50); + written = LIBC_NAMESPACE::sprintf(buff, "%-5.1f", 1.0e-50); ASSERT_STREQ_LEN(written, buff, "0.0 "); - written = __llvm_libc::sprintf(buff, "%30f", 1234567890123456789.0); + written = LIBC_NAMESPACE::sprintf(buff, "%30f", 1234567890123456789.0); ASSERT_STREQ_LEN(written, buff, " 1234567890123456768.000000"); - written = __llvm_libc::sprintf(buff, "%-30f", 1234567890123456789.0); + written = LIBC_NAMESPACE::sprintf(buff, "%-30f", 1234567890123456789.0); ASSERT_STREQ_LEN(written, buff, "1234567890123456768.000000 "); - written = __llvm_libc::sprintf(buff, "%20.2f", 9999999999999.99); + written = LIBC_NAMESPACE::sprintf(buff, "%20.2f", 9999999999999.99); ASSERT_STREQ_LEN(written, buff, " 9999999999999.99"); - written = __llvm_libc::sprintf(buff, "%20.1f", 9999999999999.99); + written = LIBC_NAMESPACE::sprintf(buff, "%20.1f", 9999999999999.99); ASSERT_STREQ_LEN(written, buff, " 10000000000000.0"); - written = __llvm_libc::sprintf(buff, "%12.3f %-12.3f", 0.1, 256.0); + written = LIBC_NAMESPACE::sprintf(buff, "%12.3f %-12.3f", 0.1, 256.0); ASSERT_STREQ_LEN(written, buff, " 0.100 256.000 "); - written = __llvm_libc::sprintf(buff, "%+-#12.3f % 012.3f", 0.1256, 1256.0); + written = LIBC_NAMESPACE::sprintf(buff, "%+-#12.3f % 012.3f", 0.1256, 1256.0); ASSERT_STREQ_LEN(written, buff, "+0.126 0001256.000"); } TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) { ForceRoundingMode r(RoundingMode::Nearest); - double inf = __llvm_libc::fputil::FPBits::inf().get_val(); - double nan = __llvm_libc::fputil::FPBits::build_nan(1); + double inf = LIBC_NAMESPACE::fputil::FPBits::inf().get_val(); + double nan = LIBC_NAMESPACE::fputil::FPBits::build_nan(1); - written = __llvm_libc::sprintf(buff, "%e", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%e", 1.0); ASSERT_STREQ_LEN(written, buff, "1.000000e+00"); - written = __llvm_libc::sprintf(buff, "%E", -1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%E", -1.0); ASSERT_STREQ_LEN(written, buff, "-1.000000E+00"); - written = __llvm_libc::sprintf(buff, "%e", -1.234567); + written = LIBC_NAMESPACE::sprintf(buff, "%e", -1.234567); ASSERT_STREQ_LEN(written, buff, "-1.234567e+00"); - written = __llvm_libc::sprintf(buff, "%e", 0.0); + written = LIBC_NAMESPACE::sprintf(buff, "%e", 0.0); ASSERT_STREQ_LEN(written, buff, "0.000000e+00"); - written = __llvm_libc::sprintf(buff, "%e", 1.5); + written = LIBC_NAMESPACE::sprintf(buff, "%e", 1.5); ASSERT_STREQ_LEN(written, buff, "1.500000e+00"); - written = __llvm_libc::sprintf(buff, "%e", 1e300); + written = LIBC_NAMESPACE::sprintf(buff, "%e", 1e300); ASSERT_STREQ_LEN(written, buff, "1.000000e+300"); - written = __llvm_libc::sprintf(buff, "%e", 0.1); + written = LIBC_NAMESPACE::sprintf(buff, "%e", 0.1); ASSERT_STREQ_LEN(written, buff, "1.000000e-01"); - written = __llvm_libc::sprintf(buff, "%e", 0.001); + written = LIBC_NAMESPACE::sprintf(buff, "%e", 0.001); ASSERT_STREQ_LEN(written, buff, "1.000000e-03"); - written = __llvm_libc::sprintf(buff, "%e", 0.00001); + written = LIBC_NAMESPACE::sprintf(buff, "%e", 0.00001); ASSERT_STREQ_LEN(written, buff, "1.000000e-05"); - written = __llvm_libc::sprintf(buff, "%e", 0.0000001); + written = LIBC_NAMESPACE::sprintf(buff, "%e", 0.0000001); ASSERT_STREQ_LEN(written, buff, "1.000000e-07"); - written = __llvm_libc::sprintf(buff, "%e", 0.000000001); + written = LIBC_NAMESPACE::sprintf(buff, "%e", 0.000000001); ASSERT_STREQ_LEN(written, buff, "1.000000e-09"); - written = __llvm_libc::sprintf(buff, "%e", 1.0e-20); + written = LIBC_NAMESPACE::sprintf(buff, "%e", 1.0e-20); ASSERT_STREQ_LEN(written, buff, "1.000000e-20"); - written = __llvm_libc::sprintf(buff, "%e", 1234567890123456789.0); + written = LIBC_NAMESPACE::sprintf(buff, "%e", 1234567890123456789.0); ASSERT_STREQ_LEN(written, buff, "1.234568e+18"); - written = __llvm_libc::sprintf(buff, "%e", 9999999000000.00); + written = LIBC_NAMESPACE::sprintf(buff, "%e", 9999999000000.00); ASSERT_STREQ_LEN(written, buff, "9.999999e+12"); // Simple Subnormal Tests. - written = __llvm_libc::sprintf(buff, "%e", 0x1.0p-1027); + written = LIBC_NAMESPACE::sprintf(buff, "%e", 0x1.0p-1027); ASSERT_STREQ_LEN(written, buff, "6.953356e-310"); - written = __llvm_libc::sprintf(buff, "%e", 0x1.0p-1074); + written = LIBC_NAMESPACE::sprintf(buff, "%e", 0x1.0p-1074); ASSERT_STREQ_LEN(written, buff, "4.940656e-324"); // Inf/Nan Tests. - written = __llvm_libc::sprintf(buff, "%e", inf); + written = LIBC_NAMESPACE::sprintf(buff, "%e", inf); ASSERT_STREQ_LEN(written, buff, "inf"); - written = __llvm_libc::sprintf(buff, "%E", -inf); + written = LIBC_NAMESPACE::sprintf(buff, "%E", -inf); ASSERT_STREQ_LEN(written, buff, "-INF"); - written = __llvm_libc::sprintf(buff, "%e", nan); + written = LIBC_NAMESPACE::sprintf(buff, "%e", nan); ASSERT_STREQ_LEN(written, buff, "nan"); - written = __llvm_libc::sprintf(buff, "%E", -nan); + written = LIBC_NAMESPACE::sprintf(buff, "%E", -nan); ASSERT_STREQ_LEN(written, buff, "-NAN"); // Length Modifier Tests. #if defined(SPECIAL_X86_LONG_DOUBLE) - written = __llvm_libc::sprintf(buff, "%.9Le", 1000000000500000000.1L); + written = LIBC_NAMESPACE::sprintf(buff, "%.9Le", 1000000000500000000.1L); ASSERT_STREQ_LEN(written, buff, "1.000000001e+18"); - written = __llvm_libc::sprintf(buff, "%.9Le", 1000000000500000000.0L); + written = LIBC_NAMESPACE::sprintf(buff, "%.9Le", 1000000000500000000.0L); ASSERT_STREQ_LEN(written, buff, "1.000000000e+18"); - written = __llvm_libc::sprintf(buff, "%Le", 0xf.fffffffffffffffp+16380L); + written = LIBC_NAMESPACE::sprintf(buff, "%Le", 0xf.fffffffffffffffp+16380L); ASSERT_STREQ_LEN(written, buff, "1.189731e+4932"); #endif // TODO: Fix long doubles (needs bigger table or alternate algorithm.) // Currently the table values are generated, which is very slow. /* - written = __llvm_libc::sprintf(buff, "%Lf", 1e100L); + written = LIBC_NAMESPACE::sprintf(buff, "%Lf", 1e100L); ASSERT_STREQ_LEN(written, buff, "99999999999999999996693535322073426194986990198284960792713" "91541752018669482644324418977840117055488.000000"); - written = __llvm_libc::sprintf(buff, "%Lf", 1.0L); + written = LIBC_NAMESPACE::sprintf(buff, "%Lf", 1.0L); ASSERT_STREQ_LEN(written, buff, "1.000000"); char big_buff[10000]; - written = __llvm_libc::sprintf(big_buff, "%Lf", 1e1000L); + written = LIBC_NAMESPACE::sprintf(big_buff, "%Lf", 1e1000L); ASSERT_STREQ_LEN( written, big_buff, "999999999999999999973107317669562353428234857594552594925899449376328728" @@ -1858,7 +1861,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) { "2431457550909271560663602154947063707982236377366647567795879936." "000000"); - written = __llvm_libc::sprintf(big_buff, "%Lf", 1e4900L); + written = LIBC_NAMESPACE::sprintf(big_buff, "%Lf", 1e4900L); ASSERT_STREQ_LEN( written, big_buff, "100000000000000000002708312230690349833224052504078834346502930111959028" @@ -1932,7 +1935,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) { "24896.000000"); */ /* - written = __llvm_libc::sprintf(buff, "%La", 0.1L); + written = LIBC_NAMESPACE::sprintf(buff, "%La", 0.1L); #if defined(SPECIAL_X86_LONG_DOUBLE) ASSERT_STREQ_LEN(written, buff, "0xc.ccccccccccccccdp-7"); #elif defined(LONG_DOUBLE_IS_DOUBLE) @@ -1941,7 +1944,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) { ASSERT_STREQ_LEN(written, buff, "0x1.999999999999999999999999999ap-4"); #endif - written = __llvm_libc::sprintf(buff, "%La", 1.0e1000L); + written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e1000L); #if defined(SPECIAL_X86_LONG_DOUBLE) ASSERT_STREQ_LEN(written, buff, "0xf.38db1f9dd3dac05p+3318"); #elif defined(LONG_DOUBLE_IS_DOUBLE) @@ -1950,7 +1953,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) { ASSERT_STREQ_LEN(written, buff, "0x1.e71b63f3ba7b580af1a52d2a7379p+3321"); #endif - written = __llvm_libc::sprintf(buff, "%La", 1.0e-1000L); + written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e-1000L); #if defined(SPECIAL_X86_LONG_DOUBLE) ASSERT_STREQ_LEN(written, buff, "0x8.68a9188a89e1467p-3325"); #elif defined(LONG_DOUBLE_IS_DOUBLE) @@ -1962,81 +1965,81 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) { // Min Width Tests. - written = __llvm_libc::sprintf(buff, "%15e", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%15e", 1.0); ASSERT_STREQ_LEN(written, buff, " 1.000000e+00"); - written = __llvm_libc::sprintf(buff, "%15e", -1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%15e", -1.0); ASSERT_STREQ_LEN(written, buff, " -1.000000e+00"); - written = __llvm_libc::sprintf(buff, "%15e", 1.0e5); + written = LIBC_NAMESPACE::sprintf(buff, "%15e", 1.0e5); ASSERT_STREQ_LEN(written, buff, " 1.000000e+05"); - written = __llvm_libc::sprintf(buff, "%15e", -1.0e5); + written = LIBC_NAMESPACE::sprintf(buff, "%15e", -1.0e5); ASSERT_STREQ_LEN(written, buff, " -1.000000e+05"); - written = __llvm_libc::sprintf(buff, "%10e", 1.0e-5); + written = LIBC_NAMESPACE::sprintf(buff, "%10e", 1.0e-5); ASSERT_STREQ_LEN(written, buff, "1.000000e-05"); // Precision Tests. - written = __llvm_libc::sprintf(buff, "%.1e", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.0); ASSERT_STREQ_LEN(written, buff, "1.0e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", 0.0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 0.0); ASSERT_STREQ_LEN(written, buff, "0.0e+00"); - written = __llvm_libc::sprintf(buff, "%.0e", 0.0); + written = LIBC_NAMESPACE::sprintf(buff, "%.0e", 0.0); ASSERT_STREQ_LEN(written, buff, "0e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", 0.1); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 0.1); ASSERT_STREQ_LEN(written, buff, "1.0e-01"); - written = __llvm_libc::sprintf(buff, "%.1e", 1.09); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.09); ASSERT_STREQ_LEN(written, buff, "1.1e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", 1.04); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.04); ASSERT_STREQ_LEN(written, buff, "1.0e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", 1.19); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.19); ASSERT_STREQ_LEN(written, buff, "1.2e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", 1.99); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.99); ASSERT_STREQ_LEN(written, buff, "2.0e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", 9.99); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 9.99); ASSERT_STREQ_LEN(written, buff, "1.0e+01"); - written = __llvm_libc::sprintf(buff, "%.2e", 99.9); + written = LIBC_NAMESPACE::sprintf(buff, "%.2e", 99.9); ASSERT_STREQ_LEN(written, buff, "9.99e+01"); - written = __llvm_libc::sprintf(buff, "%.1e", 99.9); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 99.9); ASSERT_STREQ_LEN(written, buff, "1.0e+02"); - written = __llvm_libc::sprintf(buff, "%.5e", 1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.5e", 1.25); ASSERT_STREQ_LEN(written, buff, "1.25000e+00"); - written = __llvm_libc::sprintf(buff, "%.0e", 1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.0e", 1.25); ASSERT_STREQ_LEN(written, buff, "1e+00"); - written = __llvm_libc::sprintf(buff, "%.0e", 1.75); + written = LIBC_NAMESPACE::sprintf(buff, "%.0e", 1.75); ASSERT_STREQ_LEN(written, buff, "2e+00"); - written = __llvm_libc::sprintf(buff, "%.20e", 1.234e-10); + written = LIBC_NAMESPACE::sprintf(buff, "%.20e", 1.234e-10); ASSERT_STREQ_LEN(written, buff, "1.23400000000000008140e-10"); - written = __llvm_libc::sprintf(buff, "%.2e", -9.99); + written = LIBC_NAMESPACE::sprintf(buff, "%.2e", -9.99); ASSERT_STREQ_LEN(written, buff, "-9.99e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", -9.99); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -9.99); ASSERT_STREQ_LEN(written, buff, "-1.0e+01"); - written = __llvm_libc::sprintf(buff, "%.5e", 0.0); + written = LIBC_NAMESPACE::sprintf(buff, "%.5e", 0.0); ASSERT_STREQ_LEN(written, buff, "0.00000e+00"); - written = __llvm_libc::sprintf(buff, "%.5e", 1.008); + written = LIBC_NAMESPACE::sprintf(buff, "%.5e", 1.008); ASSERT_STREQ_LEN(written, buff, "1.00800e+00"); - written = __llvm_libc::sprintf(buff, "%.5e", 1.008e3); + written = LIBC_NAMESPACE::sprintf(buff, "%.5e", 1.008e3); ASSERT_STREQ_LEN(written, buff, "1.00800e+03"); // These tests also focus on rounding. Almost all of them have a 5 right after @@ -2047,40 +2050,40 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) { // even (if the 5 is the last non-zero digit). Additionally, the algorithm for // checking if a number is all 0s after the decimal point may not work since // the decimal point moves in this representation. - written = __llvm_libc::sprintf(buff, "%.0e", 2.5812229360061737E+200); + written = LIBC_NAMESPACE::sprintf(buff, "%.0e", 2.5812229360061737E+200); ASSERT_STREQ_LEN(written, buff, "3e+200"); - written = __llvm_libc::sprintf(buff, "%.1e", 9.059E+200); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 9.059E+200); ASSERT_STREQ_LEN(written, buff, "9.1e+200"); - written = __llvm_libc::sprintf(buff, "%.0e", 9.059E+200); + written = LIBC_NAMESPACE::sprintf(buff, "%.0e", 9.059E+200); ASSERT_STREQ_LEN(written, buff, "9e+200"); - written = __llvm_libc::sprintf(buff, "%.166e", 1.131959884853339E-72); + written = LIBC_NAMESPACE::sprintf(buff, "%.166e", 1.131959884853339E-72); ASSERT_STREQ_LEN(written, buff, "1." "13195988485333904593863991136097397258531639976739227369782" "68612419376648241056393424414314951197624317440549121097287" "069853416091591569170304865110665559768676757812e-72"); - written = __llvm_libc::sprintf(buff, "%.0e", 9.5); + written = LIBC_NAMESPACE::sprintf(buff, "%.0e", 9.5); ASSERT_STREQ_LEN(written, buff, "1e+01"); - written = __llvm_libc::sprintf(buff, "%.10e", 1.9999999999890936); + written = LIBC_NAMESPACE::sprintf(buff, "%.10e", 1.9999999999890936); ASSERT_STREQ_LEN(written, buff, "2.0000000000e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", 745362143563.03894); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 745362143563.03894); ASSERT_STREQ_LEN(written, buff, "7.5e+11"); - written = __llvm_libc::sprintf(buff, "%.0e", 45181042688.0); + written = LIBC_NAMESPACE::sprintf(buff, "%.0e", 45181042688.0); ASSERT_STREQ_LEN(written, buff, "5e+10"); - written = __llvm_libc::sprintf(buff, "%.35e", 1.3752441369139243); + written = LIBC_NAMESPACE::sprintf(buff, "%.35e", 1.3752441369139243); ASSERT_STREQ_LEN(written, buff, "1.37524413691392433101157166674965993e+00"); // Subnormal Precision Tests - written = __llvm_libc::sprintf(buff, "%.310e", 0x1.0p-1022); + written = LIBC_NAMESPACE::sprintf(buff, "%.310e", 0x1.0p-1022); ASSERT_STREQ_LEN( written, buff, "2." @@ -2090,10 +2093,10 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) { "375250806650616658158948720491179968591639648500635908770118304874799780" "8877537499494515804516e-308"); - written = __llvm_libc::sprintf(buff, "%.30e", 0x1.0p-1022); + written = LIBC_NAMESPACE::sprintf(buff, "%.30e", 0x1.0p-1022); ASSERT_STREQ_LEN(written, buff, "2.225073858507201383090232717332e-308"); - written = __llvm_libc::sprintf(buff, "%.310e", 0x1.0p-1023); + written = LIBC_NAMESPACE::sprintf(buff, "%.310e", 0x1.0p-1023); ASSERT_STREQ_LEN( written, buff, "1." @@ -2103,32 +2106,32 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) { "187625403325308329079474360245589984295819824250317954385059152437399890" "4438768749747257902258e-308"); - written = __llvm_libc::sprintf(buff, "%.6e", 9.99999e-310); + written = LIBC_NAMESPACE::sprintf(buff, "%.6e", 9.99999e-310); ASSERT_STREQ_LEN(written, buff, "9.999990e-310"); - written = __llvm_libc::sprintf(buff, "%.5e", 9.99999e-310); + written = LIBC_NAMESPACE::sprintf(buff, "%.5e", 9.99999e-310); ASSERT_STREQ_LEN(written, buff, "9.99999e-310"); - written = __llvm_libc::sprintf(buff, "%.4e", 9.99999e-310); + written = LIBC_NAMESPACE::sprintf(buff, "%.4e", 9.99999e-310); ASSERT_STREQ_LEN(written, buff, "1.0000e-309"); - written = __llvm_libc::sprintf(buff, "%.3e", 9.99999e-310); + written = LIBC_NAMESPACE::sprintf(buff, "%.3e", 9.99999e-310); ASSERT_STREQ_LEN(written, buff, "1.000e-309"); - written = __llvm_libc::sprintf(buff, "%.2e", 9.99999e-310); + written = LIBC_NAMESPACE::sprintf(buff, "%.2e", 9.99999e-310); ASSERT_STREQ_LEN(written, buff, "1.00e-309"); - written = __llvm_libc::sprintf(buff, "%.1e", 9.99999e-310); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 9.99999e-310); ASSERT_STREQ_LEN(written, buff, "1.0e-309"); - written = __llvm_libc::sprintf(buff, "%.0e", 9.99999e-310); + written = LIBC_NAMESPACE::sprintf(buff, "%.0e", 9.99999e-310); ASSERT_STREQ_LEN(written, buff, "1e-309"); - written = __llvm_libc::sprintf(buff, "%.10e", 0x1.0p-1074); + written = LIBC_NAMESPACE::sprintf(buff, "%.10e", 0x1.0p-1074); ASSERT_STREQ_LEN(written, buff, "4.9406564584e-324"); /* - written = __llvm_libc::sprintf(buff, "%.1La", 0.1L); + written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0.1L); #if defined(SPECIAL_X86_LONG_DOUBLE) ASSERT_STREQ_LEN(written, buff, "0xc.dp-7"); #elif defined(LONG_DOUBLE_IS_DOUBLE) @@ -2137,8 +2140,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) { ASSERT_STREQ_LEN(written, buff, "0x1.ap-4"); #endif - written = __llvm_libc::sprintf(buff, "%.1La", 0xf.fffffffffffffffp16380L); - #if defined(SPECIAL_X86_LONG_DOUBLE) + written = LIBC_NAMESPACE::sprintf(buff, "%.1La", + 0xf.fffffffffffffffp16380L); #if defined(SPECIAL_X86_LONG_DOUBLE) ASSERT_STREQ_LEN(written, buff, "0x1.0p+16384"); #elif defined(LONG_DOUBLE_IS_DOUBLE) ASSERT_STREQ_LEN(written, buff, "inf"); @@ -2150,325 +2153,325 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) { // Rounding Mode Tests. if (ForceRoundingMode r(RoundingMode::Nearest); r.success) { - written = __llvm_libc::sprintf(buff, "%.1e", 1.75); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.75); ASSERT_STREQ_LEN(written, buff, "1.8e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", 1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.25); ASSERT_STREQ_LEN(written, buff, "1.2e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", 1.125); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.125); ASSERT_STREQ_LEN(written, buff, "1.1e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", 1.625); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.625); ASSERT_STREQ_LEN(written, buff, "1.6e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", 1.375); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.375); ASSERT_STREQ_LEN(written, buff, "1.4e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", 1.875); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.875); ASSERT_STREQ_LEN(written, buff, "1.9e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", -1.75); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.75); ASSERT_STREQ_LEN(written, buff, "-1.8e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", -1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.25); ASSERT_STREQ_LEN(written, buff, "-1.2e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", -1.125); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.125); ASSERT_STREQ_LEN(written, buff, "-1.1e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", -1.625); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.625); ASSERT_STREQ_LEN(written, buff, "-1.6e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", -1.375); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.375); ASSERT_STREQ_LEN(written, buff, "-1.4e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", -1.875); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.875); ASSERT_STREQ_LEN(written, buff, "-1.9e+00"); } if (ForceRoundingMode r(RoundingMode::Upward); r.success) { - written = __llvm_libc::sprintf(buff, "%.1e", 1.75); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.75); ASSERT_STREQ_LEN(written, buff, "1.8e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", 1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.25); ASSERT_STREQ_LEN(written, buff, "1.3e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", 1.125); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.125); ASSERT_STREQ_LEN(written, buff, "1.2e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", 1.625); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.625); ASSERT_STREQ_LEN(written, buff, "1.7e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", 1.375); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.375); ASSERT_STREQ_LEN(written, buff, "1.4e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", 1.875); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.875); ASSERT_STREQ_LEN(written, buff, "1.9e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", -1.75); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.75); ASSERT_STREQ_LEN(written, buff, "-1.7e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", -1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.25); ASSERT_STREQ_LEN(written, buff, "-1.2e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", -1.125); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.125); ASSERT_STREQ_LEN(written, buff, "-1.1e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", -1.625); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.625); ASSERT_STREQ_LEN(written, buff, "-1.6e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", -1.375); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.375); ASSERT_STREQ_LEN(written, buff, "-1.3e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", -1.875); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.875); ASSERT_STREQ_LEN(written, buff, "-1.8e+00"); } if (ForceRoundingMode r(RoundingMode::Downward); r.success) { - written = __llvm_libc::sprintf(buff, "%.1e", 1.75); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.75); ASSERT_STREQ_LEN(written, buff, "1.7e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", 1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.25); ASSERT_STREQ_LEN(written, buff, "1.2e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", 1.125); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.125); ASSERT_STREQ_LEN(written, buff, "1.1e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", 1.625); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.625); ASSERT_STREQ_LEN(written, buff, "1.6e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", 1.375); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.375); ASSERT_STREQ_LEN(written, buff, "1.3e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", 1.875); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.875); ASSERT_STREQ_LEN(written, buff, "1.8e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", -1.75); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.75); ASSERT_STREQ_LEN(written, buff, "-1.8e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", -1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.25); ASSERT_STREQ_LEN(written, buff, "-1.3e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", -1.125); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.125); ASSERT_STREQ_LEN(written, buff, "-1.2e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", -1.625); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.625); ASSERT_STREQ_LEN(written, buff, "-1.7e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", -1.375); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.375); ASSERT_STREQ_LEN(written, buff, "-1.4e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", -1.875); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.875); ASSERT_STREQ_LEN(written, buff, "-1.9e+00"); } if (ForceRoundingMode r(RoundingMode::TowardZero); r.success) { - written = __llvm_libc::sprintf(buff, "%.1e", 1.75); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.75); ASSERT_STREQ_LEN(written, buff, "1.7e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", 1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.25); ASSERT_STREQ_LEN(written, buff, "1.2e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", 1.125); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.125); ASSERT_STREQ_LEN(written, buff, "1.1e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", 1.625); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.625); ASSERT_STREQ_LEN(written, buff, "1.6e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", 1.375); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.375); ASSERT_STREQ_LEN(written, buff, "1.3e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", 1.875); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", 1.875); ASSERT_STREQ_LEN(written, buff, "1.8e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", -1.75); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.75); ASSERT_STREQ_LEN(written, buff, "-1.7e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", -1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.25); ASSERT_STREQ_LEN(written, buff, "-1.2e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", -1.125); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.125); ASSERT_STREQ_LEN(written, buff, "-1.1e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", -1.625); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.625); ASSERT_STREQ_LEN(written, buff, "-1.6e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", -1.375); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.375); ASSERT_STREQ_LEN(written, buff, "-1.3e+00"); - written = __llvm_libc::sprintf(buff, "%.1e", -1.875); + written = LIBC_NAMESPACE::sprintf(buff, "%.1e", -1.875); ASSERT_STREQ_LEN(written, buff, "-1.8e+00"); } // Flag Tests. - written = __llvm_libc::sprintf(buff, "%+e", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%+e", 1.0); ASSERT_STREQ_LEN(written, buff, "+1.000000e+00"); - written = __llvm_libc::sprintf(buff, "%+e", -1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%+e", -1.0); ASSERT_STREQ_LEN(written, buff, "-1.000000e+00"); - written = __llvm_libc::sprintf(buff, "% e", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "% e", 1.0); ASSERT_STREQ_LEN(written, buff, " 1.000000e+00"); - written = __llvm_libc::sprintf(buff, "% e", -1.0); + written = LIBC_NAMESPACE::sprintf(buff, "% e", -1.0); ASSERT_STREQ_LEN(written, buff, "-1.000000e+00"); - written = __llvm_libc::sprintf(buff, "%-15e", 1.5); + written = LIBC_NAMESPACE::sprintf(buff, "%-15e", 1.5); ASSERT_STREQ_LEN(written, buff, "1.500000e+00 "); - written = __llvm_libc::sprintf(buff, "%#.e", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%#.e", 1.0); ASSERT_STREQ_LEN(written, buff, "1.e+00"); - written = __llvm_libc::sprintf(buff, "%#.0e", 1.5); + written = LIBC_NAMESPACE::sprintf(buff, "%#.0e", 1.5); ASSERT_STREQ_LEN(written, buff, "2.e+00"); - written = __llvm_libc::sprintf(buff, "%015e", 1.5); + written = LIBC_NAMESPACE::sprintf(buff, "%015e", 1.5); ASSERT_STREQ_LEN(written, buff, "0001.500000e+00"); - written = __llvm_libc::sprintf(buff, "%015e", -1.5); + written = LIBC_NAMESPACE::sprintf(buff, "%015e", -1.5); ASSERT_STREQ_LEN(written, buff, "-001.500000e+00"); - written = __llvm_libc::sprintf(buff, "%+- #0e", 0.0); + written = LIBC_NAMESPACE::sprintf(buff, "%+- #0e", 0.0); ASSERT_STREQ_LEN(written, buff, "+0.000000e+00"); // Combined Tests. - written = __llvm_libc::sprintf(buff, "%10.2e", 9.99); + written = LIBC_NAMESPACE::sprintf(buff, "%10.2e", 9.99); ASSERT_STREQ_LEN(written, buff, " 9.99e+00"); - written = __llvm_libc::sprintf(buff, "%10.1e", 9.99); + written = LIBC_NAMESPACE::sprintf(buff, "%10.1e", 9.99); ASSERT_STREQ_LEN(written, buff, " 1.0e+01"); - written = __llvm_libc::sprintf(buff, "%10.0e", 9.99); + written = LIBC_NAMESPACE::sprintf(buff, "%10.0e", 9.99); ASSERT_STREQ_LEN(written, buff, " 1e+01"); - written = __llvm_libc::sprintf(buff, "%10.0e", 0.0999); + written = LIBC_NAMESPACE::sprintf(buff, "%10.0e", 0.0999); ASSERT_STREQ_LEN(written, buff, " 1e-01"); - written = __llvm_libc::sprintf(buff, "%-10.2e", 9.99); + written = LIBC_NAMESPACE::sprintf(buff, "%-10.2e", 9.99); ASSERT_STREQ_LEN(written, buff, "9.99e+00 "); - written = __llvm_libc::sprintf(buff, "%-10.1e", 9.99); + written = LIBC_NAMESPACE::sprintf(buff, "%-10.1e", 9.99); ASSERT_STREQ_LEN(written, buff, "1.0e+01 "); - written = __llvm_libc::sprintf(buff, "%-10.1e", 1.0e-50); + written = LIBC_NAMESPACE::sprintf(buff, "%-10.1e", 1.0e-50); ASSERT_STREQ_LEN(written, buff, "1.0e-50 "); - written = __llvm_libc::sprintf(buff, "%30e", 1234567890123456789.0); + written = LIBC_NAMESPACE::sprintf(buff, "%30e", 1234567890123456789.0); ASSERT_STREQ_LEN(written, buff, " 1.234568e+18"); - written = __llvm_libc::sprintf(buff, "%-30e", 1234567890123456789.0); + written = LIBC_NAMESPACE::sprintf(buff, "%-30e", 1234567890123456789.0); ASSERT_STREQ_LEN(written, buff, "1.234568e+18 "); - written = __llvm_libc::sprintf(buff, "%25.14e", 9999999999999.99); + written = LIBC_NAMESPACE::sprintf(buff, "%25.14e", 9999999999999.99); ASSERT_STREQ_LEN(written, buff, " 9.99999999999999e+12"); - written = __llvm_libc::sprintf(buff, "%25.13e", 9999999999999.99); + written = LIBC_NAMESPACE::sprintf(buff, "%25.13e", 9999999999999.99); ASSERT_STREQ_LEN(written, buff, " 1.0000000000000e+13"); - written = __llvm_libc::sprintf(buff, "%25.12e", 9999999999999.99); + written = LIBC_NAMESPACE::sprintf(buff, "%25.12e", 9999999999999.99); ASSERT_STREQ_LEN(written, buff, " 1.000000000000e+13"); - written = __llvm_libc::sprintf(buff, "%12.3e %-12.3e", 0.1, 256.0); + written = LIBC_NAMESPACE::sprintf(buff, "%12.3e %-12.3e", 0.1, 256.0); ASSERT_STREQ_LEN(written, buff, " 1.000e-01 2.560e+02 "); - written = __llvm_libc::sprintf(buff, "%+-#12.3e % 012.3e", 0.1256, 1256.0); + written = LIBC_NAMESPACE::sprintf(buff, "%+-#12.3e % 012.3e", 0.1256, 1256.0); ASSERT_STREQ_LEN(written, buff, "+1.256e-01 001.256e+03"); } TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) { ForceRoundingMode r(RoundingMode::Nearest); - double inf = __llvm_libc::fputil::FPBits::inf().get_val(); - double nan = __llvm_libc::fputil::FPBits::build_nan(1); + double inf = LIBC_NAMESPACE::fputil::FPBits::inf().get_val(); + double nan = LIBC_NAMESPACE::fputil::FPBits::build_nan(1); - written = __llvm_libc::sprintf(buff, "%g", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%g", 1.0); ASSERT_STREQ_LEN(written, buff, "1"); - written = __llvm_libc::sprintf(buff, "%G", -1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%G", -1.0); ASSERT_STREQ_LEN(written, buff, "-1"); - written = __llvm_libc::sprintf(buff, "%g", -1.234567); + written = LIBC_NAMESPACE::sprintf(buff, "%g", -1.234567); ASSERT_STREQ_LEN(written, buff, "-1.23457"); - written = __llvm_libc::sprintf(buff, "%g", 0.0); + written = LIBC_NAMESPACE::sprintf(buff, "%g", 0.0); ASSERT_STREQ_LEN(written, buff, "0"); - written = __llvm_libc::sprintf(buff, "%g", -0.0); + written = LIBC_NAMESPACE::sprintf(buff, "%g", -0.0); ASSERT_STREQ_LEN(written, buff, "-0"); - written = __llvm_libc::sprintf(buff, "%g", 1.5); + written = LIBC_NAMESPACE::sprintf(buff, "%g", 1.5); ASSERT_STREQ_LEN(written, buff, "1.5"); - written = __llvm_libc::sprintf(buff, "%g", 1e300); + written = LIBC_NAMESPACE::sprintf(buff, "%g", 1e300); ASSERT_STREQ_LEN(written, buff, "1e+300"); - written = __llvm_libc::sprintf(buff, "%g", 0.1); + written = LIBC_NAMESPACE::sprintf(buff, "%g", 0.1); ASSERT_STREQ_LEN(written, buff, "0.1"); - written = __llvm_libc::sprintf(buff, "%g", 0.001); + written = LIBC_NAMESPACE::sprintf(buff, "%g", 0.001); ASSERT_STREQ_LEN(written, buff, "0.001"); - written = __llvm_libc::sprintf(buff, "%g", 0.00001); + written = LIBC_NAMESPACE::sprintf(buff, "%g", 0.00001); ASSERT_STREQ_LEN(written, buff, "1e-05"); - written = __llvm_libc::sprintf(buff, "%g", 0.0000001); + written = LIBC_NAMESPACE::sprintf(buff, "%g", 0.0000001); ASSERT_STREQ_LEN(written, buff, "1e-07"); - written = __llvm_libc::sprintf(buff, "%g", 0.000000001); + written = LIBC_NAMESPACE::sprintf(buff, "%g", 0.000000001); ASSERT_STREQ_LEN(written, buff, "1e-09"); - written = __llvm_libc::sprintf(buff, "%g", 1.0e-20); + written = LIBC_NAMESPACE::sprintf(buff, "%g", 1.0e-20); ASSERT_STREQ_LEN(written, buff, "1e-20"); - written = __llvm_libc::sprintf(buff, "%g", 1234567890123456789.0); + written = LIBC_NAMESPACE::sprintf(buff, "%g", 1234567890123456789.0); ASSERT_STREQ_LEN(written, buff, "1.23457e+18"); - written = __llvm_libc::sprintf(buff, "%g", 9999990000000.00); + written = LIBC_NAMESPACE::sprintf(buff, "%g", 9999990000000.00); ASSERT_STREQ_LEN(written, buff, "9.99999e+12"); - written = __llvm_libc::sprintf(buff, "%g", 9999999000000.00); + written = LIBC_NAMESPACE::sprintf(buff, "%g", 9999999000000.00); ASSERT_STREQ_LEN(written, buff, "1e+13"); // Simple Subnormal Tests. - written = __llvm_libc::sprintf(buff, "%g", 0x1.0p-1027); + written = LIBC_NAMESPACE::sprintf(buff, "%g", 0x1.0p-1027); ASSERT_STREQ_LEN(written, buff, "6.95336e-310"); - written = __llvm_libc::sprintf(buff, "%g", 0x1.0p-1074); + written = LIBC_NAMESPACE::sprintf(buff, "%g", 0x1.0p-1074); ASSERT_STREQ_LEN(written, buff, "4.94066e-324"); // Inf/Nan Tests. - written = __llvm_libc::sprintf(buff, "%g", inf); + written = LIBC_NAMESPACE::sprintf(buff, "%g", inf); ASSERT_STREQ_LEN(written, buff, "inf"); - written = __llvm_libc::sprintf(buff, "%G", -inf); + written = LIBC_NAMESPACE::sprintf(buff, "%G", -inf); ASSERT_STREQ_LEN(written, buff, "-INF"); - written = __llvm_libc::sprintf(buff, "%g", nan); + written = LIBC_NAMESPACE::sprintf(buff, "%g", nan); ASSERT_STREQ_LEN(written, buff, "nan"); - written = __llvm_libc::sprintf(buff, "%G", -nan); + written = LIBC_NAMESPACE::sprintf(buff, "%G", -nan); ASSERT_STREQ_LEN(written, buff, "-NAN"); // Length Modifier Tests. - written = __llvm_libc::sprintf(buff, "%Lg", 0xf.fffffffffffffffp+16380L); + written = LIBC_NAMESPACE::sprintf(buff, "%Lg", 0xf.fffffffffffffffp+16380L); ASSERT_STREQ_LEN(written, buff, "1.18973e+4932"); // TODO: Uncomment the below tests after long double support is added /* - written = __llvm_libc::sprintf(buff, "%Lf", 1e100L); + written = LIBC_NAMESPACE::sprintf(buff, "%Lf", 1e100L); ASSERT_STREQ_LEN(written, buff, "99999999999999999996693535322073426194986990198284960792713" "91541752018669482644324418977840117055488.000000"); - written = __llvm_libc::sprintf(buff, "%Lf", 1.0L); + written = LIBC_NAMESPACE::sprintf(buff, "%Lf", 1.0L); ASSERT_STREQ_LEN(written, buff, "1.000000"); char big_buff[10000]; - written = __llvm_libc::sprintf(big_buff, "%Lf", 1e1000L); + written = LIBC_NAMESPACE::sprintf(big_buff, "%Lf", 1e1000L); ASSERT_STREQ_LEN( written, big_buff, "999999999999999999973107317669562353428234857594552594925899449376328728" @@ -2487,7 +2490,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) { "2431457550909271560663602154947063707982236377366647567795879936." "000000"); - written = __llvm_libc::sprintf(big_buff, "%Lf", 1e4900L); + written = LIBC_NAMESPACE::sprintf(big_buff, "%Lf", 1e4900L); ASSERT_STREQ_LEN( written, big_buff, "100000000000000000002708312230690349833224052504078834346502930111959028" @@ -2561,7 +2564,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) { "24896.000000"); */ /* - written = __llvm_libc::sprintf(buff, "%La", 0.1L); + written = LIBC_NAMESPACE::sprintf(buff, "%La", 0.1L); #if defined(SPECIAL_X86_LONG_DOUBLE) ASSERT_STREQ_LEN(written, buff, "0xc.ccccccccccccccdp-7"); #elif defined(LONG_DOUBLE_IS_DOUBLE) @@ -2570,7 +2573,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) { ASSERT_STREQ_LEN(written, buff, "0x1.999999999999999999999999999ap-4"); #endif - written = __llvm_libc::sprintf(buff, "%La", 1.0e1000L); + written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e1000L); #if defined(SPECIAL_X86_LONG_DOUBLE) ASSERT_STREQ_LEN(written, buff, "0xf.38db1f9dd3dac05p+3318"); #elif defined(LONG_DOUBLE_IS_DOUBLE) @@ -2579,7 +2582,7 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) { ASSERT_STREQ_LEN(written, buff, "0x1.e71b63f3ba7b580af1a52d2a7379p+3321"); #endif - written = __llvm_libc::sprintf(buff, "%La", 1.0e-1000L); + written = LIBC_NAMESPACE::sprintf(buff, "%La", 1.0e-1000L); #if defined(SPECIAL_X86_LONG_DOUBLE) ASSERT_STREQ_LEN(written, buff, "0x8.68a9188a89e1467p-3325"); #elif defined(LONG_DOUBLE_IS_DOUBLE) @@ -2591,98 +2594,98 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) { // Min Width Tests. - written = __llvm_libc::sprintf(buff, "%15g", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%15g", 1.0); ASSERT_STREQ_LEN(written, buff, " 1"); - written = __llvm_libc::sprintf(buff, "%15g", -1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%15g", -1.0); ASSERT_STREQ_LEN(written, buff, " -1"); - written = __llvm_libc::sprintf(buff, "%15g", 1.0e5); + written = LIBC_NAMESPACE::sprintf(buff, "%15g", 1.0e5); ASSERT_STREQ_LEN(written, buff, " 100000"); - written = __llvm_libc::sprintf(buff, "%15g", -1.0e5); + written = LIBC_NAMESPACE::sprintf(buff, "%15g", -1.0e5); ASSERT_STREQ_LEN(written, buff, " -100000"); - written = __llvm_libc::sprintf(buff, "%10g", 1.0e-5); + written = LIBC_NAMESPACE::sprintf(buff, "%10g", 1.0e-5); ASSERT_STREQ_LEN(written, buff, " 1e-05"); // Precision Tests. - written = __llvm_libc::sprintf(buff, "%.2g", 1.23456789); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.23456789); ASSERT_STREQ_LEN(written, buff, "1.2"); // Trimming trailing zeroes causes the precision to be ignored here. - written = __llvm_libc::sprintf(buff, "%.1g", 0.0); + written = LIBC_NAMESPACE::sprintf(buff, "%.1g", 0.0); ASSERT_STREQ_LEN(written, buff, "0"); - written = __llvm_libc::sprintf(buff, "%.0g", 0.0); + written = LIBC_NAMESPACE::sprintf(buff, "%.0g", 0.0); ASSERT_STREQ_LEN(written, buff, "0"); - written = __llvm_libc::sprintf(buff, "%.2g", 0.1); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 0.1); ASSERT_STREQ_LEN(written, buff, "0.1"); - written = __llvm_libc::sprintf(buff, "%.2g", 1.09); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.09); ASSERT_STREQ_LEN(written, buff, "1.1"); - written = __llvm_libc::sprintf(buff, "%.2g", 1.04); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.04); ASSERT_STREQ_LEN(written, buff, "1"); - written = __llvm_libc::sprintf(buff, "%.2g", 1.19); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.19); ASSERT_STREQ_LEN(written, buff, "1.2"); - written = __llvm_libc::sprintf(buff, "%.2g", 1.99); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.99); ASSERT_STREQ_LEN(written, buff, "2"); - written = __llvm_libc::sprintf(buff, "%.2g", 9.99); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 9.99); ASSERT_STREQ_LEN(written, buff, "10"); - written = __llvm_libc::sprintf(buff, "%.3g", 99.9); + written = LIBC_NAMESPACE::sprintf(buff, "%.3g", 99.9); ASSERT_STREQ_LEN(written, buff, "99.9"); - written = __llvm_libc::sprintf(buff, "%.2g", 99.9); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 99.9); ASSERT_STREQ_LEN(written, buff, "1e+02"); - written = __llvm_libc::sprintf(buff, "%.1g", 99.9); + written = LIBC_NAMESPACE::sprintf(buff, "%.1g", 99.9); ASSERT_STREQ_LEN(written, buff, "1e+02"); - written = __llvm_libc::sprintf(buff, "%.5g", 1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.5g", 1.25); ASSERT_STREQ_LEN(written, buff, "1.25"); - written = __llvm_libc::sprintf(buff, "%.0g", 1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.0g", 1.25); ASSERT_STREQ_LEN(written, buff, "1"); - written = __llvm_libc::sprintf(buff, "%.0g", 1.75); + written = LIBC_NAMESPACE::sprintf(buff, "%.0g", 1.75); ASSERT_STREQ_LEN(written, buff, "2"); - written = __llvm_libc::sprintf(buff, "%.20g", 1.234e-10); + written = LIBC_NAMESPACE::sprintf(buff, "%.20g", 1.234e-10); ASSERT_STREQ_LEN(written, buff, "1.2340000000000000814e-10"); - written = __llvm_libc::sprintf(buff, "%.3g", -9.99); + written = LIBC_NAMESPACE::sprintf(buff, "%.3g", -9.99); ASSERT_STREQ_LEN(written, buff, "-9.99"); - written = __llvm_libc::sprintf(buff, "%.2g", -9.99); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -9.99); ASSERT_STREQ_LEN(written, buff, "-10"); - written = __llvm_libc::sprintf(buff, "%.1g", -9.99); + written = LIBC_NAMESPACE::sprintf(buff, "%.1g", -9.99); ASSERT_STREQ_LEN(written, buff, "-1e+01"); - written = __llvm_libc::sprintf(buff, "%.5g", 1.008); + written = LIBC_NAMESPACE::sprintf(buff, "%.5g", 1.008); ASSERT_STREQ_LEN(written, buff, "1.008"); - written = __llvm_libc::sprintf(buff, "%.5g", 1.008e3); + written = LIBC_NAMESPACE::sprintf(buff, "%.5g", 1.008e3); ASSERT_STREQ_LEN(written, buff, "1008"); - written = __llvm_libc::sprintf(buff, "%.4g", 9999.0); + written = LIBC_NAMESPACE::sprintf(buff, "%.4g", 9999.0); ASSERT_STREQ_LEN(written, buff, "9999"); - written = __llvm_libc::sprintf(buff, "%.3g", 9999.0); + written = LIBC_NAMESPACE::sprintf(buff, "%.3g", 9999.0); ASSERT_STREQ_LEN(written, buff, "1e+04"); - written = __llvm_libc::sprintf(buff, "%.3g", 1256.0); + written = LIBC_NAMESPACE::sprintf(buff, "%.3g", 1256.0); ASSERT_STREQ_LEN(written, buff, "1.26e+03"); // Found through large scale testing. - written = __llvm_libc::sprintf(buff, "%.15g", 22.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.15g", 22.25); ASSERT_STREQ_LEN(written, buff, "22.25"); // These tests also focus on rounding, but only in how it relates to the base @@ -2693,18 +2696,18 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) { // is %f with an effective precision of P - X + 1 if P > X >= -4, else the // style is %e with effective precision P - 1. Additionally, it attempts to // trim zeros that would be displayed after the decimal point. - written = __llvm_libc::sprintf(buff, "%.1g", 9.059E+200); + written = LIBC_NAMESPACE::sprintf(buff, "%.1g", 9.059E+200); ASSERT_STREQ_LEN(written, buff, "9e+200"); - written = __llvm_libc::sprintf(buff, "%.2g", 9.059E+200); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 9.059E+200); ASSERT_STREQ_LEN(written, buff, "9.1e+200"); // For this test, P = 0 and X = 1, so P > X >= -4 is false, giving a %e style. - written = __llvm_libc::sprintf(buff, "%.0g", 9.5); + written = LIBC_NAMESPACE::sprintf(buff, "%.0g", 9.5); ASSERT_STREQ_LEN(written, buff, "1e+01"); // Subnormal Precision Tests - written = __llvm_libc::sprintf(buff, "%.310g", 0x1.0p-1022); + written = LIBC_NAMESPACE::sprintf(buff, "%.310g", 0x1.0p-1022); ASSERT_STREQ_LEN( written, buff, "2." @@ -2714,10 +2717,10 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) { "375250806650616658158948720491179968591639648500635908770118304874799780" "887753749949451580452e-308"); - written = __llvm_libc::sprintf(buff, "%.30g", 0x1.0p-1022); + written = LIBC_NAMESPACE::sprintf(buff, "%.30g", 0x1.0p-1022); ASSERT_STREQ_LEN(written, buff, "2.22507385850720138309023271733e-308"); - written = __llvm_libc::sprintf(buff, "%.310g", 0x1.0p-1023); + written = LIBC_NAMESPACE::sprintf(buff, "%.310g", 0x1.0p-1023); ASSERT_STREQ_LEN( written, buff, "1." @@ -2727,38 +2730,38 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) { "187625403325308329079474360245589984295819824250317954385059152437399890" "443876874974725790226e-308"); - written = __llvm_libc::sprintf(buff, "%.7g", 9.99999e-310); + written = LIBC_NAMESPACE::sprintf(buff, "%.7g", 9.99999e-310); ASSERT_STREQ_LEN(written, buff, "9.99999e-310"); - written = __llvm_libc::sprintf(buff, "%.6g", 9.99999e-310); + written = LIBC_NAMESPACE::sprintf(buff, "%.6g", 9.99999e-310); ASSERT_STREQ_LEN(written, buff, "9.99999e-310"); - written = __llvm_libc::sprintf(buff, "%.5g", 9.99999e-310); + written = LIBC_NAMESPACE::sprintf(buff, "%.5g", 9.99999e-310); ASSERT_STREQ_LEN(written, buff, "1e-309"); - written = __llvm_libc::sprintf(buff, "%.4g", 9.99999e-310); + written = LIBC_NAMESPACE::sprintf(buff, "%.4g", 9.99999e-310); ASSERT_STREQ_LEN(written, buff, "1e-309"); - written = __llvm_libc::sprintf(buff, "%.3g", 9.99999e-310); + written = LIBC_NAMESPACE::sprintf(buff, "%.3g", 9.99999e-310); ASSERT_STREQ_LEN(written, buff, "1e-309"); - written = __llvm_libc::sprintf(buff, "%.2g", 9.99999e-310); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 9.99999e-310); ASSERT_STREQ_LEN(written, buff, "1e-309"); - written = __llvm_libc::sprintf(buff, "%.1g", 9.99999e-310); + written = LIBC_NAMESPACE::sprintf(buff, "%.1g", 9.99999e-310); ASSERT_STREQ_LEN(written, buff, "1e-309"); - written = __llvm_libc::sprintf(buff, "%.0g", 9.99999e-310); + written = LIBC_NAMESPACE::sprintf(buff, "%.0g", 9.99999e-310); ASSERT_STREQ_LEN(written, buff, "1e-309"); - written = __llvm_libc::sprintf(buff, "%.10g", 0x1.0p-1074); + written = LIBC_NAMESPACE::sprintf(buff, "%.10g", 0x1.0p-1074); ASSERT_STREQ_LEN(written, buff, "4.940656458e-324"); // Long double precision tests. // These are currently commented out because they require long double support // that isn't ready yet. /* - written = __llvm_libc::sprintf(buff, "%.1La", 0.1L); + written = LIBC_NAMESPACE::sprintf(buff, "%.1La", 0.1L); #if defined(SPECIAL_X86_LONG_DOUBLE) ASSERT_STREQ_LEN(written, buff, "0xc.dp-7"); #elif defined(LONG_DOUBLE_IS_DOUBLE) @@ -2767,8 +2770,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) { ASSERT_STREQ_LEN(written, buff, "0x1.ap-4"); #endif - written = __llvm_libc::sprintf(buff, "%.1La", 0xf.fffffffffffffffp16380L); - #if defined(SPECIAL_X86_LONG_DOUBLE) + written = LIBC_NAMESPACE::sprintf(buff, "%.1La", + 0xf.fffffffffffffffp16380L); #if defined(SPECIAL_X86_LONG_DOUBLE) ASSERT_STREQ_LEN(written, buff, "0x1.0p+16384"); #elif defined(LONG_DOUBLE_IS_DOUBLE) ASSERT_STREQ_LEN(written, buff, "inf"); @@ -2780,233 +2783,233 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) { // Rounding Mode Tests. if (ForceRoundingMode r(RoundingMode::Nearest); r.success) { - written = __llvm_libc::sprintf(buff, "%.2g", 1.75); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.75); ASSERT_STREQ_LEN(written, buff, "1.8"); - written = __llvm_libc::sprintf(buff, "%.2g", 1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.25); ASSERT_STREQ_LEN(written, buff, "1.2"); - written = __llvm_libc::sprintf(buff, "%.2g", 1.125); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.125); ASSERT_STREQ_LEN(written, buff, "1.1"); - written = __llvm_libc::sprintf(buff, "%.2g", 1.625); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.625); ASSERT_STREQ_LEN(written, buff, "1.6"); - written = __llvm_libc::sprintf(buff, "%.2g", 1.375); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.375); ASSERT_STREQ_LEN(written, buff, "1.4"); - written = __llvm_libc::sprintf(buff, "%.2g", 1.875); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.875); ASSERT_STREQ_LEN(written, buff, "1.9"); - written = __llvm_libc::sprintf(buff, "%.2g", -1.75); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.75); ASSERT_STREQ_LEN(written, buff, "-1.8"); - written = __llvm_libc::sprintf(buff, "%.2g", -1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.25); ASSERT_STREQ_LEN(written, buff, "-1.2"); - written = __llvm_libc::sprintf(buff, "%.2g", -1.125); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.125); ASSERT_STREQ_LEN(written, buff, "-1.1"); - written = __llvm_libc::sprintf(buff, "%.2g", -1.625); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.625); ASSERT_STREQ_LEN(written, buff, "-1.6"); - written = __llvm_libc::sprintf(buff, "%.2g", -1.375); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.375); ASSERT_STREQ_LEN(written, buff, "-1.4"); - written = __llvm_libc::sprintf(buff, "%.2g", -1.875); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.875); ASSERT_STREQ_LEN(written, buff, "-1.9"); } if (ForceRoundingMode r(RoundingMode::Upward); r.success) { - written = __llvm_libc::sprintf(buff, "%.2g", 1.75); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.75); ASSERT_STREQ_LEN(written, buff, "1.8"); - written = __llvm_libc::sprintf(buff, "%.2g", 1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.25); ASSERT_STREQ_LEN(written, buff, "1.3"); - written = __llvm_libc::sprintf(buff, "%.2g", 1.125); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.125); ASSERT_STREQ_LEN(written, buff, "1.2"); - written = __llvm_libc::sprintf(buff, "%.2g", 1.625); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.625); ASSERT_STREQ_LEN(written, buff, "1.7"); - written = __llvm_libc::sprintf(buff, "%.2g", 1.375); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.375); ASSERT_STREQ_LEN(written, buff, "1.4"); - written = __llvm_libc::sprintf(buff, "%.2g", 1.875); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.875); ASSERT_STREQ_LEN(written, buff, "1.9"); - written = __llvm_libc::sprintf(buff, "%.2g", -1.75); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.75); ASSERT_STREQ_LEN(written, buff, "-1.7"); - written = __llvm_libc::sprintf(buff, "%.2g", -1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.25); ASSERT_STREQ_LEN(written, buff, "-1.2"); - written = __llvm_libc::sprintf(buff, "%.2g", -1.125); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.125); ASSERT_STREQ_LEN(written, buff, "-1.1"); - written = __llvm_libc::sprintf(buff, "%.2g", -1.625); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.625); ASSERT_STREQ_LEN(written, buff, "-1.6"); - written = __llvm_libc::sprintf(buff, "%.2g", -1.375); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.375); ASSERT_STREQ_LEN(written, buff, "-1.3"); - written = __llvm_libc::sprintf(buff, "%.2g", -1.875); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.875); ASSERT_STREQ_LEN(written, buff, "-1.8"); } if (ForceRoundingMode r(RoundingMode::Downward); r.success) { - written = __llvm_libc::sprintf(buff, "%.2g", 1.75); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.75); ASSERT_STREQ_LEN(written, buff, "1.7"); - written = __llvm_libc::sprintf(buff, "%.2g", 1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.25); ASSERT_STREQ_LEN(written, buff, "1.2"); - written = __llvm_libc::sprintf(buff, "%.2g", 1.125); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.125); ASSERT_STREQ_LEN(written, buff, "1.1"); - written = __llvm_libc::sprintf(buff, "%.2g", 1.625); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.625); ASSERT_STREQ_LEN(written, buff, "1.6"); - written = __llvm_libc::sprintf(buff, "%.2g", 1.375); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.375); ASSERT_STREQ_LEN(written, buff, "1.3"); - written = __llvm_libc::sprintf(buff, "%.2g", 1.875); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.875); ASSERT_STREQ_LEN(written, buff, "1.8"); - written = __llvm_libc::sprintf(buff, "%.2g", -1.75); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.75); ASSERT_STREQ_LEN(written, buff, "-1.8"); - written = __llvm_libc::sprintf(buff, "%.2g", -1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.25); ASSERT_STREQ_LEN(written, buff, "-1.3"); - written = __llvm_libc::sprintf(buff, "%.2g", -1.125); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.125); ASSERT_STREQ_LEN(written, buff, "-1.2"); - written = __llvm_libc::sprintf(buff, "%.2g", -1.625); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.625); ASSERT_STREQ_LEN(written, buff, "-1.7"); - written = __llvm_libc::sprintf(buff, "%.2g", -1.375); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.375); ASSERT_STREQ_LEN(written, buff, "-1.4"); - written = __llvm_libc::sprintf(buff, "%.2g", -1.875); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.875); ASSERT_STREQ_LEN(written, buff, "-1.9"); } if (ForceRoundingMode r(RoundingMode::TowardZero); r.success) { - written = __llvm_libc::sprintf(buff, "%.2g", 1.75); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.75); ASSERT_STREQ_LEN(written, buff, "1.7"); - written = __llvm_libc::sprintf(buff, "%.2g", 1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.25); ASSERT_STREQ_LEN(written, buff, "1.2"); - written = __llvm_libc::sprintf(buff, "%.2g", 1.125); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.125); ASSERT_STREQ_LEN(written, buff, "1.1"); - written = __llvm_libc::sprintf(buff, "%.2g", 1.625); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.625); ASSERT_STREQ_LEN(written, buff, "1.6"); - written = __llvm_libc::sprintf(buff, "%.2g", 1.375); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.375); ASSERT_STREQ_LEN(written, buff, "1.3"); - written = __llvm_libc::sprintf(buff, "%.2g", 1.875); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", 1.875); ASSERT_STREQ_LEN(written, buff, "1.8"); - written = __llvm_libc::sprintf(buff, "%.2g", -1.75); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.75); ASSERT_STREQ_LEN(written, buff, "-1.7"); - written = __llvm_libc::sprintf(buff, "%.2g", -1.25); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.25); ASSERT_STREQ_LEN(written, buff, "-1.2"); - written = __llvm_libc::sprintf(buff, "%.2g", -1.125); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.125); ASSERT_STREQ_LEN(written, buff, "-1.1"); - written = __llvm_libc::sprintf(buff, "%.2g", -1.625); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.625); ASSERT_STREQ_LEN(written, buff, "-1.6"); - written = __llvm_libc::sprintf(buff, "%.2g", -1.375); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.375); ASSERT_STREQ_LEN(written, buff, "-1.3"); - written = __llvm_libc::sprintf(buff, "%.2g", -1.875); + written = LIBC_NAMESPACE::sprintf(buff, "%.2g", -1.875); ASSERT_STREQ_LEN(written, buff, "-1.8"); } // Flag Tests. - written = __llvm_libc::sprintf(buff, "%+g", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%+g", 1.0); ASSERT_STREQ_LEN(written, buff, "+1"); - written = __llvm_libc::sprintf(buff, "%+g", -1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%+g", -1.0); ASSERT_STREQ_LEN(written, buff, "-1"); - written = __llvm_libc::sprintf(buff, "% g", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "% g", 1.0); ASSERT_STREQ_LEN(written, buff, " 1"); - written = __llvm_libc::sprintf(buff, "% g", -1.0); + written = LIBC_NAMESPACE::sprintf(buff, "% g", -1.0); ASSERT_STREQ_LEN(written, buff, "-1"); - written = __llvm_libc::sprintf(buff, "%-15g", 1.5); + written = LIBC_NAMESPACE::sprintf(buff, "%-15g", 1.5); ASSERT_STREQ_LEN(written, buff, "1.5 "); - written = __llvm_libc::sprintf(buff, "%#.g", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%#.g", 1.0); ASSERT_STREQ_LEN(written, buff, "1."); - written = __llvm_libc::sprintf(buff, "%#g", 1.0); + written = LIBC_NAMESPACE::sprintf(buff, "%#g", 1.0); ASSERT_STREQ_LEN(written, buff, "1.00000"); - written = __llvm_libc::sprintf(buff, "%#.0g", 1.5); + written = LIBC_NAMESPACE::sprintf(buff, "%#.0g", 1.5); ASSERT_STREQ_LEN(written, buff, "2."); - written = __llvm_libc::sprintf(buff, "%015g", 1.5); + written = LIBC_NAMESPACE::sprintf(buff, "%015g", 1.5); ASSERT_STREQ_LEN(written, buff, "0000000000001.5"); - written = __llvm_libc::sprintf(buff, "%015g", -1.5); + written = LIBC_NAMESPACE::sprintf(buff, "%015g", -1.5); ASSERT_STREQ_LEN(written, buff, "-000000000001.5"); - written = __llvm_libc::sprintf(buff, "%+- #0g", 0.0); + written = LIBC_NAMESPACE::sprintf(buff, "%+- #0g", 0.0); ASSERT_STREQ_LEN(written, buff, "+0.00000"); // Combined Tests. - written = __llvm_libc::sprintf(buff, "%10.3g", 9.99); + written = LIBC_NAMESPACE::sprintf(buff, "%10.3g", 9.99); ASSERT_STREQ_LEN(written, buff, " 9.99"); - written = __llvm_libc::sprintf(buff, "%10.2g", 9.99); + written = LIBC_NAMESPACE::sprintf(buff, "%10.2g", 9.99); ASSERT_STREQ_LEN(written, buff, " 10"); - written = __llvm_libc::sprintf(buff, "%10.1g", 9.99); + written = LIBC_NAMESPACE::sprintf(buff, "%10.1g", 9.99); ASSERT_STREQ_LEN(written, buff, " 1e+01"); - written = __llvm_libc::sprintf(buff, "%-10.3g", 9.99); + written = LIBC_NAMESPACE::sprintf(buff, "%-10.3g", 9.99); ASSERT_STREQ_LEN(written, buff, "9.99 "); - written = __llvm_libc::sprintf(buff, "%-10.2g", 9.99); + written = LIBC_NAMESPACE::sprintf(buff, "%-10.2g", 9.99); ASSERT_STREQ_LEN(written, buff, "10 "); - written = __llvm_libc::sprintf(buff, "%-10.1g", 9.99); + written = LIBC_NAMESPACE::sprintf(buff, "%-10.1g", 9.99); ASSERT_STREQ_LEN(written, buff, "1e+01 "); - written = __llvm_libc::sprintf(buff, "%-10.1g", 1.0e-50); + written = LIBC_NAMESPACE::sprintf(buff, "%-10.1g", 1.0e-50); ASSERT_STREQ_LEN(written, buff, "1e-50 "); - written = __llvm_libc::sprintf(buff, "%30g", 1234567890123456789.0); + written = LIBC_NAMESPACE::sprintf(buff, "%30g", 1234567890123456789.0); ASSERT_STREQ_LEN(written, buff, " 1.23457e+18"); - written = __llvm_libc::sprintf(buff, "%-30g", 1234567890123456789.0); + written = LIBC_NAMESPACE::sprintf(buff, "%-30g", 1234567890123456789.0); ASSERT_STREQ_LEN(written, buff, "1.23457e+18 "); - written = __llvm_libc::sprintf(buff, "%25.15g", 9999999999999.99); + written = LIBC_NAMESPACE::sprintf(buff, "%25.15g", 9999999999999.99); ASSERT_STREQ_LEN(written, buff, " 9999999999999.99"); - written = __llvm_libc::sprintf(buff, "%25.14g", 9999999999999.99); + written = LIBC_NAMESPACE::sprintf(buff, "%25.14g", 9999999999999.99); ASSERT_STREQ_LEN(written, buff, " 10000000000000"); - written = __llvm_libc::sprintf(buff, "%25.13g", 9999999999999.99); + written = LIBC_NAMESPACE::sprintf(buff, "%25.13g", 9999999999999.99); ASSERT_STREQ_LEN(written, buff, " 1e+13"); - written = __llvm_libc::sprintf(buff, "%#12.3g %-12.3g", 0.1, 256.0); + written = LIBC_NAMESPACE::sprintf(buff, "%#12.3g %-12.3g", 0.1, 256.0); ASSERT_STREQ_LEN(written, buff, " 0.100 256 "); - written = __llvm_libc::sprintf(buff, "%+-#12.3g % 012.3g", 0.1256, 1256.0); + written = LIBC_NAMESPACE::sprintf(buff, "%+-#12.3g % 012.3g", 0.1256, 1256.0); ASSERT_STREQ_LEN(written, buff, "+0.126 0001.26e+03"); } @@ -3019,31 +3022,31 @@ TEST(LlvmLibcSPrintfTest, WriteIntConv) { int test_val = -1; test_val = -1; - written = __llvm_libc::sprintf(buff, "12345%n67890", &test_val); + written = LIBC_NAMESPACE::sprintf(buff, "12345%n67890", &test_val); EXPECT_EQ(written, 10); EXPECT_EQ(test_val, 5); ASSERT_STREQ(buff, "1234567890"); test_val = -1; - written = __llvm_libc::sprintf(buff, "%n", &test_val); + written = LIBC_NAMESPACE::sprintf(buff, "%n", &test_val); EXPECT_EQ(written, 0); EXPECT_EQ(test_val, 0); ASSERT_STREQ(buff, ""); test_val = 0x100; - written = __llvm_libc::sprintf(buff, "ABC%hhnDEF", &test_val); + written = LIBC_NAMESPACE::sprintf(buff, "ABC%hhnDEF", &test_val); EXPECT_EQ(written, 6); EXPECT_EQ(test_val, 0x103); ASSERT_STREQ(buff, "ABCDEF"); test_val = -1; - written = __llvm_libc::sprintf(buff, "%s%n", "87654321", &test_val); + written = LIBC_NAMESPACE::sprintf(buff, "%s%n", "87654321", &test_val); EXPECT_EQ(written, 8); EXPECT_EQ(test_val, 8); ASSERT_STREQ(buff, "87654321"); #ifndef LIBC_COPT_PRINTF_NO_NULLPTR_CHECKS - written = __llvm_libc::sprintf(buff, "abc123%n", nullptr); + written = LIBC_NAMESPACE::sprintf(buff, "abc123%n", nullptr); EXPECT_LT(written, 0); #endif // LIBC_COPT_PRINTF_NO_NULLPTR_CHECKS } @@ -3054,20 +3057,20 @@ TEST(LlvmLibcSPrintfTest, IndexModeParsing) { char buff[64]; int written; - written = __llvm_libc::sprintf(buff, "%1$s", "abcDEF123"); + written = LIBC_NAMESPACE::sprintf(buff, "%1$s", "abcDEF123"); EXPECT_EQ(written, 9); ASSERT_STREQ(buff, "abcDEF123"); - written = __llvm_libc::sprintf(buff, "%1$s %%", "abcDEF123"); + written = LIBC_NAMESPACE::sprintf(buff, "%1$s %%", "abcDEF123"); EXPECT_EQ(written, 11); ASSERT_STREQ(buff, "abcDEF123 %"); written = - __llvm_libc::sprintf(buff, "%3$s %1$s %2$s", "is", "hard", "ordering"); + LIBC_NAMESPACE::sprintf(buff, "%3$s %1$s %2$s", "is", "hard", "ordering"); EXPECT_EQ(written, 16); ASSERT_STREQ(buff, "ordering is hard"); - written = __llvm_libc::sprintf( + written = LIBC_NAMESPACE::sprintf( buff, "%10$s %9$s %8$c %7$s %6$s, %6$s %5$s %4$-*1$s %3$.*11$s %2$s. %%", 6, "pain", "alphabetical", "such", "is", "this", "do", 'u', "would", "why", 1); diff --git a/libc/test/src/stdio/sscanf_test.cpp b/libc/test/src/stdio/sscanf_test.cpp index b6535dfde076cd4d72c43b538d937378120cf7fa..8e0ad7de4f2ea2f2168d76bc79cd86af598f2b2a 100644 --- a/libc/test/src/stdio/sscanf_test.cpp +++ b/libc/test/src/stdio/sscanf_test.cpp @@ -21,16 +21,16 @@ TEST(LlvmLibcSScanfTest, SimpleStringConv) { int ret_val; char buffer[10]; char buffer2[10]; - ret_val = __llvm_libc::sscanf("abc123", "abc %s", buffer); + ret_val = LIBC_NAMESPACE::sscanf("abc123", "abc %s", buffer); ASSERT_EQ(ret_val, 1); ASSERT_STREQ(buffer, "123"); - ret_val = __llvm_libc::sscanf("abc123", "%3s %3s", buffer, buffer2); + ret_val = LIBC_NAMESPACE::sscanf("abc123", "%3s %3s", buffer, buffer2); ASSERT_EQ(ret_val, 2); ASSERT_STREQ(buffer, "abc"); ASSERT_STREQ(buffer2, "123"); - ret_val = __llvm_libc::sscanf("abc 123", "%3s%3s", buffer, buffer2); + ret_val = LIBC_NAMESPACE::sscanf("abc 123", "%3s%3s", buffer, buffer2); ASSERT_EQ(ret_val, 2); ASSERT_STREQ(buffer, "abc"); ASSERT_STREQ(buffer2, "123"); @@ -39,41 +39,41 @@ TEST(LlvmLibcSScanfTest, SimpleStringConv) { TEST(LlvmLibcSScanfTest, IntConvSimple) { int ret_val; int result = 0; - ret_val = __llvm_libc::sscanf("123", "%d", &result); + ret_val = LIBC_NAMESPACE::sscanf("123", "%d", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 123); - ret_val = __llvm_libc::sscanf("456", "%i", &result); + ret_val = LIBC_NAMESPACE::sscanf("456", "%i", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 456); - ret_val = __llvm_libc::sscanf("789", "%x", &result); + ret_val = LIBC_NAMESPACE::sscanf("789", "%x", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 0x789); - ret_val = __llvm_libc::sscanf("012", "%o", &result); + ret_val = LIBC_NAMESPACE::sscanf("012", "%o", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 012); - ret_val = __llvm_libc::sscanf("345", "%u", &result); + ret_val = LIBC_NAMESPACE::sscanf("345", "%u", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 345); // 288 characters - ret_val = __llvm_libc::sscanf("10000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000", - "%d", &result); - EXPECT_EQ(ret_val, 1); - EXPECT_EQ(result, int(__llvm_libc::cpp::numeric_limits::max())); - - ret_val = __llvm_libc::sscanf("Not an integer", "%d", &result); + ret_val = LIBC_NAMESPACE::sscanf("10000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000", + "%d", &result); + EXPECT_EQ(ret_val, 1); + EXPECT_EQ(result, int(LIBC_NAMESPACE::cpp::numeric_limits::max())); + + ret_val = LIBC_NAMESPACE::sscanf("Not an integer", "%d", &result); EXPECT_EQ(ret_val, 0); } @@ -83,33 +83,33 @@ TEST(LlvmLibcSScanfTest, IntConvLengthModifier) { int int_result = 0; char char_result = 0; - ret_val = __llvm_libc::sscanf("123", "%ju", &max_result); + ret_val = LIBC_NAMESPACE::sscanf("123", "%ju", &max_result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(max_result, uintmax_t(123)); // Check overflow handling - ret_val = __llvm_libc::sscanf("999999999999999999999999999999999999", "%ju", - &max_result); + ret_val = LIBC_NAMESPACE::sscanf("999999999999999999999999999999999999", + "%ju", &max_result); EXPECT_EQ(ret_val, 1); - EXPECT_EQ(max_result, __llvm_libc::cpp::numeric_limits::max()); + EXPECT_EQ(max_result, LIBC_NAMESPACE::cpp::numeric_limits::max()); // Because this is unsigned, any out of range value should return the maximum, // even with a negative sign. - ret_val = __llvm_libc::sscanf("-999999999999999999999999999999999999", "%ju", - &max_result); + ret_val = LIBC_NAMESPACE::sscanf("-999999999999999999999999999999999999", + "%ju", &max_result); EXPECT_EQ(ret_val, 1); - EXPECT_EQ(max_result, __llvm_libc::cpp::numeric_limits::max()); + EXPECT_EQ(max_result, LIBC_NAMESPACE::cpp::numeric_limits::max()); - ret_val = __llvm_libc::sscanf("-18446744073709551616", "%ju", &max_result); + ret_val = LIBC_NAMESPACE::sscanf("-18446744073709551616", "%ju", &max_result); EXPECT_EQ(ret_val, 1); - EXPECT_EQ(max_result, __llvm_libc::cpp::numeric_limits::max()); + EXPECT_EQ(max_result, LIBC_NAMESPACE::cpp::numeric_limits::max()); // But any number below the maximum should have the - sign applied. - ret_val = __llvm_libc::sscanf("-1", "%ju", &max_result); + ret_val = LIBC_NAMESPACE::sscanf("-1", "%ju", &max_result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(max_result, uintmax_t(-1)); - ret_val = __llvm_libc::sscanf("-1", "%u", &int_result); + ret_val = LIBC_NAMESPACE::sscanf("-1", "%u", &int_result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(int_result, -1); @@ -117,7 +117,7 @@ TEST(LlvmLibcSScanfTest, IntConvLengthModifier) { char_result = 0x6f; // Overflows for sizes larger than the maximum are handled by casting. - ret_val = __llvm_libc::sscanf("8589967360", "%d", &int_result); + ret_val = LIBC_NAMESPACE::sscanf("8589967360", "%d", &int_result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(int_result, int(8589967360)); // 2^33 + 2^15 @@ -125,13 +125,13 @@ TEST(LlvmLibcSScanfTest, IntConvLengthModifier) { ASSERT_EQ(max_result, uintmax_t(0xff00ff00ff00ff00)); ASSERT_EQ(char_result, char(0x6f)); - ret_val = __llvm_libc::sscanf("-8589967360", "%d", &int_result); + ret_val = LIBC_NAMESPACE::sscanf("-8589967360", "%d", &int_result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(int_result, int(-8589967360)); ASSERT_EQ(max_result, uintmax_t(0xff00ff00ff00ff00)); ASSERT_EQ(char_result, char(0x6f)); - ret_val = __llvm_libc::sscanf("25", "%hhd", &char_result); + ret_val = LIBC_NAMESPACE::sscanf("25", "%hhd", &char_result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(char_result, char(25)); } @@ -139,19 +139,19 @@ TEST(LlvmLibcSScanfTest, IntConvLengthModifier) { TEST(LlvmLibcSScanfTest, IntConvBaseSelection) { int ret_val; int result = 0; - ret_val = __llvm_libc::sscanf("0xabc123", "%i", &result); + ret_val = LIBC_NAMESPACE::sscanf("0xabc123", "%i", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 0xabc123); - ret_val = __llvm_libc::sscanf("0456", "%i", &result); + ret_val = LIBC_NAMESPACE::sscanf("0456", "%i", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 0456); - ret_val = __llvm_libc::sscanf("0999", "%i", &result); + ret_val = LIBC_NAMESPACE::sscanf("0999", "%i", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 0); - ret_val = __llvm_libc::sscanf("123abc456", "%i", &result); + ret_val = LIBC_NAMESPACE::sscanf("123abc456", "%i", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 123); } @@ -160,43 +160,43 @@ TEST(LlvmLibcSScanfTest, IntConvMaxLengthTests) { int ret_val; int result = 0; - ret_val = __llvm_libc::sscanf("12", "%1d", &result); + ret_val = LIBC_NAMESPACE::sscanf("12", "%1d", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 1); - ret_val = __llvm_libc::sscanf("-1", "%1d", &result); + ret_val = LIBC_NAMESPACE::sscanf("-1", "%1d", &result); EXPECT_EQ(ret_val, 0); EXPECT_EQ(result, 0); - ret_val = __llvm_libc::sscanf("+1", "%1d", &result); + ret_val = LIBC_NAMESPACE::sscanf("+1", "%1d", &result); EXPECT_EQ(ret_val, 0); EXPECT_EQ(result, 0); - ret_val = __llvm_libc::sscanf("01", "%1d", &result); + ret_val = LIBC_NAMESPACE::sscanf("01", "%1d", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 0); - ret_val = __llvm_libc::sscanf("01", "%1i", &result); + ret_val = LIBC_NAMESPACE::sscanf("01", "%1i", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 0); - ret_val = __llvm_libc::sscanf("0x1", "%2i", &result); + ret_val = LIBC_NAMESPACE::sscanf("0x1", "%2i", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 0); - ret_val = __llvm_libc::sscanf("-0x1", "%3i", &result); + ret_val = LIBC_NAMESPACE::sscanf("-0x1", "%3i", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 0); - ret_val = __llvm_libc::sscanf("-0x123", "%4i", &result); + ret_val = LIBC_NAMESPACE::sscanf("-0x123", "%4i", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, -1); - ret_val = __llvm_libc::sscanf("123456789", "%5i", &result); + ret_val = LIBC_NAMESPACE::sscanf("123456789", "%5i", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 12345); - ret_val = __llvm_libc::sscanf("123456789", "%10i", &result); + ret_val = LIBC_NAMESPACE::sscanf("123456789", "%10i", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 123456789); } @@ -206,23 +206,23 @@ TEST(LlvmLibcSScanfTest, IntConvNoWriteTests) { // Result shouldn't be used by these tests, but it's safer to have it and // check it. int result = 0; - ret_val = __llvm_libc::sscanf("-1", "%*1d", &result); + ret_val = LIBC_NAMESPACE::sscanf("-1", "%*1d", &result); EXPECT_EQ(ret_val, 0); EXPECT_EQ(result, 0); - ret_val = __llvm_libc::sscanf("01", "%*1i", &result); + ret_val = LIBC_NAMESPACE::sscanf("01", "%*1i", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 0); - ret_val = __llvm_libc::sscanf("0x1", "%*2i", &result); + ret_val = LIBC_NAMESPACE::sscanf("0x1", "%*2i", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 0); - ret_val = __llvm_libc::sscanf("a", "%*i", &result); + ret_val = LIBC_NAMESPACE::sscanf("a", "%*i", &result); EXPECT_EQ(ret_val, 0); EXPECT_EQ(result, 0); - ret_val = __llvm_libc::sscanf("123", "%*i", &result); + ret_val = LIBC_NAMESPACE::sscanf("123", "%*i", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 0); } @@ -231,62 +231,62 @@ TEST(LlvmLibcSScanfTest, FloatConvSimple) { int ret_val; float result = 0; - float inf = __llvm_libc::fputil::FPBits::inf().get_val(); - float nan = __llvm_libc::fputil::FPBits::build_nan(1); + float inf = LIBC_NAMESPACE::fputil::FPBits::inf().get_val(); + float nan = LIBC_NAMESPACE::fputil::FPBits::build_nan(1); - ret_val = __llvm_libc::sscanf("123", "%f", &result); + ret_val = LIBC_NAMESPACE::sscanf("123", "%f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 123.0); - ret_val = __llvm_libc::sscanf("456.1", "%a", &result); + ret_val = LIBC_NAMESPACE::sscanf("456.1", "%a", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 456.1); - ret_val = __llvm_libc::sscanf("0x789.ap0", "%e", &result); + ret_val = LIBC_NAMESPACE::sscanf("0x789.ap0", "%e", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0x789.ap0); - ret_val = __llvm_libc::sscanf("0x.8", "%e", &result); + ret_val = LIBC_NAMESPACE::sscanf("0x.8", "%e", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0x0.8p0); - ret_val = __llvm_libc::sscanf("0x8.", "%e", &result); + ret_val = LIBC_NAMESPACE::sscanf("0x8.", "%e", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0x8.0p0); - ret_val = __llvm_libc::sscanf("+12.0e1", "%g", &result); + ret_val = LIBC_NAMESPACE::sscanf("+12.0e1", "%g", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 12.0e1); - ret_val = __llvm_libc::sscanf("inf", "%F", &result); + ret_val = LIBC_NAMESPACE::sscanf("inf", "%F", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, inf); - ret_val = __llvm_libc::sscanf("NaN", "%A", &result); + ret_val = LIBC_NAMESPACE::sscanf("NaN", "%A", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, nan); - ret_val = __llvm_libc::sscanf("-InFiNiTy", "%E", &result); + ret_val = LIBC_NAMESPACE::sscanf("-InFiNiTy", "%E", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, -inf); - ret_val = __llvm_libc::sscanf("1e10", "%G", &result); + ret_val = LIBC_NAMESPACE::sscanf("1e10", "%G", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 1e10); - ret_val = __llvm_libc::sscanf(".1", "%G", &result); + ret_val = LIBC_NAMESPACE::sscanf(".1", "%G", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.1); - ret_val = __llvm_libc::sscanf("1.", "%G", &result); + ret_val = LIBC_NAMESPACE::sscanf("1.", "%G", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 1.0); - ret_val = __llvm_libc::sscanf("0", "%f", &result); + ret_val = LIBC_NAMESPACE::sscanf("0", "%f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.0); - ret_val = __llvm_libc::sscanf("Not a float", "%f", &result); + ret_val = LIBC_NAMESPACE::sscanf("Not a float", "%f", &result); EXPECT_EQ(ret_val, 0); } @@ -295,30 +295,31 @@ TEST(LlvmLibcSScanfTest, FloatConvLengthModifier) { double d_result = 0; long double ld_result = 0; - double d_inf = __llvm_libc::fputil::FPBits::inf().get_val(); - long double ld_nan = __llvm_libc::fputil::FPBits::build_nan(1); + double d_inf = LIBC_NAMESPACE::fputil::FPBits::inf().get_val(); + long double ld_nan = + LIBC_NAMESPACE::fputil::FPBits::build_nan(1); - ret_val = __llvm_libc::sscanf("123", "%lf", &d_result); + ret_val = LIBC_NAMESPACE::sscanf("123", "%lf", &d_result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(d_result, 123.0); - ret_val = __llvm_libc::sscanf("456.1", "%La", &ld_result); + ret_val = LIBC_NAMESPACE::sscanf("456.1", "%La", &ld_result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(ld_result, 456.1L); - ret_val = __llvm_libc::sscanf("inf", "%le", &d_result); + ret_val = LIBC_NAMESPACE::sscanf("inf", "%le", &d_result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(d_result, d_inf); - ret_val = __llvm_libc::sscanf("nan", "%Lg", &ld_result); + ret_val = LIBC_NAMESPACE::sscanf("nan", "%Lg", &ld_result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(ld_result, ld_nan); - ret_val = __llvm_libc::sscanf("1e-300", "%lF", &d_result); + ret_val = LIBC_NAMESPACE::sscanf("1e-300", "%lF", &d_result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(d_result, 1e-300); - ret_val = __llvm_libc::sscanf("1.0e600", "%LA", &ld_result); + ret_val = LIBC_NAMESPACE::sscanf("1.0e600", "%LA", &ld_result); EXPECT_EQ(ret_val, 1); // 1e600 may be larger than the maximum long double (if long double is double). // In that case both of these should be evaluated as inf. @@ -336,12 +337,12 @@ TEST(LlvmLibcSScanfTest, FloatConvLongNumber) { // 32 characters ret_val = - __llvm_libc::sscanf("123456789012345678901234567890.0", "%f", &result); + LIBC_NAMESPACE::sscanf("123456789012345678901234567890.0", "%f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 123456789012345678901234567890.0f); // 64 characters - ret_val = __llvm_libc::sscanf( + ret_val = LIBC_NAMESPACE::sscanf( "123456789012345678901234567890123456789012345678901234567890.000", "%la", &d_result); EXPECT_EQ(ret_val, 1); @@ -350,7 +351,7 @@ TEST(LlvmLibcSScanfTest, FloatConvLongNumber) { 123456789012345678901234567890123456789012345678901234567890.000); // 128 characters - ret_val = __llvm_libc::sscanf( + ret_val = LIBC_NAMESPACE::sscanf( "123456789012345678901234567890123456789012345678901234567890" "123456789012345678901234567890123456789012345678901234567890.0000000", "%le", &d_result); @@ -360,29 +361,29 @@ TEST(LlvmLibcSScanfTest, FloatConvLongNumber) { 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890.0000000); // 256 characters - ret_val = __llvm_libc::sscanf("10000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000", - "%lf", &d_result); + ret_val = LIBC_NAMESPACE::sscanf("10000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000", + "%lf", &d_result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(d_result, 1e255); // 288 characters - ret_val = __llvm_libc::sscanf("10000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000", - "%lf", &d_result); + ret_val = LIBC_NAMESPACE::sscanf("10000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000", + "%lf", &d_result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(d_result, 1e287); } @@ -391,48 +392,48 @@ TEST(LlvmLibcSScanfTest, FloatConvComplexParsing) { int ret_val; float result = 0; - float inf = __llvm_libc::fputil::FPBits::inf().get_val(); - float nan = __llvm_libc::fputil::FPBits::build_nan(1); + float inf = LIBC_NAMESPACE::fputil::FPBits::inf().get_val(); + float nan = LIBC_NAMESPACE::fputil::FPBits::build_nan(1); - ret_val = __llvm_libc::sscanf("0x1.0e3", "%f", &result); + ret_val = LIBC_NAMESPACE::sscanf("0x1.0e3", "%f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0x1.0e3p0); - ret_val = __llvm_libc::sscanf("", "%a", &result); + ret_val = LIBC_NAMESPACE::sscanf("", "%a", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("+", "%a", &result); + ret_val = LIBC_NAMESPACE::sscanf("+", "%a", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("-", "%a", &result); + ret_val = LIBC_NAMESPACE::sscanf("-", "%a", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("+.", "%a", &result); + ret_val = LIBC_NAMESPACE::sscanf("+.", "%a", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("-.e+10", "%a", &result); + ret_val = LIBC_NAMESPACE::sscanf("-.e+10", "%a", &result); EXPECT_EQ(ret_val, 0); // This is a specific example from the standard. Its behavior diverges from // other implementations that accept "100e" as being the same as "100e0" - ret_val = __llvm_libc::sscanf("100er", "%a", &result); + ret_val = LIBC_NAMESPACE::sscanf("100er", "%a", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("nah", "%a", &result); + ret_val = LIBC_NAMESPACE::sscanf("nah", "%a", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("indirection", "%a", &result); + ret_val = LIBC_NAMESPACE::sscanf("indirection", "%a", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("infnan", "%a", &result); + ret_val = LIBC_NAMESPACE::sscanf("infnan", "%a", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, inf); - ret_val = __llvm_libc::sscanf("naninf", "%a", &result); + ret_val = LIBC_NAMESPACE::sscanf("naninf", "%a", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, nan); - ret_val = __llvm_libc::sscanf("infinityinfinity", "%a", &result); + ret_val = LIBC_NAMESPACE::sscanf("infinityinfinity", "%a", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, inf); @@ -444,17 +445,17 @@ TEST(LlvmLibcSScanfTest, FloatConvComplexParsing) { // one character so when it finds that the character after the second 'i' is // not the next character in "infinity" it can't rewind to the point where it // had just "inf". - ret_val = __llvm_libc::sscanf("infi", "%a", &result); + ret_val = LIBC_NAMESPACE::sscanf("infi", "%a", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("infinite", "%a", &result); + ret_val = LIBC_NAMESPACE::sscanf("infinite", "%a", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("-.1e1", "%f", &result); + ret_val = LIBC_NAMESPACE::sscanf("-.1e1", "%f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, -.1e1); - ret_val = __llvm_libc::sscanf("1.2.e1", "%f", &result); + ret_val = LIBC_NAMESPACE::sscanf("1.2.e1", "%f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 1.2); } @@ -463,64 +464,64 @@ TEST(LlvmLibcSScanfTest, FloatConvMaxWidth) { int ret_val; float result = 0; - float inf = __llvm_libc::fputil::FPBits::inf().get_val(); + float inf = LIBC_NAMESPACE::fputil::FPBits::inf().get_val(); - ret_val = __llvm_libc::sscanf("123", "%3f", &result); + ret_val = LIBC_NAMESPACE::sscanf("123", "%3f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 123.0); - ret_val = __llvm_libc::sscanf("123", "%5f", &result); + ret_val = LIBC_NAMESPACE::sscanf("123", "%5f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 123.0); - ret_val = __llvm_libc::sscanf("456", "%1f", &result); + ret_val = LIBC_NAMESPACE::sscanf("456", "%1f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 4.0); - ret_val = __llvm_libc::sscanf("-789", "%1f", &result); + ret_val = LIBC_NAMESPACE::sscanf("-789", "%1f", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("-123", "%2f", &result); + ret_val = LIBC_NAMESPACE::sscanf("-123", "%2f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, -1.0); - ret_val = __llvm_libc::sscanf("inf", "%2f", &result); + ret_val = LIBC_NAMESPACE::sscanf("inf", "%2f", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("nan", "%1f", &result); + ret_val = LIBC_NAMESPACE::sscanf("nan", "%1f", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("-inf", "%3f", &result); + ret_val = LIBC_NAMESPACE::sscanf("-inf", "%3f", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("-nan", "%3f", &result); + ret_val = LIBC_NAMESPACE::sscanf("-nan", "%3f", &result); EXPECT_EQ(ret_val, 0); // If the max length were not here this would fail as discussed above, but // since the max length limits it to the 3 it succeeds. - ret_val = __llvm_libc::sscanf("infinite", "%3f", &result); + ret_val = LIBC_NAMESPACE::sscanf("infinite", "%3f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, inf); - ret_val = __llvm_libc::sscanf("-infinite", "%4f", &result); + ret_val = LIBC_NAMESPACE::sscanf("-infinite", "%4f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, -inf); - ret_val = __llvm_libc::sscanf("01", "%1f", &result); + ret_val = LIBC_NAMESPACE::sscanf("01", "%1f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.0); - ret_val = __llvm_libc::sscanf("0x1", "%2f", &result); + ret_val = LIBC_NAMESPACE::sscanf("0x1", "%2f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.0); - ret_val = __llvm_libc::sscanf("100e", "%4f", &result); + ret_val = LIBC_NAMESPACE::sscanf("100e", "%4f", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("100e+10", "%5f", &result); + ret_val = LIBC_NAMESPACE::sscanf("100e+10", "%5f", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("100e10", "%5f", &result); + ret_val = LIBC_NAMESPACE::sscanf("100e10", "%5f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 100e1); } @@ -529,55 +530,55 @@ TEST(LlvmLibcSScanfTest, FloatConvNoWrite) { int ret_val; float result = 0; - ret_val = __llvm_libc::sscanf("123", "%*f", &result); + ret_val = LIBC_NAMESPACE::sscanf("123", "%*f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.0); - ret_val = __llvm_libc::sscanf("456.1", "%*a", &result); + ret_val = LIBC_NAMESPACE::sscanf("456.1", "%*a", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.0); - ret_val = __llvm_libc::sscanf("0x789.ap0", "%*e", &result); + ret_val = LIBC_NAMESPACE::sscanf("0x789.ap0", "%*e", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.0); - ret_val = __llvm_libc::sscanf("+12.0e1", "%*g", &result); + ret_val = LIBC_NAMESPACE::sscanf("+12.0e1", "%*g", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.0); - ret_val = __llvm_libc::sscanf("inf", "%*F", &result); + ret_val = LIBC_NAMESPACE::sscanf("inf", "%*F", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.0); - ret_val = __llvm_libc::sscanf("NaN", "%*A", &result); + ret_val = LIBC_NAMESPACE::sscanf("NaN", "%*A", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.0); - ret_val = __llvm_libc::sscanf("-InFiNiTy", "%*E", &result); + ret_val = LIBC_NAMESPACE::sscanf("-InFiNiTy", "%*E", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.0); - ret_val = __llvm_libc::sscanf("1e10", "%*G", &result); + ret_val = LIBC_NAMESPACE::sscanf("1e10", "%*G", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.0); - ret_val = __llvm_libc::sscanf(".1", "%*G", &result); + ret_val = LIBC_NAMESPACE::sscanf(".1", "%*G", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.0); - ret_val = __llvm_libc::sscanf("123", "%*3f", &result); + ret_val = LIBC_NAMESPACE::sscanf("123", "%*3f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.0); - ret_val = __llvm_libc::sscanf("123", "%*5f", &result); + ret_val = LIBC_NAMESPACE::sscanf("123", "%*5f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.0); - ret_val = __llvm_libc::sscanf("456", "%*1f", &result); + ret_val = LIBC_NAMESPACE::sscanf("456", "%*1f", &result); EXPECT_EQ(ret_val, 1); EXPECT_FP_EQ(result, 0.0); - ret_val = __llvm_libc::sscanf("Not a float", "%*f", &result); + ret_val = LIBC_NAMESPACE::sscanf("Not a float", "%*f", &result); EXPECT_EQ(ret_val, 0); } @@ -586,45 +587,45 @@ TEST(LlvmLibcSScanfTest, CurPosCombined) { int result = -1; char c_result = 0; - ret_val = __llvm_libc::sscanf("some text", "%n", &result); + ret_val = LIBC_NAMESPACE::sscanf("some text", "%n", &result); // %n doesn't count as a conversion for the return value. EXPECT_EQ(ret_val, 0); EXPECT_EQ(result, 0); - ret_val = __llvm_libc::sscanf("1234567890", "12345%n", &result); + ret_val = LIBC_NAMESPACE::sscanf("1234567890", "12345%n", &result); EXPECT_EQ(ret_val, 0); EXPECT_EQ(result, 5); - ret_val = __llvm_libc::sscanf("1234567890", "12345%n", &result); + ret_val = LIBC_NAMESPACE::sscanf("1234567890", "12345%n", &result); EXPECT_EQ(ret_val, 0); EXPECT_EQ(result, 5); // 288 characters - ret_val = __llvm_libc::sscanf("10000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000", - "%*d%hhn", &c_result); + ret_val = LIBC_NAMESPACE::sscanf("10000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000", + "%*d%hhn", &c_result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(c_result, char(288)); // Overflow is handled by casting. // 320 characters - ret_val = __llvm_libc::sscanf("10000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000" - "00000000000000000000000000000000", - "%*d%n", &result); + ret_val = LIBC_NAMESPACE::sscanf("10000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000" + "00000000000000000000000000000000", + "%*d%n", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, 320); } @@ -633,37 +634,37 @@ TEST(LlvmLibcSScanfTest, PointerConvCombined) { int ret_val; void *result; - ret_val = __llvm_libc::sscanf("(nullptr)", "%p", &result); + ret_val = LIBC_NAMESPACE::sscanf("(nullptr)", "%p", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, static_cast(nullptr)); - ret_val = __llvm_libc::sscanf("(NuLlPtR)", "%p", &result); + ret_val = LIBC_NAMESPACE::sscanf("(NuLlPtR)", "%p", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, static_cast(nullptr)); - ret_val = __llvm_libc::sscanf("(NULLPTR)", "%p", &result); + ret_val = LIBC_NAMESPACE::sscanf("(NULLPTR)", "%p", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, static_cast(nullptr)); - ret_val = __llvm_libc::sscanf("(null)", "%p", &result); + ret_val = LIBC_NAMESPACE::sscanf("(null)", "%p", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("(nullptr2", "%p", &result); + ret_val = LIBC_NAMESPACE::sscanf("(nullptr2", "%p", &result); EXPECT_EQ(ret_val, 0); - ret_val = __llvm_libc::sscanf("0", "%p", &result); + ret_val = LIBC_NAMESPACE::sscanf("0", "%p", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, reinterpret_cast(0)); - ret_val = __llvm_libc::sscanf("100", "%p", &result); + ret_val = LIBC_NAMESPACE::sscanf("100", "%p", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, reinterpret_cast(0x100)); - ret_val = __llvm_libc::sscanf("-1", "%p", &result); + ret_val = LIBC_NAMESPACE::sscanf("-1", "%p", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, reinterpret_cast(-1)); - ret_val = __llvm_libc::sscanf("0xabcDEFG", "%p", &result); + ret_val = LIBC_NAMESPACE::sscanf("0xabcDEFG", "%p", &result); EXPECT_EQ(ret_val, 1); EXPECT_EQ(result, reinterpret_cast(0xabcdef)); } @@ -672,17 +673,17 @@ TEST(LlvmLibcSScanfTest, CombinedConv) { int ret_val; int result = 0; char buffer[10]; - ret_val = __llvm_libc::sscanf("123abc", "%i%s", &result, buffer); + ret_val = LIBC_NAMESPACE::sscanf("123abc", "%i%s", &result, buffer); EXPECT_EQ(ret_val, 2); EXPECT_EQ(result, 123); ASSERT_STREQ(buffer, "abc"); - ret_val = __llvm_libc::sscanf("0xZZZ", "%i%s", &result, buffer); + ret_val = LIBC_NAMESPACE::sscanf("0xZZZ", "%i%s", &result, buffer); EXPECT_EQ(ret_val, 2); EXPECT_EQ(result, 0); ASSERT_STREQ(buffer, "ZZZ"); - ret_val = __llvm_libc::sscanf("0xZZZ", "%X%s", &result, buffer); + ret_val = LIBC_NAMESPACE::sscanf("0xZZZ", "%X%s", &result, buffer); EXPECT_EQ(ret_val, 2); EXPECT_EQ(result, 0); ASSERT_STREQ(buffer, "ZZZ"); diff --git a/libc/test/src/stdio/ungetc_test.cpp b/libc/test/src/stdio/ungetc_test.cpp index 028343d8b9793345dcc4325824c571c5d381248f..75eecc87ef265ff5de47dad89825e3dc9ade3a5e 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 67ce11e25d1c5d7e1800e1b90cf1a5e713fd8acf..cf51e8caa6a550d9450ffa5c527466d9ded51756 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 49c40e0274127a64ccbb19b430967fc67bcb6251..9bad2c831e5c42717bddd88254f1f14a22e5ee22 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 0710bbffe5b137a3be7ac754ebd2957c56726a4c..40eba723a0070714d13f65a6d0d69831d2ca94c9 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 08f10708b8dca3dd3b4f6be1e58d914def94384f..2aef1d71917eeeb9cd3b421409576050b47ecd63 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 3f0551a877f60c06f238f332cbf791d8e3e29709..ddccdfa5cef7305cfdc07491e9c3442e6b2c0fdd 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 923489d6644c78df1313e93a0614496abd200289..85701828c0f6b7cc645b65ad6868c4ebbc6cdad0 100644 --- a/libc/test/src/stdlib/AtoiTest.h +++ b/libc/test/src/stdlib/AtoiTest.h @@ -11,9 +11,10 @@ #include -using __llvm_libc::cpp::is_same_v; +using LIBC_NAMESPACE::cpp::is_same_v; -template struct AtoTest : public __llvm_libc::testing::Test { +template +struct AtoTest : public LIBC_NAMESPACE::testing::Test { using FunctionT = ReturnT (*)(const char *); void validNumbers(FunctionT func) { diff --git a/libc/test/src/stdlib/DivTest.h b/libc/test/src/stdlib/DivTest.h index 5867c5b7a0231c4cb0a733297093e2215ea6abf4..90fae6c4df44ff3e3205f7382c2415aa3b5b52af 100644 --- a/libc/test/src/stdlib/DivTest.h +++ b/libc/test/src/stdlib/DivTest.h @@ -9,7 +9,7 @@ #include "test/UnitTest/Test.h" template -class DivTest : public __llvm_libc::testing::Test { +class DivTest : public LIBC_NAMESPACE::testing::Test { public: using DivFunc = ReturnType(IntType, IntType); diff --git a/libc/test/src/stdlib/StrtolTest.h b/libc/test/src/stdlib/StrtolTest.h index 24726b418817d11f1f6b57e0fc87693d164b7e02..11794c4bfe05f8a113be9bc90e8cd3f7df16c439 100644 --- a/libc/test/src/stdlib/StrtolTest.h +++ b/libc/test/src/stdlib/StrtolTest.h @@ -15,7 +15,7 @@ #include #include -using __llvm_libc::cpp::is_signed_v; +using LIBC_NAMESPACE::cpp::is_signed_v; static inline char int_to_b36_char(int input) { if (input < 0 || input > 36) @@ -26,13 +26,13 @@ static inline char int_to_b36_char(int input) { } template -struct StrtoTest : public __llvm_libc::testing::Test { +struct StrtoTest : public LIBC_NAMESPACE::testing::Test { using FunctionT = ReturnT (*)(const char *, char **, int); static constexpr ReturnT T_MAX = - __llvm_libc::cpp::numeric_limits::max(); + LIBC_NAMESPACE::cpp::numeric_limits::max(); static constexpr ReturnT T_MIN = - __llvm_libc::cpp::numeric_limits::min(); + LIBC_NAMESPACE::cpp::numeric_limits::min(); void InvalidBase(FunctionT func) { const char *ten = "10"; diff --git a/libc/test/src/stdlib/_Exit_test.cpp b/libc/test/src/stdlib/_Exit_test.cpp index af5cd23743f6ea37cb2bcec4e617955d857d9a4a..9ca0fc51aab8121787dc2b64c6ac028802ededb8 100644 --- a/libc/test/src/stdlib/_Exit_test.cpp +++ b/libc/test/src/stdlib/_Exit_test.cpp @@ -13,9 +13,9 @@ #include TEST(LlvmLibcStdlib, _Exit) { - EXPECT_EXITS([] { __llvm_libc::_Exit(1); }, 1); - EXPECT_EXITS([] { __llvm_libc::_Exit(65); }, 65); + EXPECT_EXITS([] { LIBC_NAMESPACE::_Exit(1); }, 1); + EXPECT_EXITS([] { LIBC_NAMESPACE::_Exit(65); }, 65); - EXPECT_EXITS([] { __llvm_libc::exit(1); }, 1); - EXPECT_EXITS([] { __llvm_libc::exit(65); }, 65); + EXPECT_EXITS([] { LIBC_NAMESPACE::exit(1); }, 1); + EXPECT_EXITS([] { LIBC_NAMESPACE::exit(65); }, 65); } diff --git a/libc/test/src/stdlib/abort_test.cpp b/libc/test/src/stdlib/abort_test.cpp index 6e6f1aeeb91e143ccc93539c4bbe8f5c9cc57548..766c8d5fbb21a180a8d2377c9a45b78631e0ea47 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 a402253fb0695f11977f5b1eed44ce1b4b89706c..171383e2c9133de6d6840a2bb9aa4eec2672a0f4 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 eb295adfb719a00368c08667ea0c2fca1c0e28ce..8a785ccb8cce20a015abc7b344fae8c60de3a8e4 100644 --- a/libc/test/src/stdlib/atexit_test.cpp +++ b/libc/test/src/stdlib/atexit_test.cpp @@ -18,38 +18,39 @@ TEST(LlvmLibcAtExit, Basic) { a = 0; auto test = [] { - int status = __llvm_libc::atexit(+[] { + int status = LIBC_NAMESPACE::atexit(+[] { if (a != 1) __builtin_trap(); }); - status |= __llvm_libc::atexit(+[] { a++; }); + status |= LIBC_NAMESPACE::atexit(+[] { a++; }); if (status) __builtin_trap(); - __llvm_libc::exit(0); + LIBC_NAMESPACE::exit(0); }; EXPECT_EXITS(test, 0); } TEST(LlvmLibcAtExit, AtExitCallsSysExit) { auto test = [] { - __llvm_libc::atexit(+[] { _Exit(1); }); - __llvm_libc::exit(0); + LIBC_NAMESPACE::atexit(+[] { _Exit(1); }); + LIBC_NAMESPACE::exit(0); }; EXPECT_EXITS(test, 1); } static int size; -static __llvm_libc::cpp::array arr; +static LIBC_NAMESPACE::cpp::array arr; template -void register_atexit_handlers(__llvm_libc::cpp::integer_sequence) { - (__llvm_libc::atexit(+[] { arr[size++] = Ts; }), ...); +void register_atexit_handlers( + LIBC_NAMESPACE::cpp::integer_sequence) { + (LIBC_NAMESPACE::atexit(+[] { arr[size++] = Ts; }), ...); } template constexpr auto getTest() { return [] { - __llvm_libc::atexit(+[] { + LIBC_NAMESPACE::atexit(+[] { if (size != count) __builtin_trap(); for (int i = 0; i < count; i++) @@ -57,8 +58,8 @@ template constexpr auto getTest() { __builtin_trap(); }); register_atexit_handlers( - __llvm_libc::cpp::make_integer_sequence{}); - __llvm_libc::exit(0); + LIBC_NAMESPACE::cpp::make_integer_sequence{}); + LIBC_NAMESPACE::exit(0); }; } @@ -80,9 +81,9 @@ TEST(LlvmLibcAtExit, Many) { TEST(LlvmLibcAtExit, HandlerCallsAtExit) { auto test = [] { - __llvm_libc::atexit( - +[] { __llvm_libc::atexit(+[] { __llvm_libc::exit(1); }); }); - __llvm_libc::exit(0); + LIBC_NAMESPACE::atexit( + +[] { LIBC_NAMESPACE::atexit(+[] { LIBC_NAMESPACE::exit(1); }); }); + LIBC_NAMESPACE::exit(0); }; EXPECT_EXITS(test, 1); } diff --git a/libc/test/src/stdlib/atof_test.cpp b/libc/test/src/stdlib/atof_test.cpp index efa9f6c96d365de28a551710dd7ea869c0f945b9..ed3d4c26308cb23c9c4ccde0f58dd749ddf1873c 100644 --- a/libc/test/src/stdlib/atof_test.cpp +++ b/libc/test/src/stdlib/atof_test.cpp @@ -16,21 +16,21 @@ #include #include -using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; // This is just a simple test to make sure that this function works at all. It's // functionally identical to strtod so the bulk of the testing is there. TEST(LlvmLibcAToFTest, SimpleTest) { - __llvm_libc::fputil::FPBits expected_fp = - __llvm_libc::fputil::FPBits(uint64_t(0x405ec00000000000)); + LIBC_NAMESPACE::fputil::FPBits expected_fp = + LIBC_NAMESPACE::fputil::FPBits(uint64_t(0x405ec00000000000)); libc_errno = 0; - EXPECT_THAT(__llvm_libc::atof("123"), + EXPECT_THAT(LIBC_NAMESPACE::atof("123"), Succeeds(static_cast(expected_fp))); } TEST(LlvmLibcAToFTest, FailedParsingTest) { libc_errno = 0; // atof does not flag errors. - EXPECT_THAT(__llvm_libc::atof("???"), Succeeds(0.0)); + EXPECT_THAT(LIBC_NAMESPACE::atof("???"), Succeeds(0.0)); } diff --git a/libc/test/src/stdlib/atoi_test.cpp b/libc/test/src/stdlib/atoi_test.cpp index 6fbde557e1f0421f2671becfa4a4883914d5da9e..4973fbb3c1da4ef81c888618c5ddcd2a19392830 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 ad1cbba94650324f29e7934529700596bdf2754d..cc817087d05f9587a38a92cbf769914bcc18b563 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 8052f2fb15b69a627dd59b0e8b185b87ad408212..0c7a1331da29f3b7fb6145179a1e0871d21ef00d 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 4726f28c129a63219946407f9ab7d673240defed..689145806ba8d3bd2da2040e4ac70451f5e0cc85 100644 --- a/libc/test/src/stdlib/bsearch_test.cpp +++ b/libc/test/src/stdlib/bsearch_test.cpp @@ -25,13 +25,14 @@ static int int_compare(const void *l, const void *r) { TEST(LlvmLibcBsearchTest, ErrorInputs) { int val = 123; - EXPECT_TRUE(__llvm_libc::bsearch(nullptr, &val, 1, sizeof(int), - int_compare) == nullptr); - EXPECT_TRUE(__llvm_libc::bsearch(&val, nullptr, 1, sizeof(int), - int_compare) == nullptr); - EXPECT_TRUE(__llvm_libc::bsearch(&val, &val, 0, sizeof(int), int_compare) == + EXPECT_TRUE(LIBC_NAMESPACE::bsearch(nullptr, &val, 1, sizeof(int), + int_compare) == nullptr); + EXPECT_TRUE(LIBC_NAMESPACE::bsearch(&val, nullptr, 1, sizeof(int), + int_compare) == nullptr); + EXPECT_TRUE(LIBC_NAMESPACE::bsearch(&val, &val, 0, sizeof(int), + int_compare) == nullptr); + EXPECT_TRUE(LIBC_NAMESPACE::bsearch(&val, &val, 1, 0, int_compare) == nullptr); - EXPECT_TRUE(__llvm_libc::bsearch(&val, &val, 1, 0, int_compare) == nullptr); } TEST(LlvmLibcBsearchTest, IntegerArray) { @@ -45,7 +46,7 @@ TEST(LlvmLibcBsearchTest, IntegerArray) { for (size_t i = 0; i < s; ++i) { int key = ARRAY[i]; void *elem = - __llvm_libc::bsearch(&key, ARRAY, s, sizeof(int), int_compare); + LIBC_NAMESPACE::bsearch(&key, ARRAY, s, sizeof(int), int_compare); ASSERT_EQ(*reinterpret_cast(elem), key); } } @@ -53,26 +54,26 @@ TEST(LlvmLibcBsearchTest, IntegerArray) { // Non existent keys for (size_t s = 1; s <= ARRAY_SIZE; ++s) { int key = 5; - ASSERT_TRUE(__llvm_libc::bsearch(&key, &ARRAY, s, sizeof(int), - int_compare) == nullptr); + ASSERT_TRUE(LIBC_NAMESPACE::bsearch(&key, &ARRAY, s, sizeof(int), + int_compare) == nullptr); key = 125; - ASSERT_TRUE(__llvm_libc::bsearch(&key, &ARRAY, s, sizeof(int), - int_compare) == nullptr); + ASSERT_TRUE(LIBC_NAMESPACE::bsearch(&key, &ARRAY, s, sizeof(int), + int_compare) == nullptr); key = 136; - ASSERT_TRUE(__llvm_libc::bsearch(&key, &ARRAY, s, sizeof(int), - int_compare) == nullptr); + ASSERT_TRUE(LIBC_NAMESPACE::bsearch(&key, &ARRAY, s, sizeof(int), + int_compare) == nullptr); key = 12345; - ASSERT_TRUE(__llvm_libc::bsearch(&key, &ARRAY, s, sizeof(int), - int_compare) == nullptr); + ASSERT_TRUE(LIBC_NAMESPACE::bsearch(&key, &ARRAY, s, sizeof(int), + int_compare) == nullptr); } } TEST(LlvmLibcBsearchTest, SameKeyAndArray) { constexpr int ARRAY[5] = {1, 2, 3, 4, 5}; constexpr size_t ARRAY_SIZE = sizeof(ARRAY) / sizeof(int); - void *elem = - __llvm_libc::bsearch(ARRAY, ARRAY, ARRAY_SIZE, sizeof(int), int_compare); + void *elem = LIBC_NAMESPACE::bsearch(ARRAY, ARRAY, ARRAY_SIZE, sizeof(int), + int_compare); EXPECT_EQ(*reinterpret_cast(elem), ARRAY[0]); } diff --git a/libc/test/src/stdlib/div_test.cpp b/libc/test/src/stdlib/div_test.cpp index 6b1f20d186854682fd1e250b3273af1e72f75243..d06b8348b6464e248e7961c9f3a0b5cf192688d2 100644 --- a/libc/test/src/stdlib/div_test.cpp +++ b/libc/test/src/stdlib/div_test.cpp @@ -12,4 +12,4 @@ #include -LIST_DIV_TESTS(int, div_t, __llvm_libc::div) +LIST_DIV_TESTS(int, div_t, LIBC_NAMESPACE::div) diff --git a/libc/test/src/stdlib/labs_test.cpp b/libc/test/src/stdlib/labs_test.cpp index 1209d174331e323abf51d2ccf16a3f3751482ec6..535d1da5d5f4a6265cd36e706673c8e32119f0d3 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 d28d38789a716897bfa0e4a9bf303780c0b5d2c1..6b84163d65474821d9025d34b71f7f960e0f982a 100644 --- a/libc/test/src/stdlib/ldiv_test.cpp +++ b/libc/test/src/stdlib/ldiv_test.cpp @@ -12,4 +12,4 @@ #include -LIST_DIV_TESTS(long, ldiv_t, __llvm_libc::ldiv) +LIST_DIV_TESTS(long, ldiv_t, LIBC_NAMESPACE::ldiv) diff --git a/libc/test/src/stdlib/llabs_test.cpp b/libc/test/src/stdlib/llabs_test.cpp index 13ed4f8f1c523c33d14e9bc326d0492776a0e9db..a6dfa4655f28ae26b879e1bb4dfe9e264254e17a 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 5fa0de23f930c78d4c0bf486d6ea51243bbabcc2..d803894fa862cc30cd7048f667475f093b68b67a 100644 --- a/libc/test/src/stdlib/lldiv_test.cpp +++ b/libc/test/src/stdlib/lldiv_test.cpp @@ -12,4 +12,4 @@ #include -LIST_DIV_TESTS(long long, lldiv_t, __llvm_libc::lldiv) +LIST_DIV_TESTS(long long, lldiv_t, LIBC_NAMESPACE::lldiv) diff --git a/libc/test/src/stdlib/malloc_test.cpp b/libc/test/src/stdlib/malloc_test.cpp index 579d5dca53f00768cff7f8dc8e42c8febd1d8859..d9023cf56d9feafdf495c49918c4cf39eed3a175 100644 --- a/libc/test/src/stdlib/malloc_test.cpp +++ b/libc/test/src/stdlib/malloc_test.cpp @@ -11,9 +11,9 @@ #include "test/UnitTest/Test.h" TEST(LlvmLibcMallocTest, Allocate) { - int *ptr = reinterpret_cast(__llvm_libc::malloc(sizeof(int))); + int *ptr = reinterpret_cast(LIBC_NAMESPACE::malloc(sizeof(int))); EXPECT_NE(reinterpret_cast(ptr), static_cast(nullptr)); *ptr = 1; EXPECT_EQ(*ptr, 1); - __llvm_libc::free(ptr); + LIBC_NAMESPACE::free(ptr); } diff --git a/libc/test/src/stdlib/qsort_r_test.cpp b/libc/test/src/stdlib/qsort_r_test.cpp index ceb58fc1e896ae035a1302aeb9b5a25646e0ed36..2c810f411b03e21f5dc2d05824b14ca6d4e5b01b 100644 --- a/libc/test/src/stdlib/qsort_r_test.cpp +++ b/libc/test/src/stdlib/qsort_r_test.cpp @@ -33,8 +33,8 @@ TEST(LlvmLibcQsortRTest, SortedArray) { size_t count = 0; - __llvm_libc::qsort_r(array, ARRAY_SIZE, sizeof(int), int_compare_count, - &count); + LIBC_NAMESPACE::qsort_r(array, ARRAY_SIZE, sizeof(int), int_compare_count, + &count); ASSERT_LE(array[0], 10); ASSERT_LE(array[1], 23); @@ -74,8 +74,8 @@ TEST(LlvmLibcQsortRTest, ReverseSortedArray) { size_t count = 0; - __llvm_libc::qsort_r(array, ARRAY_SIZE, sizeof(int), int_compare_count, - &count); + LIBC_NAMESPACE::qsort_r(array, ARRAY_SIZE, sizeof(int), int_compare_count, + &count); for (int i = 0; i < int(ARRAY_SIZE - 1); ++i) ASSERT_LE(array[i], i + 1); @@ -127,9 +127,9 @@ TEST(LlvmLibcQsortRTest, SafeTypeErasure) { }; constexpr size_t ARRAY_SIZE = sizeof(array) / sizeof(PriorityVal); - __llvm_libc::qsort_r(array, ARRAY_SIZE, sizeof(PriorityVal), - type_erased_comp, - reinterpret_cast(compare_priority_val)); + LIBC_NAMESPACE::qsort_r(array, ARRAY_SIZE, sizeof(PriorityVal), + type_erased_comp, + reinterpret_cast(compare_priority_val)); EXPECT_EQ(array[0].priority, -1); EXPECT_EQ(array[0].size, 100); diff --git a/libc/test/src/stdlib/qsort_test.cpp b/libc/test/src/stdlib/qsort_test.cpp index 9808ad0dcc275c1e3395c142525d5cad1bc89d09..0822d490e65208b2050540258b18494fca578cb1 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 4bebbe37ffbe11471eced4875e2913a961139cdf..6f25708e539053deb608ed9025c9d166694dd1e8 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 70129ba0714d44ecb18f988b7a4375ada19dacf7..b1bdd89e41fd1511d388ca4c1ce55edaf7466867 100644 --- a/libc/test/src/stdlib/strtod_test.cpp +++ b/libc/test/src/stdlib/strtod_test.cpp @@ -17,13 +17,13 @@ #include #include -using __llvm_libc::fputil::testing::ForceRoundingModeTest; -using __llvm_libc::fputil::testing::RoundingMode; +using LIBC_NAMESPACE::fputil::testing::ForceRoundingModeTest; +using LIBC_NAMESPACE::fputil::testing::RoundingMode; -using __llvm_libc::testing::ErrnoSetterMatcher::Fails; -using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; -class LlvmLibcStrToDTest : public __llvm_libc::testing::Test, +class LlvmLibcStrToDTest : public LIBC_NAMESPACE::testing::Test, ForceRoundingModeTest { public: void run_test(const char *inputString, const ptrdiff_t expectedStrLen, @@ -44,11 +44,11 @@ public: // This is so that the result can be compared in parts. char *str_end = nullptr; - __llvm_libc::fputil::FPBits expected_fp = - __llvm_libc::fputil::FPBits(expectedRawData); + LIBC_NAMESPACE::fputil::FPBits expected_fp = + LIBC_NAMESPACE::fputil::FPBits(expectedRawData); libc_errno = 0; - double result = __llvm_libc::strtod(inputString, &str_end); + double result = LIBC_NAMESPACE::strtod(inputString, &str_end); if (expectedErrno == 0) EXPECT_THAT(result, Succeeds(static_cast(expected_fp))); else diff --git a/libc/test/src/stdlib/strtof_test.cpp b/libc/test/src/stdlib/strtof_test.cpp index 9151cbeb88d587ba14ef934ce642373fa78f7033..15a8a34ef4fb1716186a78c5f3b8bcd65eeece18 100644 --- a/libc/test/src/stdlib/strtof_test.cpp +++ b/libc/test/src/stdlib/strtof_test.cpp @@ -17,10 +17,10 @@ #include #include -using __llvm_libc::fputil::testing::ForceRoundingModeTest; -using __llvm_libc::fputil::testing::RoundingMode; +using LIBC_NAMESPACE::fputil::testing::ForceRoundingModeTest; +using LIBC_NAMESPACE::fputil::testing::RoundingMode; -class LlvmLibcStrToFTest : public __llvm_libc::testing::Test, +class LlvmLibcStrToFTest : public LIBC_NAMESPACE::testing::Test, ForceRoundingModeTest { public: void run_test(const char *inputString, const ptrdiff_t expectedStrLen, @@ -41,11 +41,11 @@ public: // This is so that the result can be compared in parts. char *str_end = nullptr; - __llvm_libc::fputil::FPBits expected_fp = - __llvm_libc::fputil::FPBits(expectedRawData); + LIBC_NAMESPACE::fputil::FPBits expected_fp = + LIBC_NAMESPACE::fputil::FPBits(expectedRawData); libc_errno = 0; - float result = __llvm_libc::strtof(inputString, &str_end); + float result = LIBC_NAMESPACE::strtof(inputString, &str_end); EXPECT_EQ(str_end - inputString, expectedStrLen); EXPECT_FP_EQ(result, static_cast(expected_fp)); diff --git a/libc/test/src/stdlib/strtoint32_test.cpp b/libc/test/src/stdlib/strtoint32_test.cpp index fa5e57145d24caa627a9e0799ad0421d3267a3a5..4ca20f3333f56013358b8d073808c8c318554a5c 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 95e4761881f5191b07cadbdd85d8ab77b7019de2..f8d807b146f2ec4e0a8916639f2c9687d8e486b6 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 fb92ee6978d9bc910d758a1541ee5eaa353eb910..a6ce262559f71f452e7746bff86c1c5da3378d39 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 dfa1fb7e939b5e15e6a80b4d415acb30e7c6f086..680a93188c76d1d7ff71497331a9e3554ddec272 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 expected_fp = - __llvm_libc::fputil::FPBits(expectedRawData); + LIBC_NAMESPACE::fputil::FPBits expected_fp = + LIBC_NAMESPACE::fputil::FPBits(expectedRawData); const int expected_errno = expectedErrno; libc_errno = 0; - long double result = __llvm_libc::strtold(inputString, &str_end); + long double result = LIBC_NAMESPACE::strtold(inputString, &str_end); - __llvm_libc::fputil::FPBits actual_fp = - __llvm_libc::fputil::FPBits(); - actual_fp = __llvm_libc::fputil::FPBits(result); + LIBC_NAMESPACE::fputil::FPBits actual_fp = + LIBC_NAMESPACE::fputil::FPBits(); + actual_fp = LIBC_NAMESPACE::fputil::FPBits(result); EXPECT_EQ(str_end - inputString, expectedStrLen); diff --git a/libc/test/src/stdlib/strtoll_test.cpp b/libc/test/src/stdlib/strtoll_test.cpp index b4b197d59ea0609584b2df6a4383b4376cdcab75..8e94cdc6a3899615f43e50137af150ad6bc5f945 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 f2cd8603a9832cee74986d304d1c3bc64a503d0c..7ba721139dd3948d4ea0a98a3b260f047e4b69b2 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 c2544060d8bd5b4c905cc291fc1477b64a3fe26e..c9a0b8de46b587091164feb97ded76fbdbf8abe4 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 71903c987cacbbb2bbde4f7d64b0bfc6e67b078f..74e172de95953e7030092ce172e667222b6ab07f 100644 --- a/libc/test/src/string/StrchrTest.h +++ b/libc/test/src/string/StrchrTest.h @@ -8,7 +8,7 @@ #include "test/UnitTest/Test.h" -template struct StrchrTest : public __llvm_libc::testing::Test { +template struct StrchrTest : public LIBC_NAMESPACE::testing::Test { void findsFirstCharacter() { const char *src = "abcde"; @@ -82,7 +82,7 @@ template struct StrchrTest : public __llvm_libc::testing::Test { } }; -template struct StrrchrTest : public __llvm_libc::testing::Test { +template struct StrrchrTest : public LIBC_NAMESPACE::testing::Test { void findsFirstCharacter() { const char *src = "abcde"; diff --git a/libc/test/src/string/bcmp_test.cpp b/libc/test/src/string/bcmp_test.cpp index 72037c73b4f5060473df12587461a351e30465dd..fa89e4d7b08f19c88cfd6cfc69bcf7994bc04505 100644 --- a/libc/test/src/string/bcmp_test.cpp +++ b/libc/test/src/string/bcmp_test.cpp @@ -11,35 +11,35 @@ #include "test/UnitTest/Test.h" #include "test/UnitTest/TestLogger.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { TEST(LlvmLibcBcmpTest, CmpZeroByte) { const char *lhs = "ab"; const char *rhs = "bc"; - ASSERT_EQ(__llvm_libc::bcmp(lhs, rhs, 0), 0); + ASSERT_EQ(LIBC_NAMESPACE::bcmp(lhs, rhs, 0), 0); } TEST(LlvmLibcBcmpTest, LhsRhsAreTheSame) { const char *lhs = "ab"; const char *rhs = "ab"; - ASSERT_EQ(__llvm_libc::bcmp(lhs, rhs, 2), 0); + ASSERT_EQ(LIBC_NAMESPACE::bcmp(lhs, rhs, 2), 0); } TEST(LlvmLibcBcmpTest, LhsBeforeRhsLexically) { const char *lhs = "ab"; const char *rhs = "ac"; - ASSERT_NE(__llvm_libc::bcmp(lhs, rhs, 2), 0); + ASSERT_NE(LIBC_NAMESPACE::bcmp(lhs, rhs, 2), 0); } TEST(LlvmLibcBcmpTest, LhsAfterRhsLexically) { const char *lhs = "ac"; const char *rhs = "ab"; - ASSERT_NE(__llvm_libc::bcmp(lhs, rhs, 2), 0); + ASSERT_NE(LIBC_NAMESPACE::bcmp(lhs, rhs, 2), 0); } // Adapt CheckBcmp signature to bcmp. static inline int Adaptor(cpp::span p1, cpp::span p2, size_t size) { - return __llvm_libc::bcmp(p1.begin(), p2.begin(), size); + return LIBC_NAMESPACE::bcmp(p1.begin(), p2.begin(), size); } TEST(LlvmLibcBcmpTest, SizeSweep) { @@ -57,4 +57,4 @@ TEST(LlvmLibcBcmpTest, SizeSweep) { } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/src/string/bcopy_test.cpp b/libc/test/src/string/bcopy_test.cpp index 96541797eed338ee73b7eee14458d7c5d99c5760..f8cb9208838f33f0351dba8e618dce62f44006f3 100644 --- a/libc/test/src/string/bcopy_test.cpp +++ b/libc/test/src/string/bcopy_test.cpp @@ -13,16 +13,16 @@ #include "test/UnitTest/MemoryMatcher.h" #include "test/UnitTest/Test.h" -using __llvm_libc::cpp::array; -using __llvm_libc::cpp::span; +using LIBC_NAMESPACE::cpp::array; +using LIBC_NAMESPACE::cpp::span; -namespace __llvm_libc { +namespace LIBC_NAMESPACE { TEST(LlvmLibcBcopyTest, MoveZeroByte) { char Buffer[] = {'a', 'b', 'y', 'z'}; const char Expected[] = {'a', 'b', 'y', 'z'}; void *const Dst = Buffer; - __llvm_libc::bcopy(Buffer + 2, Dst, 0); + LIBC_NAMESPACE::bcopy(Buffer + 2, Dst, 0); ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected)); } @@ -30,7 +30,7 @@ TEST(LlvmLibcBcopyTest, DstAndSrcPointToSameAddress) { char Buffer[] = {'a', 'b'}; const char Expected[] = {'a', 'b'}; void *const Dst = Buffer; - __llvm_libc::bcopy(Buffer, Dst, 1); + LIBC_NAMESPACE::bcopy(Buffer, Dst, 1); ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected)); } @@ -40,7 +40,7 @@ TEST(LlvmLibcBcopyTest, DstStartsBeforeSrc) { char Buffer[] = {'z', 'a', 'b', 'c', 'z'}; const char Expected[] = {'z', 'b', 'c', 'c', 'z'}; void *const Dst = Buffer + 1; - __llvm_libc::bcopy(Buffer + 2, Dst, 2); + LIBC_NAMESPACE::bcopy(Buffer + 2, Dst, 2); ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected)); } @@ -48,7 +48,7 @@ TEST(LlvmLibcBcopyTest, DstStartsAfterSrc) { char Buffer[] = {'z', 'a', 'b', 'c', 'z'}; const char Expected[] = {'z', 'a', 'a', 'b', 'z'}; void *const Dst = Buffer + 2; - __llvm_libc::bcopy(Buffer + 1, Dst, 2); + LIBC_NAMESPACE::bcopy(Buffer + 1, Dst, 2); ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected)); } @@ -60,7 +60,7 @@ TEST(LlvmLibcBcopyTest, SrcFollowDst) { char Buffer[] = {'z', 'a', 'b', 'z'}; const char Expected[] = {'z', 'b', 'b', 'z'}; void *const Dst = Buffer + 1; - __llvm_libc::bcopy(Buffer + 2, Dst, 1); + LIBC_NAMESPACE::bcopy(Buffer + 2, Dst, 1); ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected)); } @@ -68,14 +68,14 @@ TEST(LlvmLibcBcopyTest, DstFollowSrc) { char Buffer[] = {'z', 'a', 'b', 'z'}; const char Expected[] = {'z', 'a', 'a', 'z'}; void *const Dst = Buffer + 2; - __llvm_libc::bcopy(Buffer + 1, Dst, 1); + LIBC_NAMESPACE::bcopy(Buffer + 1, Dst, 1); ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected)); } // Adapt CheckMemmove signature to bcopy. static inline void Adaptor(cpp::span dst, cpp::span src, size_t size) { - __llvm_libc::bcopy(src.begin(), dst.begin(), size); + LIBC_NAMESPACE::bcopy(src.begin(), dst.begin(), size); } TEST(LlvmLibcBcopyTest, SizeSweep) { @@ -95,4 +95,4 @@ TEST(LlvmLibcBcopyTest, SizeSweep) { } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/src/string/bzero_test.cpp b/libc/test/src/string/bzero_test.cpp index d3ee64dc8ad7d30fed04142ab3a44e325c29b69e..7382490e13cbae0d0a40955524c1d88b7893a188 100644 --- a/libc/test/src/string/bzero_test.cpp +++ b/libc/test/src/string/bzero_test.cpp @@ -10,11 +10,11 @@ #include "src/string/bzero.h" #include "test/UnitTest/Test.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Adapt CheckMemset signature to bzero. static inline void Adaptor(cpp::span p1, uint8_t value, size_t size) { - __llvm_libc::bzero(p1.begin(), size); + LIBC_NAMESPACE::bzero(p1.begin(), size); } TEST(LlvmLibcBzeroTest, SizeSweep) { @@ -26,4 +26,4 @@ TEST(LlvmLibcBzeroTest, SizeSweep) { } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/src/string/index_test.cpp b/libc/test/src/string/index_test.cpp index 22202f0fc8346b8301b8d9bfba5d6ffa615465d5..88953205009d76cd38791fb0bf5453be87f57498 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 09f24ae7cdeace2d220f309f62a9a1f6fe2c6b0f..5bac86541ccff1659bd1b282227c3f7b384bbf10 100644 --- a/libc/test/src/string/memccpy_test.cpp +++ b/libc/test/src/string/memccpy_test.cpp @@ -11,17 +11,17 @@ #include "test/UnitTest/Test.h" #include // For size_t. -class LlvmLibcMemccpyTest : public __llvm_libc::testing::Test { +class LlvmLibcMemccpyTest : public LIBC_NAMESPACE::testing::Test { public: - void check_memccpy(__llvm_libc::cpp::span dst, - const __llvm_libc::cpp::span src, int end, + void check_memccpy(LIBC_NAMESPACE::cpp::span dst, + const LIBC_NAMESPACE::cpp::span src, int end, size_t count, - const __llvm_libc::cpp::span expected, + const LIBC_NAMESPACE::cpp::span expected, size_t expectedCopied, bool shouldReturnNull = false) { // Making sure we don't overflow buffer. ASSERT_GE(dst.size(), count); // Making sure memccpy returns dst. - void *result = __llvm_libc::memccpy(dst.data(), src.data(), end, count); + void *result = LIBC_NAMESPACE::memccpy(dst.data(), src.data(), end, count); if (shouldReturnNull) { ASSERT_EQ(result, static_cast(nullptr)); diff --git a/libc/test/src/string/memchr_test.cpp b/libc/test/src/string/memchr_test.cpp index 1523be8f3fc36e3fdee6c9004bcd3ba5191fdfe0..343958234edceee5b4b88a36f097b915afd43134 100644 --- a/libc/test/src/string/memchr_test.cpp +++ b/libc/test/src/string/memchr_test.cpp @@ -13,7 +13,7 @@ // A helper function that calls memchr and abstracts away the explicit cast for // readability purposes. const char *call_memchr(const void *src, int c, size_t size) { - return reinterpret_cast(__llvm_libc::memchr(src, c, size)); + return reinterpret_cast(LIBC_NAMESPACE::memchr(src, c, size)); } TEST(LlvmLibcMemChrTest, FindsCharacterAfterNullTerminator) { @@ -80,10 +80,10 @@ TEST(LlvmLibcMemChrTest, TheSourceShouldNotChange) { const unsigned char src[size] = {'a', 'b', 'c', 'd', 'e', '\0'}; const char *src_copy = reinterpret_cast(src); // When the character is found, the source string should not change. - __llvm_libc::memchr(src, 'd', size); + LIBC_NAMESPACE::memchr(src, 'd', size); ASSERT_STREQ(reinterpret_cast(src), src_copy); // Same case for when the character is not found. - __llvm_libc::memchr(src, 'z', size); + LIBC_NAMESPACE::memchr(src, 'z', size); ASSERT_STREQ(reinterpret_cast(src), src_copy); } diff --git a/libc/test/src/string/memcmp_test.cpp b/libc/test/src/string/memcmp_test.cpp index ac26fd49de6f2b3457ceea573650d9906bbe7072..03a0ac1c0ba6550dd897600d04cd9b5d4bc84ec8 100644 --- a/libc/test/src/string/memcmp_test.cpp +++ b/libc/test/src/string/memcmp_test.cpp @@ -11,35 +11,35 @@ #include "test/UnitTest/Test.h" #include "test/UnitTest/TestLogger.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { TEST(LlvmLibcMemcmpTest, CmpZeroByte) { const char *lhs = "ab"; const char *rhs = "yz"; - EXPECT_EQ(__llvm_libc::memcmp(lhs, rhs, 0), 0); + EXPECT_EQ(LIBC_NAMESPACE::memcmp(lhs, rhs, 0), 0); } TEST(LlvmLibcMemcmpTest, LhsRhsAreTheSame) { const char *lhs = "ab"; const char *rhs = "ab"; - EXPECT_EQ(__llvm_libc::memcmp(lhs, rhs, 2), 0); + EXPECT_EQ(LIBC_NAMESPACE::memcmp(lhs, rhs, 2), 0); } TEST(LlvmLibcMemcmpTest, LhsBeforeRhsLexically) { const char *lhs = "ab"; const char *rhs = "az"; - EXPECT_LT(__llvm_libc::memcmp(lhs, rhs, 2), 0); + EXPECT_LT(LIBC_NAMESPACE::memcmp(lhs, rhs, 2), 0); } TEST(LlvmLibcMemcmpTest, LhsAfterRhsLexically) { const char *lhs = "az"; const char *rhs = "ab"; - EXPECT_GT(__llvm_libc::memcmp(lhs, rhs, 2), 0); + EXPECT_GT(LIBC_NAMESPACE::memcmp(lhs, rhs, 2), 0); } // Adapt CheckMemcmp signature to memcmp. static inline int Adaptor(cpp::span p1, cpp::span p2, size_t size) { - return __llvm_libc::memcmp(p1.begin(), p2.begin(), size); + return LIBC_NAMESPACE::memcmp(p1.begin(), p2.begin(), size); } TEST(LlvmLibcMemcmpTest, SizeSweep) { @@ -57,4 +57,4 @@ TEST(LlvmLibcMemcmpTest, SizeSweep) { } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/src/string/memcpy_test.cpp b/libc/test/src/string/memcpy_test.cpp index 7fe0921077c33b00c8cb48d29bae3d15b8cae11c..b05d4202ea31cd1db32487e3b577078b5f950995 100644 --- a/libc/test/src/string/memcpy_test.cpp +++ b/libc/test/src/string/memcpy_test.cpp @@ -10,12 +10,12 @@ #include "src/string/memcpy.h" #include "test/UnitTest/Test.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Adapt CheckMemcpy signature to memcpy. static inline void Adaptor(cpp::span dst, cpp::span src, size_t size) { - __llvm_libc::memcpy(dst.begin(), src.begin(), size); + LIBC_NAMESPACE::memcpy(dst.begin(), src.begin(), size); } TEST(LlvmLibcMemcpyTest, SizeSweep) { @@ -30,4 +30,4 @@ TEST(LlvmLibcMemcpyTest, SizeSweep) { } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/src/string/memmem_test.cpp b/libc/test/src/string/memmem_test.cpp index db6c9c05e3a0b1594e9338cdf59c0555eaff6ce8..56d4b7f03c264be6331bb7e527bfe2199290cb97 100644 --- a/libc/test/src/string/memmem_test.cpp +++ b/libc/test/src/string/memmem_test.cpp @@ -11,40 +11,40 @@ #include "src/string/string_utils.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { TEST(LlvmLibcMemmemTest, EmptyHaystackEmptyNeedleReturnsHaystck) { char *h = nullptr; char *n = nullptr; - void *result = __llvm_libc::memmem(h, 0, n, 0); + void *result = LIBC_NAMESPACE::memmem(h, 0, n, 0); ASSERT_EQ(static_cast(result), h); } TEST(LlvmLibcMemmemTest, EmptyHaystackNonEmptyNeedleReturnsNull) { char *h = nullptr; char n[] = {'a', 'b', 'c'}; - void *result = __llvm_libc::memmem(h, 0, n, sizeof(n)); + void *result = LIBC_NAMESPACE::memmem(h, 0, n, sizeof(n)); ASSERT_EQ(result, static_cast(nullptr)); } TEST(LlvmLibcMemmemTest, EmptyNeedleReturnsHaystack) { char h[] = {'a', 'b', 'c'}; char *n = nullptr; - void *result = __llvm_libc::memmem(h, sizeof(h), n, 0); + void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, 0); ASSERT_EQ(static_cast(result), h + 0); } TEST(LlvmLibcMemmemTest, ExactMatchReturnsHaystack) { char h[] = {'a', 'b', 'c'}; char n[] = {'a', 'b', 'c'}; - void *result = __llvm_libc::memmem(h, sizeof(h), n, sizeof(n)); + void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, sizeof(n)); ASSERT_EQ(static_cast(result), h + 0); } TEST(LlvmLibcMemmemTest, ReturnFirstMatchOfNeedle) { char h[] = {'a', 'a', 'b', 'c'}; char n[] = {'a'}; - void *result = __llvm_libc::memmem(h, sizeof(h), n, sizeof(n)); + void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, sizeof(n)); ASSERT_EQ(static_cast(result), h + 0); } @@ -52,13 +52,13 @@ TEST(LlvmLibcMemmemTest, ReturnFirstExactMatchOfNeedle) { { char h[] = {'a', 'b', 'a', 'c', 'a', 'a'}; char n[] = {'a', 'a'}; - void *result = __llvm_libc::memmem(h, sizeof(h), n, sizeof(n)); + void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, sizeof(n)); ASSERT_EQ(static_cast(result), h + 4); } { char h[] = {'a', 'a', 'b', 'a', 'b', 'a'}; char n[] = {'a', 'b', 'a'}; - void *result = __llvm_libc::memmem(h, sizeof(h), n, sizeof(n)); + void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, sizeof(n)); ASSERT_EQ(static_cast(result), h + 1); } } @@ -66,7 +66,7 @@ TEST(LlvmLibcMemmemTest, ReturnFirstExactMatchOfNeedle) { TEST(LlvmLibcMemmemTest, NullTerminatorDoesNotInterruptMatch) { char h[] = {'\0', 'a', 'b'}; char n[] = {'a', 'b'}; - void *result = __llvm_libc::memmem(h, sizeof(h), n, sizeof(n)); + void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, sizeof(n)); ASSERT_EQ(static_cast(result), h + 1); } @@ -74,25 +74,25 @@ TEST(LlvmLibcMemmemTest, ReturnNullIfNoExactMatch) { { char h[] = {'a'}; char n[] = {'a', 'a'}; - void *result = __llvm_libc::memmem(h, sizeof(h), n, sizeof(n)); + void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, sizeof(n)); ASSERT_EQ(result, static_cast(nullptr)); } { char h[] = {'a', 'A'}; char n[] = {'a', 'a'}; - void *result = __llvm_libc::memmem(h, sizeof(h), n, sizeof(n)); + void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, sizeof(n)); ASSERT_EQ(result, static_cast(nullptr)); } { char h[] = {'a'}; char n[] = {'a', '\0'}; - void *result = __llvm_libc::memmem(h, sizeof(h), n, sizeof(n)); + void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, sizeof(n)); ASSERT_EQ(result, static_cast(nullptr)); } { char h[] = {'\0'}; char n[] = {'\0', '\0'}; - void *result = __llvm_libc::memmem(h, sizeof(h), n, sizeof(n)); + void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, sizeof(n)); ASSERT_EQ(result, static_cast(nullptr)); } } @@ -101,13 +101,13 @@ TEST(LlvmLibcMemmemTest, ReturnMatchOfSpecifiedNeedleLength) { { char h[] = {'a', 'b', 'c'}; char n[] = {'x', 'y', 'z'}; - void *result = __llvm_libc::memmem(h, sizeof(h), n, 0); + void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, 0); ASSERT_EQ(static_cast(result), h + 0); } { char h[] = {'a', 'b', 'c'}; char n[] = {'b', 'c', 'a'}; - void *result = __llvm_libc::memmem(h, sizeof(h), n, 2); + void *result = LIBC_NAMESPACE::memmem(h, sizeof(h), n, 2); ASSERT_EQ(static_cast(result), h + 1); } } @@ -116,14 +116,14 @@ TEST(LlvmLibcMemmemTest, ReturnNullIfInadequateHaystackLength) { { char h[] = {'a', 'b', 'c'}; char n[] = {'c'}; - void *result = __llvm_libc::memmem(h, 2, n, sizeof(n)); + void *result = LIBC_NAMESPACE::memmem(h, 2, n, sizeof(n)); ASSERT_EQ(result, static_cast(nullptr)); } { char h[] = {'a', 'b', 'c'}; char n[] = {'a', 'b', 'c'}; - void *result = __llvm_libc::memmem(h, 2, n, sizeof(n)); + void *result = LIBC_NAMESPACE::memmem(h, 2, n, sizeof(n)); ASSERT_EQ(result, static_cast(nullptr)); } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/src/string/memmove_test.cpp b/libc/test/src/string/memmove_test.cpp index 57ab0d40d33eaafc8f4bb81b4dca082258e27ad9..b076e862b6ec749791f2cdfee0c5d85e5d240cf3 100644 --- a/libc/test/src/string/memmove_test.cpp +++ b/libc/test/src/string/memmove_test.cpp @@ -13,16 +13,16 @@ #include "test/UnitTest/MemoryMatcher.h" #include "test/UnitTest/Test.h" -using __llvm_libc::cpp::array; -using __llvm_libc::cpp::span; +using LIBC_NAMESPACE::cpp::array; +using LIBC_NAMESPACE::cpp::span; -namespace __llvm_libc { +namespace LIBC_NAMESPACE { TEST(LlvmLibcMemmoveTest, MoveZeroByte) { char Buffer[] = {'a', 'b', 'y', 'z'}; const char Expected[] = {'a', 'b', 'y', 'z'}; void *const Dst = Buffer; - void *const Ret = __llvm_libc::memmove(Dst, Buffer + 2, 0); + void *const Ret = LIBC_NAMESPACE::memmove(Dst, Buffer + 2, 0); EXPECT_EQ(Ret, Dst); ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected)); } @@ -31,7 +31,7 @@ TEST(LlvmLibcMemmoveTest, DstAndSrcPointToSameAddress) { char Buffer[] = {'a', 'b'}; const char Expected[] = {'a', 'b'}; void *const Dst = Buffer; - void *const Ret = __llvm_libc::memmove(Dst, Buffer, 1); + void *const Ret = LIBC_NAMESPACE::memmove(Dst, Buffer, 1); EXPECT_EQ(Ret, Dst); ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected)); } @@ -42,7 +42,7 @@ TEST(LlvmLibcMemmoveTest, DstStartsBeforeSrc) { char Buffer[] = {'z', 'a', 'b', 'c', 'z'}; const char Expected[] = {'z', 'b', 'c', 'c', 'z'}; void *const Dst = Buffer + 1; - void *const Ret = __llvm_libc::memmove(Dst, Buffer + 2, 2); + void *const Ret = LIBC_NAMESPACE::memmove(Dst, Buffer + 2, 2); EXPECT_EQ(Ret, Dst); ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected)); } @@ -51,7 +51,7 @@ TEST(LlvmLibcMemmoveTest, DstStartsAfterSrc) { char Buffer[] = {'z', 'a', 'b', 'c', 'z'}; const char Expected[] = {'z', 'a', 'a', 'b', 'z'}; void *const Dst = Buffer + 2; - void *const Ret = __llvm_libc::memmove(Dst, Buffer + 1, 2); + void *const Ret = LIBC_NAMESPACE::memmove(Dst, Buffer + 1, 2); EXPECT_EQ(Ret, Dst); ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected)); } @@ -64,7 +64,7 @@ TEST(LlvmLibcMemmoveTest, SrcFollowDst) { char Buffer[] = {'z', 'a', 'b', 'z'}; const char Expected[] = {'z', 'b', 'b', 'z'}; void *const Dst = Buffer + 1; - void *const Ret = __llvm_libc::memmove(Dst, Buffer + 2, 1); + void *const Ret = LIBC_NAMESPACE::memmove(Dst, Buffer + 2, 1); EXPECT_EQ(Ret, Dst); ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected)); } @@ -73,7 +73,7 @@ TEST(LlvmLibcMemmoveTest, DstFollowSrc) { char Buffer[] = {'z', 'a', 'b', 'z'}; const char Expected[] = {'z', 'a', 'a', 'z'}; void *const Dst = Buffer + 2; - void *const Ret = __llvm_libc::memmove(Dst, Buffer + 1, 1); + void *const Ret = LIBC_NAMESPACE::memmove(Dst, Buffer + 1, 1); EXPECT_EQ(Ret, Dst); ASSERT_MEM_EQ(Buffer, testing::MemoryView(Expected)); } @@ -81,7 +81,7 @@ TEST(LlvmLibcMemmoveTest, DstFollowSrc) { // Adapt CheckMemmove signature to op implementation signatures. static inline void Adaptor(cpp::span dst, cpp::span src, size_t size) { - __llvm_libc::memmove(dst.begin(), src.begin(), size); + LIBC_NAMESPACE::memmove(dst.begin(), src.begin(), size); } TEST(LlvmLibcMemmoveTest, SizeSweep) { @@ -101,4 +101,4 @@ TEST(LlvmLibcMemmoveTest, SizeSweep) { } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/src/string/memory_utils/memory_check_utils.h b/libc/test/src/string/memory_utils/memory_check_utils.h index dee375e811e758474a18e009ae7d18fa0ea0c629..9504230e0c3aa9ff40af89b98cd425cc1ec89860 100644 --- a/libc/test/src/string/memory_utils/memory_check_utils.h +++ b/libc/test/src/string/memory_utils/memory_check_utils.h @@ -17,7 +17,7 @@ #include // uintxx_t #include // malloc/free -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Simple structure to allocate a buffer of a particular size. // When ASAN is present it also poisons the whole memory. @@ -198,6 +198,6 @@ inline bool CheckMemmove(cpp::span buffer, size_t size, int overlap) { return true; } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE #endif // LIBC_TEST_SRC_STRING_MEMORY_UTILS_MEMORY_CHECK_UTILS_H diff --git a/libc/test/src/string/memory_utils/op_tests.cpp b/libc/test/src/string/memory_utils/op_tests.cpp index f1223b81dac895b62613525954d77cc7d13831f2..15ac9607bf3e3df72396d040107b360e314a371b 100644 --- a/libc/test/src/string/memory_utils/op_tests.cpp +++ b/libc/test/src/string/memory_utils/op_tests.cpp @@ -14,7 +14,7 @@ #include "src/string/memory_utils/op_x86.h" #include "test/UnitTest/Test.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { template struct has_head_tail { template static char sfinae(decltype(&C::head_tail)); @@ -343,4 +343,4 @@ TYPED_TEST(LlvmLibcOpTest, Memcmp, MemcmpImplementations) { } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/src/string/memory_utils/utils_test.cpp b/libc/test/src/string/memory_utils/utils_test.cpp index 8968e0d85ae992eddcb9fa70df64ff02a3d5f137..8e9052de56f1b088466b6e60a7d36e1a09581200 100644 --- a/libc/test/src/string/memory_utils/utils_test.cpp +++ b/libc/test/src/string/memory_utils/utils_test.cpp @@ -10,7 +10,7 @@ #include "src/string/memory_utils/utils.h" #include "test/UnitTest/Test.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { TEST(LlvmLibcUtilsTest, IsPowerOfTwoOrZero) { static const cpp::array kExpectedValues{ @@ -197,4 +197,4 @@ TEST(LlvmLibcUtilsTest, LoadStoreAligned) { } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/src/string/mempcpy_test.cpp b/libc/test/src/string/mempcpy_test.cpp index 5259874d25d600b17cf2bc75b64bb2e38bed650d..43ad5a0f3e1b7e3fdf8bfdfa0c149c7df2c7ff31 100644 --- a/libc/test/src/string/mempcpy_test.cpp +++ b/libc/test/src/string/mempcpy_test.cpp @@ -15,7 +15,7 @@ TEST(LlvmLibcMempcpyTest, Simple) { const char *src = "12345"; char dest[10]; - void *result = __llvm_libc::mempcpy(dest, src, 6); + void *result = LIBC_NAMESPACE::mempcpy(dest, src, 6); ASSERT_EQ(static_cast(result), dest + 6); ASSERT_STREQ(src, dest); } @@ -23,6 +23,6 @@ TEST(LlvmLibcMempcpyTest, Simple) { TEST(LlvmLibcMempcpyTest, ZeroCount) { const char *src = "12345"; char dest[10]; - void *result = __llvm_libc::mempcpy(dest, src, 0); + void *result = LIBC_NAMESPACE::mempcpy(dest, src, 0); ASSERT_EQ(static_cast(result), dest + 0); } diff --git a/libc/test/src/string/memrchr_test.cpp b/libc/test/src/string/memrchr_test.cpp index c8e81ecfbfaa7379a9898960a701f146d9cb1356..421cb9b98516e5d7838eb78ebb17a06fef5ea7b3 100644 --- a/libc/test/src/string/memrchr_test.cpp +++ b/libc/test/src/string/memrchr_test.cpp @@ -13,7 +13,7 @@ // A helper function that calls memrchr and abstracts away the explicit cast for // readability purposes. const char *call_memrchr(const void *src, int c, size_t size) { - return reinterpret_cast(__llvm_libc::memrchr(src, c, size)); + return reinterpret_cast(LIBC_NAMESPACE::memrchr(src, c, size)); } TEST(LlvmLibcMemRChrTest, FindsCharacterAfterNullTerminator) { diff --git a/libc/test/src/string/memset_test.cpp b/libc/test/src/string/memset_test.cpp index 1aa8edd1bc65a1cc1592103dbb1e10cf2606cc21..3a54498498f6b2dfc14180dcee391742d82e76c1 100644 --- a/libc/test/src/string/memset_test.cpp +++ b/libc/test/src/string/memset_test.cpp @@ -10,11 +10,11 @@ #include "src/string/memset.h" #include "test/UnitTest/Test.h" -namespace __llvm_libc { +namespace LIBC_NAMESPACE { // Adapt CheckMemset signature to memset. static inline void Adaptor(cpp::span p1, uint8_t value, size_t size) { - __llvm_libc::memset(p1.begin(), value, size); + LIBC_NAMESPACE::memset(p1.begin(), value, size); } TEST(LlvmLibcMemsetTest, SizeSweep) { @@ -27,4 +27,4 @@ TEST(LlvmLibcMemsetTest, SizeSweep) { } } -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/test/src/string/rindex_test.cpp b/libc/test/src/string/rindex_test.cpp index 1e5969653d5e7075472105fd5ccf2534d76a557f..10513919cffa2da85707de3956d5f7f596a58a2c 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 56e53c12f86593dd3ac9a715259a798c10b7d234..523eaf16d988a8ddd52618b3d1592dfe0cbbd917 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 2448ea5759767ae8bb13c0bda0392cdd52c8f2e6..247fa92a0c7bfa5590003fd1c6c11247684fc72b 100644 --- a/libc/test/src/string/stpncpy_test.cpp +++ b/libc/test/src/string/stpncpy_test.cpp @@ -11,16 +11,16 @@ #include "test/UnitTest/Test.h" #include // For size_t. -class LlvmLibcStpncpyTest : public __llvm_libc::testing::Test { +class LlvmLibcStpncpyTest : public LIBC_NAMESPACE::testing::Test { public: - void check_stpncpy(__llvm_libc::cpp::span dst, - const __llvm_libc::cpp::span src, size_t n, - const __llvm_libc::cpp::span expected, + void check_stpncpy(LIBC_NAMESPACE::cpp::span dst, + const LIBC_NAMESPACE::cpp::span src, size_t n, + const LIBC_NAMESPACE::cpp::span expected, size_t expectedCopied) { // Making sure we don't overflow buffer. ASSERT_GE(dst.size(), n); // Making sure stpncpy returns a pointer to the end of dst. - ASSERT_EQ(__llvm_libc::stpncpy(dst.data(), src.data(), n), + ASSERT_EQ(LIBC_NAMESPACE::stpncpy(dst.data(), src.data(), n), dst.data() + expectedCopied); // Expected must be of the same size as dst. ASSERT_EQ(dst.size(), expected.size()); diff --git a/libc/test/src/string/strcasecmp_test.cpp b/libc/test/src/string/strcasecmp_test.cpp index 2eb16ee76fd8a4cb5d03288858d8ed4ee9caf1d8..df7888168c69e03b998a8e5021829635612f7e58 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 6345ac5e3e1c3d5c89c1ad74fb7b406af7bc71eb..5b8604a1756e435c07b3264f77c48c138bbac49b 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 2fd42123ec79ffc382eacda0fd1fb2f768a5fd07..e4f6c1ee75992e624a5f59dabb06f881cb437b2b 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 684b631a6e9bd2d9e06d5655765b01fc3c33f0ef..6ad83446ab25ae49dfb3c6c59c694bcb4a0f66c1 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 e4ca729db7e678782036a703900bbc1b574badc4..273cf40925d74529cb3f36afd3f78bd503999aea 100644 --- a/libc/test/src/string/strchrnul_test.cpp +++ b/libc/test/src/string/strchrnul_test.cpp @@ -13,7 +13,7 @@ TEST(LlvmLibcStrChrNulTest, FindsFirstCharacter) { const char *src = "abcde"; // Should return original string since 'a' is the first character. - ASSERT_STREQ(__llvm_libc::strchrnul(src, 'a'), "abcde"); + ASSERT_STREQ(LIBC_NAMESPACE::strchrnul(src, 'a'), "abcde"); // Source string should not change. ASSERT_STREQ(src, "abcde"); } @@ -22,7 +22,7 @@ TEST(LlvmLibcStrChrNulTest, FindsMiddleCharacter) { const char *src = "abcde"; // Should return characters after (and including) 'c'. - ASSERT_STREQ(__llvm_libc::strchrnul(src, 'c'), "cde"); + ASSERT_STREQ(LIBC_NAMESPACE::strchrnul(src, 'c'), "cde"); // Source string should not change. ASSERT_STREQ(src, "abcde"); } @@ -31,7 +31,7 @@ TEST(LlvmLibcStrChrNulTest, FindsLastCharacterThatIsNotNullTerminator) { const char *src = "abcde"; // Should return 'e' and null-terminator. - ASSERT_STREQ(__llvm_libc::strchrnul(src, 'e'), "e"); + ASSERT_STREQ(LIBC_NAMESPACE::strchrnul(src, 'e'), "e"); // Source string should not change. ASSERT_STREQ(src, "abcde"); } @@ -40,7 +40,7 @@ TEST(LlvmLibcStrChrNulTest, FindsNullTerminator) { const char *src = "abcde"; // Should return null terminator. - ASSERT_STREQ(__llvm_libc::strchrnul(src, '\0'), ""); + ASSERT_STREQ(LIBC_NAMESPACE::strchrnul(src, '\0'), ""); // Source string should not change. ASSERT_STREQ(src, "abcde"); } @@ -51,7 +51,7 @@ TEST(LlvmLibcStrChrNulTest, // Since 'z' is not within the string, should return a pointer to the source // string's null terminator. - char *result = __llvm_libc::strchrnul(src, 'z'); + char *result = LIBC_NAMESPACE::strchrnul(src, 'z'); ASSERT_EQ(*result, '\0'); char *term = const_cast(src) + 4; @@ -61,36 +61,36 @@ TEST(LlvmLibcStrChrNulTest, TEST(LlvmLibcStrChrNulTest, TheSourceShouldNotChange) { const char *src = "abcde"; // When the character is found, the source string should not change. - __llvm_libc::strchrnul(src, 'd'); + LIBC_NAMESPACE::strchrnul(src, 'd'); ASSERT_STREQ(src, "abcde"); // Same case for when the character is not found. - __llvm_libc::strchrnul(src, 'z'); + LIBC_NAMESPACE::strchrnul(src, 'z'); ASSERT_STREQ(src, "abcde"); // Same case for when looking for null terminator. - __llvm_libc::strchrnul(src, '\0'); + LIBC_NAMESPACE::strchrnul(src, '\0'); ASSERT_STREQ(src, "abcde"); } TEST(LlvmLibcStrChrNulTest, ShouldFindFirstOfDuplicates) { // '1' is duplicated in the string, but it should find the first copy. - ASSERT_STREQ(__llvm_libc::strchrnul("abc1def1ghi", '1'), "1def1ghi"); + ASSERT_STREQ(LIBC_NAMESPACE::strchrnul("abc1def1ghi", '1'), "1def1ghi"); const char *dups = "XXXXX"; // Should return original string since 'X' is the first character. - ASSERT_STREQ(__llvm_libc::strchrnul(dups, 'X'), dups); + ASSERT_STREQ(LIBC_NAMESPACE::strchrnul(dups, 'X'), dups); } TEST(LlvmLibcStrChrNulTest, EmptyStringShouldOnlyMatchNullTerminator) { // Null terminator should match. - ASSERT_STREQ(__llvm_libc::strchrnul("", '\0'), ""); + ASSERT_STREQ(LIBC_NAMESPACE::strchrnul("", '\0'), ""); // All other characters should not match. - char *result = __llvm_libc::strchrnul("", 'Z'); + char *result = LIBC_NAMESPACE::strchrnul("", 'Z'); ASSERT_EQ(*result, '\0'); - result = __llvm_libc::strchrnul("", '3'); + result = LIBC_NAMESPACE::strchrnul("", '3'); ASSERT_EQ(*result, '\0'); - result = __llvm_libc::strchrnul("", '*'); + result = LIBC_NAMESPACE::strchrnul("", '*'); ASSERT_EQ(*result, '\0'); } diff --git a/libc/test/src/string/strcmp_test.cpp b/libc/test/src/string/strcmp_test.cpp index 78dd8c1a8d4e724ce91f0d79296661e0f6900550..ef58dc608c83b0d96fc4c3719b6c695d29274f59 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 256c3c7bd281a1abcd8ee046a2b68ea17cc5522b..a10f98f1ca4d6aead025225fd7f5462683377ff3 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 7508b56e23db28df507f7d03d939f4ba9d149ab6..1a1227aac5d2f80ca3e94cd31c26cfcb3befec02 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 2f3565c78f6b34e7b0bcbbeaf6c9975dae25a153..d83b3cf4fdfe8c8e5cc7abbea8984efba40f5ec6 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 ee46882233dd37aea2c8047cda5d32328c2784ab..b1d4df31603c4b211eb5a546fa37411a018d3f1c 100644 --- a/libc/test/src/string/strdup_test.cpp +++ b/libc/test/src/string/strdup_test.cpp @@ -16,7 +16,7 @@ TEST(LlvmLibcStrDupTest, EmptyString) { const char *empty = ""; libc_errno = 0; - char *result = __llvm_libc::strdup(empty); + char *result = LIBC_NAMESPACE::strdup(empty); ASSERT_EQ(libc_errno, 0); ASSERT_NE(result, static_cast(nullptr)); @@ -29,7 +29,7 @@ TEST(LlvmLibcStrDupTest, AnyString) { const char *abc = "abc"; libc_errno = 0; - char *result = __llvm_libc::strdup(abc); + char *result = LIBC_NAMESPACE::strdup(abc); ASSERT_EQ(libc_errno, 0); ASSERT_NE(result, static_cast(nullptr)); @@ -40,7 +40,7 @@ TEST(LlvmLibcStrDupTest, AnyString) { TEST(LlvmLibcStrDupTest, NullPtr) { libc_errno = 0; - char *result = __llvm_libc::strdup(nullptr); + char *result = LIBC_NAMESPACE::strdup(nullptr); ASSERT_EQ(libc_errno, 0); ASSERT_EQ(result, static_cast(nullptr)); diff --git a/libc/test/src/string/strerror_r_test.cpp b/libc/test/src/string/strerror_r_test.cpp index 6ac3cdf480851870a5b67bafb347fc1fe9786133..868362edd84b1136b212bef260fd2e7b814ed461 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 20a8fba6f30fbe6daf41140e69543357735e8d77..ec9827b75cfc8286c3685a2f17361c6f4cb7949c 100644 --- a/libc/test/src/string/strerror_test.cpp +++ b/libc/test/src/string/strerror_test.cpp @@ -10,7 +10,7 @@ #include "test/UnitTest/Test.h" TEST(LlvmLibcStrErrorTest, KnownErrors) { - ASSERT_STREQ(__llvm_libc::strerror(0), "Success"); + ASSERT_STREQ(LIBC_NAMESPACE::strerror(0), "Success"); const char *message_array[] = { "Success", @@ -150,13 +150,16 @@ TEST(LlvmLibcStrErrorTest, KnownErrors) { }; for (size_t i = 0; i < (sizeof(message_array) / sizeof(char *)); ++i) { - EXPECT_STREQ(__llvm_libc::strerror(static_cast(i)), message_array[i]); + EXPECT_STREQ(LIBC_NAMESPACE::strerror(static_cast(i)), + message_array[i]); } } TEST(LlvmLibcStrErrorTest, UnknownErrors) { - ASSERT_STREQ(__llvm_libc::strerror(-1), "Unknown error -1"); - ASSERT_STREQ(__llvm_libc::strerror(134), "Unknown error 134"); - ASSERT_STREQ(__llvm_libc::strerror(2147483647), "Unknown error 2147483647"); - ASSERT_STREQ(__llvm_libc::strerror(-2147483648), "Unknown error -2147483648"); + ASSERT_STREQ(LIBC_NAMESPACE::strerror(-1), "Unknown error -1"); + ASSERT_STREQ(LIBC_NAMESPACE::strerror(134), "Unknown error 134"); + ASSERT_STREQ(LIBC_NAMESPACE::strerror(2147483647), + "Unknown error 2147483647"); + ASSERT_STREQ(LIBC_NAMESPACE::strerror(-2147483648), + "Unknown error -2147483648"); } diff --git a/libc/test/src/string/strlcat_test.cpp b/libc/test/src/string/strlcat_test.cpp index 50c4b2e33897d802d7221da3066c0e2f3c21fc58..1ffa4b0e921e2b5d4bb1847d7dabe8fa8d5b3946 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 41e244b239d06740229a386d02df8b00d11d7442..5a1e30c12963f36ac2cc3db5b8c393ba7fe43fbf 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 41b5fbede0fd06dea4c83812bd8f50697479f9e9..4eb9d47e9209ddc08270cd281ac97d76d165f4d2 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 cf6284318cf7efa3e0b9e535542b2afd02fb5388..b4173c455de91b8f1b19f63037e4f4718c7fe3cc 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 146922194eba2afe3dba4a6d69efa98fe4206cff..9b52788d93d1203c570f015547c732881958e2dc 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 b3971f6b95a2800757c6f52b2d5cc628422a09ec..1724a5436d1ea336a036400452009b2419c4f9d7 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 69265f82183b599a1f04de1e14748dddb09bb0cd..b71ed66f5c6a8354a84fb8308111698e681e3a14 100644 --- a/libc/test/src/string/strncpy_test.cpp +++ b/libc/test/src/string/strncpy_test.cpp @@ -11,15 +11,15 @@ #include "test/UnitTest/Test.h" #include // For size_t. -class LlvmLibcStrncpyTest : public __llvm_libc::testing::Test { +class LlvmLibcStrncpyTest : public LIBC_NAMESPACE::testing::Test { public: - void check_strncpy(__llvm_libc::cpp::span dst, - const __llvm_libc::cpp::span src, size_t n, - const __llvm_libc::cpp::span expected) { + void check_strncpy(LIBC_NAMESPACE::cpp::span dst, + const LIBC_NAMESPACE::cpp::span src, size_t n, + const LIBC_NAMESPACE::cpp::span expected) { // Making sure we don't overflow buffer. ASSERT_GE(dst.size(), n); // Making sure strncpy returns dst. - ASSERT_EQ(__llvm_libc::strncpy(dst.data(), src.data(), n), dst.data()); + ASSERT_EQ(LIBC_NAMESPACE::strncpy(dst.data(), src.data(), n), dst.data()); // Expected must be of the same size as dst. ASSERT_EQ(dst.size(), expected.size()); // Expected and dst are the same. diff --git a/libc/test/src/string/strndup_test.cpp b/libc/test/src/string/strndup_test.cpp index 53cdd368fb42af072c0f9146eba26d02f5806e87..3adcd9bacffdb22e05e7e53bd184f7772ff22313 100644 --- a/libc/test/src/string/strndup_test.cpp +++ b/libc/test/src/string/strndup_test.cpp @@ -13,7 +13,7 @@ TEST(LlvmLibcstrndupTest, EmptyString) { const char *empty = ""; - char *result = __llvm_libc::strndup(empty, 1); + char *result = LIBC_NAMESPACE::strndup(empty, 1); ASSERT_NE(result, static_cast(nullptr)); ASSERT_NE(empty, const_cast(result)); ASSERT_STREQ(empty, result); @@ -23,21 +23,21 @@ TEST(LlvmLibcstrndupTest, EmptyString) { TEST(LlvmLibcstrndupTest, AnyString) { const char *abc = "abc"; - char *result = __llvm_libc::strndup(abc, 3); + char *result = LIBC_NAMESPACE::strndup(abc, 3); ASSERT_NE(result, static_cast(nullptr)); ASSERT_NE(abc, const_cast(result)); ASSERT_STREQ(abc, result); ::free(result); - result = __llvm_libc::strndup(abc, 1); + result = LIBC_NAMESPACE::strndup(abc, 1); ASSERT_NE(result, static_cast(nullptr)); ASSERT_NE(abc, const_cast(result)); ASSERT_STREQ("a", result); ::free(result); - result = __llvm_libc::strndup(abc, 10); + result = LIBC_NAMESPACE::strndup(abc, 10); ASSERT_NE(result, static_cast(nullptr)); ASSERT_NE(abc, const_cast(result)); @@ -46,7 +46,7 @@ TEST(LlvmLibcstrndupTest, AnyString) { } TEST(LlvmLibcstrndupTest, NullPtr) { - char *result = __llvm_libc::strndup(nullptr, 0); + char *result = LIBC_NAMESPACE::strndup(nullptr, 0); ASSERT_EQ(result, static_cast(nullptr)); } diff --git a/libc/test/src/string/strnlen_test.cpp b/libc/test/src/string/strnlen_test.cpp index e260cd65e878e9bfd48b407930c797ca186cd220..bd1002c0ae0784090c8db88dfa9da237d54fa1f8 100644 --- a/libc/test/src/string/strnlen_test.cpp +++ b/libc/test/src/string/strnlen_test.cpp @@ -12,35 +12,35 @@ TEST(LlvmLibcStrNLenTest, EmptyString) { const char *empty = ""; - ASSERT_EQ(static_cast(0), __llvm_libc::strnlen(empty, 0)); + ASSERT_EQ(static_cast(0), LIBC_NAMESPACE::strnlen(empty, 0)); // If N is greater than string length, this should still return 0. - ASSERT_EQ(static_cast(0), __llvm_libc::strnlen(empty, 1)); + ASSERT_EQ(static_cast(0), LIBC_NAMESPACE::strnlen(empty, 1)); } TEST(LlvmLibcStrNLenTest, OneCharacterString) { const char *single = "X"; - ASSERT_EQ(static_cast(1), __llvm_libc::strnlen(single, 1)); + ASSERT_EQ(static_cast(1), LIBC_NAMESPACE::strnlen(single, 1)); // If N is zero, this should return 0. - ASSERT_EQ(static_cast(0), __llvm_libc::strnlen(single, 0)); + ASSERT_EQ(static_cast(0), LIBC_NAMESPACE::strnlen(single, 0)); // If N is greater than string length, this should still return 1. - ASSERT_EQ(static_cast(1), __llvm_libc::strnlen(single, 2)); + ASSERT_EQ(static_cast(1), LIBC_NAMESPACE::strnlen(single, 2)); } TEST(LlvmLibcStrNLenTest, ManyCharacterString) { const char *many = "123456789"; - ASSERT_EQ(static_cast(9), __llvm_libc::strnlen(many, 9)); + ASSERT_EQ(static_cast(9), LIBC_NAMESPACE::strnlen(many, 9)); // If N is smaller than the string length, it should return N. - ASSERT_EQ(static_cast(3), __llvm_libc::strnlen(many, 3)); + ASSERT_EQ(static_cast(3), LIBC_NAMESPACE::strnlen(many, 3)); // If N is zero, this should return 0. - ASSERT_EQ(static_cast(0), __llvm_libc::strnlen(many, 0)); + ASSERT_EQ(static_cast(0), LIBC_NAMESPACE::strnlen(many, 0)); // If N is greater than the string length, this should still return 9. - ASSERT_EQ(static_cast(9), __llvm_libc::strnlen(many, 42)); + ASSERT_EQ(static_cast(9), LIBC_NAMESPACE::strnlen(many, 42)); } TEST(LlvmLibcStrNLenTest, CharactersAfterNullTerminatorShouldNotBeIncluded) { const char str[5] = {'a', 'b', 'c', '\0', 'd'}; - ASSERT_EQ(static_cast(3), __llvm_libc::strnlen(str, 3)); + ASSERT_EQ(static_cast(3), LIBC_NAMESPACE::strnlen(str, 3)); // This should only read up to the null terminator. - ASSERT_EQ(static_cast(3), __llvm_libc::strnlen(str, 4)); - ASSERT_EQ(static_cast(3), __llvm_libc::strnlen(str, 5)); + ASSERT_EQ(static_cast(3), LIBC_NAMESPACE::strnlen(str, 4)); + ASSERT_EQ(static_cast(3), LIBC_NAMESPACE::strnlen(str, 5)); } diff --git a/libc/test/src/string/strpbrk_test.cpp b/libc/test/src/string/strpbrk_test.cpp index fe10f87930593ef81a6acba09bade5840cf70b73..fbe14da12ac10e071ba7dd4b0f3911d32f3c6a93 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 02659c010ada14c57a48685a204d7ba5e141e1d4..e415eddaeca0de06828bd0d605ded10244639b8b 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 7c0863b3266f5cbf9908cc4fd8e1f9586f51fa31..0daa29f6a7ad59ff5ae224463653d44cf47991c3 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 aa55230d5286b858b2a92243a4b0d678ca7c2697..48b5d17f85c46596a5a19e3041e60e3e71bf6fbd 100644 --- a/libc/test/src/string/strsignal_test.cpp +++ b/libc/test/src/string/strsignal_test.cpp @@ -12,7 +12,7 @@ #include TEST(LlvmLibcStrSignalTest, KnownSignals) { - ASSERT_STREQ(__llvm_libc::strsignal(1), "Hangup"); + ASSERT_STREQ(LIBC_NAMESPACE::strsignal(1), "Hangup"); const char *message_array[] = { "Unknown signal 0", // unknown @@ -67,18 +67,20 @@ TEST(LlvmLibcStrSignalTest, KnownSignals) { for (size_t i = 0; i < (sizeof(message_array) / sizeof(char *)); ++i) { ASSERT_EQ(static_cast(static_cast(i)), i); - EXPECT_STREQ(__llvm_libc::strsignal(static_cast(i)), message_array[i]); + EXPECT_STREQ(LIBC_NAMESPACE::strsignal(static_cast(i)), + message_array[i]); } for (int i = 0; i < SIGRTMAX - SIGRTMIN; ++i) { - EXPECT_STREQ(__llvm_libc::strsignal(i + SIGRTMIN), rt_message_array[i]); + EXPECT_STREQ(LIBC_NAMESPACE::strsignal(i + SIGRTMIN), rt_message_array[i]); } } TEST(LlvmLibcStrsignalTest, UnknownSignals) { - ASSERT_STREQ(__llvm_libc::strsignal(-1), "Unknown signal -1"); - ASSERT_STREQ(__llvm_libc::strsignal(65), "Unknown signal 65"); - ASSERT_STREQ(__llvm_libc::strsignal(2147483647), "Unknown signal 2147483647"); - ASSERT_STREQ(__llvm_libc::strsignal(-2147483648), + ASSERT_STREQ(LIBC_NAMESPACE::strsignal(-1), "Unknown signal -1"); + ASSERT_STREQ(LIBC_NAMESPACE::strsignal(65), "Unknown signal 65"); + ASSERT_STREQ(LIBC_NAMESPACE::strsignal(2147483647), + "Unknown signal 2147483647"); + ASSERT_STREQ(LIBC_NAMESPACE::strsignal(-2147483648), "Unknown signal -2147483648"); } diff --git a/libc/test/src/string/strspn_test.cpp b/libc/test/src/string/strspn_test.cpp index d5276091d753166676fb9b1873c730bef82cf121..cdd12af07ee7da96bc2a108b1bd39b76968a7738 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 2008d1c42e94e017e423eb16b4e18053a7de157d..3de138cae28bd2cc34dc16c39251e3fafbeedae4 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 fa436e0116b37ec6305ce32098faa4d0cd375ed1..fdc27bae23c975781d5518f4ce3018b718e1f046 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 24033c41244357db4c67f1f92dfea74230c1af88..b82065309e00c65dbc72049acaf683c8c5010fe3 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 0512556d74c291888969248ee94639db3d6cf266..b704dbf6052fcbb2aabcec7ccf907eef5ad63c26 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 4fdb4a2f2fde36688ca365b686cc9672ee4b43af..83c73f5454de1bc4ec50f9ababd87f8f44cf5f06 100644 --- a/libc/test/src/sys/mman/linux/madvise_test.cpp +++ b/libc/test/src/sys/mman/linux/madvise_test.cpp @@ -15,28 +15,30 @@ #include -using __llvm_libc::testing::ErrnoSetterMatcher::Fails; -using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; TEST(LlvmLibcMadviseTest, NoError) { size_t alloc_size = 128; libc_errno = 0; - void *addr = __llvm_libc::mmap(nullptr, alloc_size, PROT_READ, - MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); + void *addr = LIBC_NAMESPACE::mmap(nullptr, alloc_size, PROT_READ, + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); EXPECT_EQ(0, libc_errno); EXPECT_NE(addr, MAP_FAILED); - EXPECT_THAT(__llvm_libc::madvise(addr, alloc_size, MADV_RANDOM), Succeeds()); + EXPECT_THAT(LIBC_NAMESPACE::madvise(addr, alloc_size, MADV_RANDOM), + Succeeds()); int *array = reinterpret_cast(addr); // Reading from the memory should not crash the test. // Since we used the MAP_ANONYMOUS flag, the contents of the newly // allocated memory should be initialized to zero. EXPECT_EQ(array[0], 0); - EXPECT_THAT(__llvm_libc::munmap(addr, alloc_size), Succeeds()); + EXPECT_THAT(LIBC_NAMESPACE::munmap(addr, alloc_size), Succeeds()); } TEST(LlvmLibcMadviseTest, Error_BadPtr) { libc_errno = 0; - EXPECT_THAT(__llvm_libc::madvise(nullptr, 8, MADV_SEQUENTIAL), Fails(ENOMEM)); + EXPECT_THAT(LIBC_NAMESPACE::madvise(nullptr, 8, MADV_SEQUENTIAL), + Fails(ENOMEM)); } diff --git a/libc/test/src/sys/mman/linux/mmap_test.cpp b/libc/test/src/sys/mman/linux/mmap_test.cpp index d74701c5e59c97196206572685b30a0722690604..9b13b8bd8057f232fc5c71e4282915b9c7e8fcf2 100644 --- a/libc/test/src/sys/mman/linux/mmap_test.cpp +++ b/libc/test/src/sys/mman/linux/mmap_test.cpp @@ -14,14 +14,14 @@ #include -using __llvm_libc::testing::ErrnoSetterMatcher::Fails; -using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; TEST(LlvmLibcMMapTest, NoError) { size_t alloc_size = 128; libc_errno = 0; - void *addr = __llvm_libc::mmap(nullptr, alloc_size, PROT_READ, - MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); + void *addr = LIBC_NAMESPACE::mmap(nullptr, alloc_size, PROT_READ, + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); EXPECT_EQ(0, libc_errno); EXPECT_NE(addr, MAP_FAILED); @@ -30,14 +30,14 @@ TEST(LlvmLibcMMapTest, NoError) { // Since we used the MAP_ANONYMOUS flag, the contents of the newly // allocated memory should be initialized to zero. EXPECT_EQ(array[0], 0); - EXPECT_THAT(__llvm_libc::munmap(addr, alloc_size), Succeeds()); + EXPECT_THAT(LIBC_NAMESPACE::munmap(addr, alloc_size), Succeeds()); } TEST(LlvmLibcMMapTest, Error_InvalidSize) { libc_errno = 0; - void *addr = __llvm_libc::mmap(nullptr, 0, PROT_READ, - MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); + void *addr = LIBC_NAMESPACE::mmap(nullptr, 0, PROT_READ, + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); EXPECT_THAT(addr, Fails(EINVAL, MAP_FAILED)); - EXPECT_THAT(__llvm_libc::munmap(0, 0), Fails(EINVAL)); + EXPECT_THAT(LIBC_NAMESPACE::munmap(0, 0), Fails(EINVAL)); } diff --git a/libc/test/src/sys/mman/linux/mprotect_test.cpp b/libc/test/src/sys/mman/linux/mprotect_test.cpp index 5f2f5f27ce04189263be2cb51bdee4870366d115..7127f77714d6421ce04cb0cdb812cc4fbc989c76 100644 --- a/libc/test/src/sys/mman/linux/mprotect_test.cpp +++ b/libc/test/src/sys/mman/linux/mprotect_test.cpp @@ -16,14 +16,14 @@ #include #include -using __llvm_libc::testing::ErrnoSetterMatcher::Fails; -using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; TEST(LlvmLibcMProtectTest, NoError) { size_t alloc_size = 128; libc_errno = 0; - void *addr = __llvm_libc::mmap(nullptr, alloc_size, PROT_READ, - MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); + void *addr = LIBC_NAMESPACE::mmap(nullptr, alloc_size, PROT_READ, + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); EXPECT_EQ(0, libc_errno); EXPECT_NE(addr, MAP_FAILED); @@ -35,12 +35,13 @@ TEST(LlvmLibcMProtectTest, NoError) { // By setting the memory protection to read and write, we should be able to // modify that memory. - EXPECT_THAT(__llvm_libc::mprotect(addr, alloc_size, PROT_READ | PROT_WRITE), - Succeeds()); + EXPECT_THAT( + LIBC_NAMESPACE::mprotect(addr, alloc_size, PROT_READ | PROT_WRITE), + Succeeds()); array[0] = 1; EXPECT_EQ(array[0], 1); - EXPECT_THAT(__llvm_libc::munmap(addr, alloc_size), Succeeds()); + EXPECT_THAT(LIBC_NAMESPACE::munmap(addr, alloc_size), Succeeds()); } // This test is disabled currently due to flakeyness. It will be re-enabled once @@ -53,9 +54,9 @@ TEST(LlvmLibcMProtectTest, Error_InvalidWrite) { [] { size_t alloc_size = 128; void *addr = - __llvm_libc::mmap(nullptr, alloc_size, PROT_READ | PROT_WRITE, + LIBC_NAMESPACE::mmap(nullptr, alloc_size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); - __llvm_libc::mprotect(addr, alloc_size, PROT_READ); + LIBC_NAMESPACE::mprotect(addr, alloc_size, PROT_READ); (reinterpret_cast(addr))[0] = 'A'; }, diff --git a/libc/test/src/sys/mman/linux/posix_madvise_test.cpp b/libc/test/src/sys/mman/linux/posix_madvise_test.cpp index b271a7185d000c49121ab29331b8a32f623ea975..59cf01ac746959d6f4c41c8e6a76738b4aa3d048 100644 --- a/libc/test/src/sys/mman/linux/posix_madvise_test.cpp +++ b/libc/test/src/sys/mman/linux/posix_madvise_test.cpp @@ -15,35 +15,36 @@ #include -using __llvm_libc::testing::ErrnoSetterMatcher::Fails; -using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; TEST(LlvmLibcPosixMadviseTest, NoError) { size_t alloc_size = 128; libc_errno = 0; - void *addr = __llvm_libc::mmap(nullptr, alloc_size, PROT_READ, - MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); + void *addr = LIBC_NAMESPACE::mmap(nullptr, alloc_size, PROT_READ, + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); EXPECT_EQ(0, libc_errno); EXPECT_NE(addr, MAP_FAILED); - EXPECT_EQ(__llvm_libc::posix_madvise(addr, alloc_size, POSIX_MADV_RANDOM), 0); + EXPECT_EQ(LIBC_NAMESPACE::posix_madvise(addr, alloc_size, POSIX_MADV_RANDOM), + 0); int *array = reinterpret_cast(addr); // Reading from the memory should not crash the test. // Since we used the MAP_ANONYMOUS flag, the contents of the newly // allocated memory should be initialized to zero. EXPECT_EQ(array[0], 0); - EXPECT_THAT(__llvm_libc::munmap(addr, alloc_size), Succeeds()); + EXPECT_THAT(LIBC_NAMESPACE::munmap(addr, alloc_size), Succeeds()); } TEST(LlvmLibcPosixMadviseTest, Error_BadPtr) { libc_errno = 0; // posix_madvise is a no-op on DONTNEED, so it shouldn't fail even with the // nullptr. - EXPECT_EQ(__llvm_libc::posix_madvise(nullptr, 8, POSIX_MADV_DONTNEED), 0); + EXPECT_EQ(LIBC_NAMESPACE::posix_madvise(nullptr, 8, POSIX_MADV_DONTNEED), 0); // posix_madvise doesn't set errno, but the return value is actually the error // code. - EXPECT_EQ(__llvm_libc::posix_madvise(nullptr, 8, POSIX_MADV_SEQUENTIAL), + EXPECT_EQ(LIBC_NAMESPACE::posix_madvise(nullptr, 8, POSIX_MADV_SEQUENTIAL), ENOMEM); } diff --git a/libc/test/src/sys/random/linux/getrandom_test.cpp b/libc/test/src/sys/random/linux/getrandom_test.cpp index 839297bc32a618abe1bba9b52800d4ad80238496..5a595afb0cdaa7a211379f155c197f5539bad597 100644 --- a/libc/test/src/sys/random/linux/getrandom_test.cpp +++ b/libc/test/src/sys/random/linux/getrandom_test.cpp @@ -14,23 +14,23 @@ #include "test/UnitTest/Test.h" TEST(LlvmLibcGetRandomTest, InvalidFlag) { - __llvm_libc::cpp::array buffer; + LIBC_NAMESPACE::cpp::array buffer; libc_errno = 0; - ASSERT_THAT(__llvm_libc::getrandom(buffer.data(), buffer.size(), -1), - __llvm_libc::testing::ErrnoSetterMatcher::Fails(EINVAL)); + ASSERT_THAT(LIBC_NAMESPACE::getrandom(buffer.data(), buffer.size(), -1), + LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails(EINVAL)); } TEST(LlvmLibcGetRandomTest, InvalidBuffer) { libc_errno = 0; - ASSERT_THAT(__llvm_libc::getrandom(nullptr, 65536, 0), - __llvm_libc::testing::ErrnoSetterMatcher::Fails(EFAULT)); + ASSERT_THAT(LIBC_NAMESPACE::getrandom(nullptr, 65536, 0), + LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails(EFAULT)); } TEST(LlvmLibcGetRandomTest, ReturnsSize) { - __llvm_libc::cpp::array buffer; + LIBC_NAMESPACE::cpp::array buffer; for (size_t i = 0; i < buffer.size(); ++i) { // Without GRND_RANDOM set this should never fail. - ASSERT_EQ(__llvm_libc::getrandom(buffer.data(), i, 0), + ASSERT_EQ(LIBC_NAMESPACE::getrandom(buffer.data(), i, 0), static_cast(i)); } } @@ -38,12 +38,12 @@ TEST(LlvmLibcGetRandomTest, ReturnsSize) { TEST(LlvmLibcGetRandomTest, CheckValue) { // Probability of picking one particular value amongst 256 possibilities a // hundred times in a row is (1/256)^100 = 1.49969681e-241. - __llvm_libc::cpp::array buffer; + LIBC_NAMESPACE::cpp::array buffer; for (char &c : buffer) c = 0; - __llvm_libc::getrandom(buffer.data(), buffer.size(), 0); + LIBC_NAMESPACE::getrandom(buffer.data(), buffer.size(), 0); bool all_zeros = true; for (char c : buffer) diff --git a/libc/test/src/sys/resource/getrlimit_setrlimit_test.cpp b/libc/test/src/sys/resource/getrlimit_setrlimit_test.cpp index b385cf86ce978392f7c6a6ab38a44bf5a190a68d..7e6bb0aaca92518f0f465c9df7174b2f28d16909 100644 --- a/libc/test/src/sys/resource/getrlimit_setrlimit_test.cpp +++ b/libc/test/src/sys/resource/getrlimit_setrlimit_test.cpp @@ -19,8 +19,8 @@ #include TEST(LlvmLibcResourceLimitsTest, SetNoFileLimit) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; // The test strategy is to first create initialize two file descriptors // successfully. Next, close the files and set the file descriptor limit @@ -30,47 +30,47 @@ TEST(LlvmLibcResourceLimitsTest, SetNoFileLimit) { constexpr const char *TEST_FILE2 = "testdata/resource_limits2.test"; libc_errno = 0; - int fd1 = __llvm_libc::open(TEST_FILE1, O_CREAT | O_WRONLY, S_IRWXU); + int fd1 = LIBC_NAMESPACE::open(TEST_FILE1, O_CREAT | O_WRONLY, S_IRWXU); ASSERT_GT(fd1, 0); ASSERT_EQ(libc_errno, 0); - int fd2 = __llvm_libc::open(TEST_FILE2, O_CREAT | O_WRONLY, S_IRWXU); + int fd2 = LIBC_NAMESPACE::open(TEST_FILE2, O_CREAT | O_WRONLY, S_IRWXU); ASSERT_GT(fd2, 0); ASSERT_EQ(libc_errno, 0); - ASSERT_THAT(__llvm_libc::close(fd1), Succeeds(0)); - ASSERT_THAT(__llvm_libc::close(fd2), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(fd1), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(fd2), Succeeds(0)); struct rlimit limits { 4, 4 }; - ASSERT_THAT(__llvm_libc::setrlimit(RLIMIT_NOFILE, &limits), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::setrlimit(RLIMIT_NOFILE, &limits), Succeeds(0)); // One can now only open one of the files successfully. - fd1 = __llvm_libc::open(TEST_FILE1, O_RDONLY); + fd1 = LIBC_NAMESPACE::open(TEST_FILE1, O_RDONLY); ASSERT_GT(fd1, 0); ASSERT_EQ(libc_errno, 0); - fd2 = __llvm_libc::open(TEST_FILE2, O_RDONLY); + fd2 = LIBC_NAMESPACE::open(TEST_FILE2, O_RDONLY); ASSERT_LT(fd2, 0); ASSERT_NE(libc_errno, 0); libc_errno = 0; - ASSERT_THAT(__llvm_libc::close(fd1), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(fd1), Succeeds(0)); - fd2 = __llvm_libc::open(TEST_FILE2, O_RDONLY); + fd2 = LIBC_NAMESPACE::open(TEST_FILE2, O_RDONLY); ASSERT_GT(fd2, 0); ASSERT_EQ(libc_errno, 0); - fd1 = __llvm_libc::open(TEST_FILE1, O_RDONLY); + fd1 = LIBC_NAMESPACE::open(TEST_FILE1, O_RDONLY); ASSERT_LT(fd1, 0); ASSERT_NE(libc_errno, 0); libc_errno = 0; - ASSERT_THAT(__llvm_libc::close(fd2), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(fd2), Succeeds(0)); - ASSERT_THAT(__llvm_libc::unlink(TEST_FILE1), Succeeds(0)); - ASSERT_THAT(__llvm_libc::unlink(TEST_FILE2), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE1), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE2), Succeeds(0)); struct rlimit current_limits; - ASSERT_THAT(__llvm_libc::getrlimit(RLIMIT_NOFILE, ¤t_limits), + ASSERT_THAT(LIBC_NAMESPACE::getrlimit(RLIMIT_NOFILE, ¤t_limits), Succeeds(0)); ASSERT_EQ(current_limits.rlim_cur, rlim_t(4)); ASSERT_EQ(current_limits.rlim_max, rlim_t(4)); diff --git a/libc/test/src/sys/select/select_failure_test.cpp b/libc/test/src/sys/select/select_failure_test.cpp index 44d5b2e14c012822997e31de84bd4bd89f3e9099..61df532b3e96ccc1e23e21d2657575436df2ca2d 100644 --- a/libc/test/src/sys/select/select_failure_test.cpp +++ b/libc/test/src/sys/select/select_failure_test.cpp @@ -15,7 +15,7 @@ #include #include -using __llvm_libc::testing::ErrnoSetterMatcher::Fails; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; TEST(LlvmLibcSelectTest, SelectInvalidFD) { fd_set set; @@ -23,6 +23,6 @@ TEST(LlvmLibcSelectTest, SelectInvalidFD) { struct timeval timeout { 0, 0 }; - ASSERT_THAT(__llvm_libc::select(-1, &set, nullptr, nullptr, &timeout), + ASSERT_THAT(LIBC_NAMESPACE::select(-1, &set, nullptr, nullptr, &timeout), Fails(EINVAL)); } diff --git a/libc/test/src/sys/select/select_ui_test.cpp b/libc/test/src/sys/select/select_ui_test.cpp index e10d1aa17096013a21bbf5bc03051281d99d9996..2e6baced801b106b1aa7d8d785a932f41be11451 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 9af01ad6337471fb3a965e6e1615e39117be1266..6e4665a1bb96b10dfe8e5e949ce99caa94f8b746 100644 --- a/libc/test/src/sys/sendfile/sendfile_test.cpp +++ b/libc/test/src/sys/sendfile/sendfile_test.cpp @@ -20,11 +20,11 @@ #include #include -namespace cpp = __llvm_libc::cpp; +namespace cpp = LIBC_NAMESPACE::cpp; TEST(LlvmLibcSendfileTest, CreateAndTransfer) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; // The test strategy is to // 1. Create a temporary file with known data. @@ -37,30 +37,30 @@ TEST(LlvmLibcSendfileTest, CreateAndTransfer) { constexpr ssize_t IN_SIZE = ssize_t(sizeof(IN_DATA)); libc_errno = 0; - int in_fd = __llvm_libc::open(IN_FILE, O_CREAT | O_WRONLY, S_IRWXU); + int in_fd = LIBC_NAMESPACE::open(IN_FILE, O_CREAT | O_WRONLY, S_IRWXU); ASSERT_GT(in_fd, 0); ASSERT_EQ(libc_errno, 0); - ASSERT_EQ(__llvm_libc::write(in_fd, IN_DATA, IN_SIZE), IN_SIZE); - ASSERT_THAT(__llvm_libc::close(in_fd), Succeeds(0)); + ASSERT_EQ(LIBC_NAMESPACE::write(in_fd, IN_DATA, IN_SIZE), IN_SIZE); + ASSERT_THAT(LIBC_NAMESPACE::close(in_fd), Succeeds(0)); - in_fd = __llvm_libc::open(IN_FILE, O_RDONLY); + in_fd = LIBC_NAMESPACE::open(IN_FILE, O_RDONLY); ASSERT_GT(in_fd, 0); ASSERT_EQ(libc_errno, 0); - int out_fd = __llvm_libc::open(OUT_FILE, O_CREAT | O_WRONLY, S_IRWXU); + int out_fd = LIBC_NAMESPACE::open(OUT_FILE, O_CREAT | O_WRONLY, S_IRWXU); ASSERT_GT(out_fd, 0); ASSERT_EQ(libc_errno, 0); - ssize_t size = __llvm_libc::sendfile(in_fd, out_fd, nullptr, IN_SIZE); + ssize_t size = LIBC_NAMESPACE::sendfile(in_fd, out_fd, nullptr, IN_SIZE); ASSERT_EQ(size, IN_SIZE); - ASSERT_THAT(__llvm_libc::close(in_fd), Succeeds(0)); - ASSERT_THAT(__llvm_libc::close(out_fd), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(in_fd), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(out_fd), Succeeds(0)); - out_fd = __llvm_libc::open(OUT_FILE, O_RDONLY); + out_fd = LIBC_NAMESPACE::open(OUT_FILE, O_RDONLY); ASSERT_GT(out_fd, 0); ASSERT_EQ(libc_errno, 0); char buf[IN_SIZE]; - ASSERT_EQ(IN_SIZE, __llvm_libc::read(out_fd, buf, IN_SIZE)); + ASSERT_EQ(IN_SIZE, LIBC_NAMESPACE::read(out_fd, buf, IN_SIZE)); ASSERT_EQ(cpp::string_view(buf), cpp::string_view(IN_DATA)); - ASSERT_THAT(__llvm_libc::unlink(IN_FILE), Succeeds(0)); - ASSERT_THAT(__llvm_libc::unlink(OUT_FILE), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::unlink(IN_FILE), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::unlink(OUT_FILE), Succeeds(0)); } diff --git a/libc/test/src/sys/socket/linux/socket_test.cpp b/libc/test/src/sys/socket/linux/socket_test.cpp index 6826594e52d7b25ad313684fd4c840d18c48bf9e..9037888441a357f674db0a40843e1e9d94a2205f 100644 --- a/libc/test/src/sys/socket/linux/socket_test.cpp +++ b/libc/test/src/sys/socket/linux/socket_test.cpp @@ -16,9 +16,9 @@ #include // For AF_LOCAL and SOCK_DGRAM TEST(LlvmLibcSocketTest, LocalSocket) { - int sock = __llvm_libc::socket(AF_LOCAL, SOCK_DGRAM, 0); + int sock = LIBC_NAMESPACE::socket(AF_LOCAL, SOCK_DGRAM, 0); ASSERT_GE(sock, 0); ASSERT_EQ(libc_errno, 0); - __llvm_libc::close(sock); + LIBC_NAMESPACE::close(sock); } diff --git a/libc/test/src/sys/stat/chmod_test.cpp b/libc/test/src/sys/stat/chmod_test.cpp index f12d20dedf489f95a94d7db4209cc2b1e4fe6c90..c476b92b5e4379f49eed641bb56c900117399da9 100644 --- a/libc/test/src/sys/stat/chmod_test.cpp +++ b/libc/test/src/sys/stat/chmod_test.cpp @@ -18,8 +18,8 @@ #include TEST(LlvmLibcChmodTest, ChangeAndOpen) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; // The test file is initially writable. We open it for writing and ensure // that it indeed can be opened for writing. Next, we close the file and @@ -30,34 +30,36 @@ TEST(LlvmLibcChmodTest, ChangeAndOpen) { constexpr ssize_t WRITE_SIZE = ssize_t(sizeof(WRITE_DATA)); libc_errno = 0; - int fd = __llvm_libc::open(TEST_FILE, O_APPEND | O_WRONLY); + int fd = LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_WRONLY); ASSERT_GT(fd, 0); ASSERT_EQ(libc_errno, 0); - ASSERT_EQ(__llvm_libc::write(fd, WRITE_DATA, sizeof(WRITE_DATA)), WRITE_SIZE); - ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0)); + ASSERT_EQ(LIBC_NAMESPACE::write(fd, WRITE_DATA, sizeof(WRITE_DATA)), + WRITE_SIZE); + ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0)); - fd = __llvm_libc::open(TEST_FILE, O_PATH); + fd = LIBC_NAMESPACE::open(TEST_FILE, O_PATH); ASSERT_GT(fd, 0); ASSERT_EQ(libc_errno, 0); - ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0)); - EXPECT_THAT(__llvm_libc::chmod(TEST_FILE, S_IRUSR), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0)); + EXPECT_THAT(LIBC_NAMESPACE::chmod(TEST_FILE, S_IRUSR), Succeeds(0)); // Opening for writing should fail. - EXPECT_EQ(__llvm_libc::open(TEST_FILE, O_APPEND | O_WRONLY), -1); + EXPECT_EQ(LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_WRONLY), -1); EXPECT_NE(libc_errno, 0); libc_errno = 0; // But opening for reading should succeed. - fd = __llvm_libc::open(TEST_FILE, O_APPEND | O_RDONLY); + fd = LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_RDONLY); EXPECT_GT(fd, 0); EXPECT_EQ(libc_errno, 0); - EXPECT_THAT(__llvm_libc::close(fd), Succeeds(0)); - EXPECT_THAT(__llvm_libc::chmod(TEST_FILE, S_IRWXU), Succeeds(0)); + EXPECT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0)); + EXPECT_THAT(LIBC_NAMESPACE::chmod(TEST_FILE, S_IRWXU), Succeeds(0)); } TEST(LlvmLibcChmodTest, NonExistentFile) { libc_errno = 0; - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - ASSERT_THAT(__llvm_libc::chmod("non-existent-file", S_IRUSR), Fails(ENOENT)); + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + ASSERT_THAT(LIBC_NAMESPACE::chmod("non-existent-file", S_IRUSR), + Fails(ENOENT)); libc_errno = 0; } diff --git a/libc/test/src/sys/stat/fchmod_test.cpp b/libc/test/src/sys/stat/fchmod_test.cpp index 0a6c9f4a4509b0c838dd10be610bf63648161c2e..5a32b5c973db9b6f1f6569e62b98eba8ad8e81f5 100644 --- a/libc/test/src/sys/stat/fchmod_test.cpp +++ b/libc/test/src/sys/stat/fchmod_test.cpp @@ -18,8 +18,8 @@ #include TEST(LlvmLibcChmodTest, ChangeAndOpen) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; // The test file is initially writable. We open it for writing and ensure // that it indeed can be opened for writing. Next, we close the file and @@ -30,34 +30,35 @@ TEST(LlvmLibcChmodTest, ChangeAndOpen) { constexpr ssize_t WRITE_SIZE = ssize_t(sizeof(WRITE_DATA)); libc_errno = 0; - int fd = __llvm_libc::open(TEST_FILE, O_APPEND | O_WRONLY); + int fd = LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_WRONLY); ASSERT_GT(fd, 0); ASSERT_EQ(libc_errno, 0); - ASSERT_EQ(__llvm_libc::write(fd, WRITE_DATA, sizeof(WRITE_DATA)), WRITE_SIZE); - ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0)); + ASSERT_EQ(LIBC_NAMESPACE::write(fd, WRITE_DATA, sizeof(WRITE_DATA)), + WRITE_SIZE); + ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0)); - fd = __llvm_libc::open(TEST_FILE, O_APPEND | O_WRONLY); + fd = LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_WRONLY); ASSERT_GT(fd, 0); ASSERT_EQ(libc_errno, 0); - EXPECT_THAT(__llvm_libc::fchmod(fd, S_IRUSR), Succeeds(0)); - ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0)); + EXPECT_THAT(LIBC_NAMESPACE::fchmod(fd, S_IRUSR), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0)); // Opening for writing should fail. - EXPECT_EQ(__llvm_libc::open(TEST_FILE, O_APPEND | O_WRONLY), -1); + EXPECT_EQ(LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_WRONLY), -1); EXPECT_NE(libc_errno, 0); libc_errno = 0; // But opening for reading should succeed. - fd = __llvm_libc::open(TEST_FILE, O_APPEND | O_RDONLY); + fd = LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_RDONLY); EXPECT_GT(fd, 0); EXPECT_EQ(libc_errno, 0); - EXPECT_THAT(__llvm_libc::fchmod(fd, S_IRWXU), Succeeds(0)); - EXPECT_THAT(__llvm_libc::close(fd), Succeeds(0)); + EXPECT_THAT(LIBC_NAMESPACE::fchmod(fd, S_IRWXU), Succeeds(0)); + EXPECT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0)); } TEST(LlvmLibcChmodTest, NonExistentFile) { libc_errno = 0; - ASSERT_EQ(__llvm_libc::fchmod(-1, S_IRUSR), -1); + ASSERT_EQ(LIBC_NAMESPACE::fchmod(-1, S_IRUSR), -1); ASSERT_NE(libc_errno, 0); libc_errno = 0; } diff --git a/libc/test/src/sys/stat/fchmodat_test.cpp b/libc/test/src/sys/stat/fchmodat_test.cpp index 578d0b0f1dfa6713f6141ddcd9382e16e5564ad8..077d21df15af3ce7bd05613680acc638072b495a 100644 --- a/libc/test/src/sys/stat/fchmodat_test.cpp +++ b/libc/test/src/sys/stat/fchmodat_test.cpp @@ -18,8 +18,8 @@ #include TEST(LlvmLibcFchmodatTest, ChangeAndOpen) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; // The test file is initially writable. We open it for writing and ensure // that it indeed can be opened for writing. Next, we close the file and @@ -32,39 +32,41 @@ TEST(LlvmLibcFchmodatTest, ChangeAndOpen) { constexpr ssize_t WRITE_SIZE = ssize_t(sizeof(WRITE_DATA)); libc_errno = 0; - int fd = __llvm_libc::open(TEST_FILE, O_CREAT | O_WRONLY, S_IRWXU); + int fd = LIBC_NAMESPACE::open(TEST_FILE, O_CREAT | O_WRONLY, S_IRWXU); ASSERT_GT(fd, 0); ASSERT_EQ(libc_errno, 0); - ASSERT_EQ(__llvm_libc::write(fd, WRITE_DATA, sizeof(WRITE_DATA)), WRITE_SIZE); - ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0)); + ASSERT_EQ(LIBC_NAMESPACE::write(fd, WRITE_DATA, sizeof(WRITE_DATA)), + WRITE_SIZE); + ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0)); - int dirfd = __llvm_libc::open(TEST_DIR, O_DIRECTORY); + int dirfd = LIBC_NAMESPACE::open(TEST_DIR, O_DIRECTORY); ASSERT_GT(dirfd, 0); ASSERT_EQ(libc_errno, 0); - EXPECT_THAT(__llvm_libc::fchmodat(dirfd, TEST_FILE_BASENAME, S_IRUSR, 0), + EXPECT_THAT(LIBC_NAMESPACE::fchmodat(dirfd, TEST_FILE_BASENAME, S_IRUSR, 0), Succeeds(0)); // Opening for writing should fail. - EXPECT_EQ(__llvm_libc::open(TEST_FILE, O_APPEND | O_WRONLY), -1); + EXPECT_EQ(LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_WRONLY), -1); EXPECT_NE(libc_errno, 0); libc_errno = 0; // But opening for reading should succeed. - fd = __llvm_libc::open(TEST_FILE, O_APPEND | O_RDONLY); + fd = LIBC_NAMESPACE::open(TEST_FILE, O_APPEND | O_RDONLY); EXPECT_GT(fd, 0); EXPECT_EQ(libc_errno, 0); - EXPECT_THAT(__llvm_libc::close(fd), Succeeds(0)); - EXPECT_THAT(__llvm_libc::fchmodat(dirfd, TEST_FILE_BASENAME, S_IRWXU, 0), + EXPECT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0)); + EXPECT_THAT(LIBC_NAMESPACE::fchmodat(dirfd, TEST_FILE_BASENAME, S_IRWXU, 0), Succeeds(0)); - EXPECT_THAT(__llvm_libc::close(dirfd), Succeeds(0)); + EXPECT_THAT(LIBC_NAMESPACE::close(dirfd), Succeeds(0)); } TEST(LlvmLibcFchmodatTest, NonExistentFile) { libc_errno = 0; - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - ASSERT_THAT(__llvm_libc::fchmodat(AT_FDCWD, "non-existent-file", S_IRUSR, 0), - Fails(ENOENT)); + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + ASSERT_THAT( + LIBC_NAMESPACE::fchmodat(AT_FDCWD, "non-existent-file", S_IRUSR, 0), + Fails(ENOENT)); libc_errno = 0; } diff --git a/libc/test/src/sys/stat/fstat_test.cpp b/libc/test/src/sys/stat/fstat_test.cpp index 8220181e03bd5dba6943d6256268d2b19fc8a8ad..22e407f6d791b8db8ea249c7fdf528534d60c905 100644 --- a/libc/test/src/sys/stat/fstat_test.cpp +++ b/libc/test/src/sys/stat/fstat_test.cpp @@ -18,8 +18,8 @@ #include TEST(LlvmLibcFStatTest, CreatAndReadMode) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; // The test file is initially writable. We open it for writing and ensure // that it indeed can be opened for writing. Next, we close the file and @@ -28,23 +28,23 @@ TEST(LlvmLibcFStatTest, CreatAndReadMode) { constexpr const char *TEST_FILE = "testdata/fstat.test"; libc_errno = 0; - int fd = __llvm_libc::open(TEST_FILE, O_CREAT | O_WRONLY, S_IRWXU); + int fd = LIBC_NAMESPACE::open(TEST_FILE, O_CREAT | O_WRONLY, S_IRWXU); ASSERT_GT(fd, 0); ASSERT_EQ(libc_errno, 0); struct stat statbuf; - ASSERT_THAT(__llvm_libc::fstat(fd, &statbuf), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::fstat(fd, &statbuf), Succeeds(0)); ASSERT_EQ(int(statbuf.st_mode), int(S_IRWXU | S_IFREG)); - ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0)); - ASSERT_THAT(__llvm_libc::unlink(TEST_FILE), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE), Succeeds(0)); } TEST(LlvmLibcFStatTest, NonExistentFile) { libc_errno = 0; - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; struct stat statbuf; - ASSERT_THAT(__llvm_libc::fstat(-1, &statbuf), Fails(EBADF)); + ASSERT_THAT(LIBC_NAMESPACE::fstat(-1, &statbuf), Fails(EBADF)); libc_errno = 0; } diff --git a/libc/test/src/sys/stat/lstat_test.cpp b/libc/test/src/sys/stat/lstat_test.cpp index a3edae192d2808211b430023744b912bf1d5adfc..6eae08daeb1cff802eb905f64b772077c7bb11b3 100644 --- a/libc/test/src/sys/stat/lstat_test.cpp +++ b/libc/test/src/sys/stat/lstat_test.cpp @@ -18,8 +18,8 @@ #include TEST(LlvmLibcLStatTest, CreatAndReadMode) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; // The test file is initially writable. We open it for writing and ensure // that it indeed can be opened for writing. Next, we close the file and @@ -28,23 +28,24 @@ TEST(LlvmLibcLStatTest, CreatAndReadMode) { constexpr const char *TEST_FILE = "testdata/lstat.test"; libc_errno = 0; - int fd = __llvm_libc::open(TEST_FILE, O_CREAT | O_WRONLY, S_IRWXU); + int fd = LIBC_NAMESPACE::open(TEST_FILE, O_CREAT | O_WRONLY, S_IRWXU); ASSERT_GT(fd, 0); ASSERT_EQ(libc_errno, 0); - ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0)); struct stat statbuf; - ASSERT_THAT(__llvm_libc::lstat(TEST_FILE, &statbuf), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::lstat(TEST_FILE, &statbuf), Succeeds(0)); ASSERT_EQ(int(statbuf.st_mode), int(S_IRWXU | S_IFREG)); - ASSERT_THAT(__llvm_libc::unlink(TEST_FILE), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE), Succeeds(0)); } TEST(LlvmLibcLStatTest, NonExistentFile) { libc_errno = 0; - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; struct stat statbuf; - ASSERT_THAT(__llvm_libc::lstat("non-existent-file", &statbuf), Fails(ENOENT)); + ASSERT_THAT(LIBC_NAMESPACE::lstat("non-existent-file", &statbuf), + Fails(ENOENT)); libc_errno = 0; } diff --git a/libc/test/src/sys/stat/mkdirat_test.cpp b/libc/test/src/sys/stat/mkdirat_test.cpp index 584f6eb18251abbf53616589a1c88c440cbe65ef..ae11af4f6b9b11114e4ca0fc543b4f1b230c6373 100644 --- a/libc/test/src/sys/stat/mkdirat_test.cpp +++ b/libc/test/src/sys/stat/mkdirat_test.cpp @@ -14,14 +14,16 @@ #include TEST(LlvmLibcMkdiratTest, CreateAndRemove) { - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; constexpr const char *TEST_DIR = "testdata/mkdirat.testdir"; - ASSERT_THAT(__llvm_libc::mkdirat(AT_FDCWD, TEST_DIR, S_IRWXU), Succeeds(0)); - ASSERT_THAT(__llvm_libc::rmdir(TEST_DIR), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::mkdirat(AT_FDCWD, TEST_DIR, S_IRWXU), + Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::rmdir(TEST_DIR), Succeeds(0)); } TEST(LlvmLibcMkdiratTest, BadPath) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - ASSERT_THAT(__llvm_libc::mkdirat(AT_FDCWD, "non-existent-dir/test", S_IRWXU), - Fails(ENOENT)); + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + ASSERT_THAT( + LIBC_NAMESPACE::mkdirat(AT_FDCWD, "non-existent-dir/test", S_IRWXU), + Fails(ENOENT)); } diff --git a/libc/test/src/sys/stat/stat_test.cpp b/libc/test/src/sys/stat/stat_test.cpp index dd9bb1cbe31715bf6ac34353414f15d1cc2a154e..1711c860df269d2a74a870714c17cddca709182b 100644 --- a/libc/test/src/sys/stat/stat_test.cpp +++ b/libc/test/src/sys/stat/stat_test.cpp @@ -18,8 +18,8 @@ #include TEST(LlvmLibcStatTest, CreatAndReadMode) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; // The test file is initially writable. We open it for writing and ensure // that it indeed can be opened for writing. Next, we close the file and @@ -28,23 +28,24 @@ TEST(LlvmLibcStatTest, CreatAndReadMode) { constexpr const char *TEST_FILE = "testdata/stat.test"; libc_errno = 0; - int fd = __llvm_libc::open(TEST_FILE, O_CREAT | O_WRONLY, S_IRWXU); + int fd = LIBC_NAMESPACE::open(TEST_FILE, O_CREAT | O_WRONLY, S_IRWXU); ASSERT_GT(fd, 0); ASSERT_EQ(libc_errno, 0); - ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0)); struct stat statbuf; - ASSERT_THAT(__llvm_libc::stat(TEST_FILE, &statbuf), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::stat(TEST_FILE, &statbuf), Succeeds(0)); ASSERT_EQ(int(statbuf.st_mode), int(S_IRWXU | S_IFREG)); - ASSERT_THAT(__llvm_libc::unlink(TEST_FILE), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::unlink(TEST_FILE), Succeeds(0)); } TEST(LlvmLibcStatTest, NonExistentFile) { libc_errno = 0; - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; struct stat statbuf; - ASSERT_THAT(__llvm_libc::stat("non-existent-file", &statbuf), Fails(ENOENT)); + ASSERT_THAT(LIBC_NAMESPACE::stat("non-existent-file", &statbuf), + Fails(ENOENT)); libc_errno = 0; } diff --git a/libc/test/src/sys/utsname/uname_test.cpp b/libc/test/src/sys/utsname/uname_test.cpp index 58d7db797a621f4d66467c15e395096fe8e241d6..79822c112a5b6b08c575300e3424b102f09a34a3 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 a7ea9ee25d7ce74919e2da578082a470013811ad..70d4d436927e6b20ab8aba5ac8dc97da216899b2 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 64441e70ec4280553196351a63f99b263ff04db8..b2ace2617d2d3f09af4338cd84682d0ae89d694d 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 01a78c24de38388f3771adcc3b4028ec1b3bada3..3048f9cda1e0596e534bbe01f01daa4bbb18294f 100644 --- a/libc/test/src/termios/termios_test.cpp +++ b/libc/test/src/termios/termios_test.cpp @@ -21,8 +21,8 @@ #include -using __llvm_libc::testing::ErrnoSetterMatcher::Fails; -using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; // We just list a bunch of smoke tests here as it is not possible to // test functionality at the least because we want to run the tests @@ -31,34 +31,34 @@ using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; TEST(LlvmLibcTermiosTest, SpeedSmokeTest) { struct termios t; libc_errno = 0; - ASSERT_THAT(__llvm_libc::cfsetispeed(&t, B50), Succeeds(0)); - ASSERT_EQ(__llvm_libc::cfgetispeed(&t), speed_t(B50)); - ASSERT_THAT(__llvm_libc::cfsetospeed(&t, B75), Succeeds(0)); - ASSERT_EQ(__llvm_libc::cfgetospeed(&t), speed_t(B75)); + ASSERT_THAT(LIBC_NAMESPACE::cfsetispeed(&t, B50), Succeeds(0)); + ASSERT_EQ(LIBC_NAMESPACE::cfgetispeed(&t), speed_t(B50)); + ASSERT_THAT(LIBC_NAMESPACE::cfsetospeed(&t, B75), Succeeds(0)); + ASSERT_EQ(LIBC_NAMESPACE::cfgetospeed(&t), speed_t(B75)); libc_errno = 0; - ASSERT_THAT(__llvm_libc::cfsetispeed(&t, ~CBAUD), Fails(EINVAL)); + ASSERT_THAT(LIBC_NAMESPACE::cfsetispeed(&t, ~CBAUD), Fails(EINVAL)); libc_errno = 0; - ASSERT_THAT(__llvm_libc::cfsetospeed(&t, ~CBAUD), Fails(EINVAL)); + ASSERT_THAT(LIBC_NAMESPACE::cfsetospeed(&t, ~CBAUD), Fails(EINVAL)); } TEST(LlvmLibcTermiosTest, GetAttrSmokeTest) { struct termios t; libc_errno = 0; - int fd = __llvm_libc::open("/dev/tty", O_RDONLY); + int fd = LIBC_NAMESPACE::open("/dev/tty", O_RDONLY); if (fd < 0) return; // When /dev/tty is not available, no point continuing. ASSERT_EQ(libc_errno, 0); - ASSERT_THAT(__llvm_libc::tcgetattr(fd, &t), Succeeds(0)); - ASSERT_EQ(__llvm_libc::close(fd), 0); + ASSERT_THAT(LIBC_NAMESPACE::tcgetattr(fd, &t), Succeeds(0)); + ASSERT_EQ(LIBC_NAMESPACE::close(fd), 0); } TEST(LlvmLibcTermiosTest, TcGetSidSmokeTest) { libc_errno = 0; - int fd = __llvm_libc::open("/dev/tty", O_RDONLY); + int fd = LIBC_NAMESPACE::open("/dev/tty", O_RDONLY); if (fd < 0) return; // When /dev/tty is not available, no point continuing. ASSERT_EQ(libc_errno, 0); - ASSERT_GT(__llvm_libc::tcgetsid(fd), pid_t(0)); - ASSERT_EQ(__llvm_libc::close(fd), 0); + ASSERT_GT(LIBC_NAMESPACE::tcgetsid(fd), pid_t(0)); + ASSERT_EQ(LIBC_NAMESPACE::close(fd), 0); } diff --git a/libc/test/src/time/TmHelper.h b/libc/test/src/time/TmHelper.h index 54d9f4eb72ce3b33c17b3fd83700535cad31e103..19202031915df1652e43c6a19ce281f9325fade3 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 fb2d57bb99add5385bea8d892f32fcdb53ccb0e4..7cdc2c4b90502c20b233c0fe2ce8baae03ae2465 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 9682f1822f0c59cbab479c003d491f16eb22bf87..1abaa135350c1391191ae3e4cfdfbbade747fe28 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 3df2edf1f9c9a029fab57b631aa291d4d6401d18..4b5ceb596aa467cab192c728633b8608dd9cd355 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 58f9c61129d20610a81d5afd6048f2920c266d4e..6367ae7145a47d42700319fd547663e5cc3fe4c0 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 fc7e5b54342d8c82ee9b46a73efea87162968512..a3dffc6bae3913dc32774138a9c0a66c629d3070 100644 --- a/libc/test/src/time/clock_test.cpp +++ b/libc/test/src/time/clock_test.cpp @@ -13,9 +13,9 @@ #include TEST(LlvmLibcClockTest, SmokeTest) { - clock_t c1 = __llvm_libc::clock(); + clock_t c1 = LIBC_NAMESPACE::clock(); ASSERT_GT(c1, clock_t(0)); - clock_t c2 = __llvm_libc::clock(); + clock_t c2 = LIBC_NAMESPACE::clock(); ASSERT_GE(c2, c1); } diff --git a/libc/test/src/time/difftime_test.cpp b/libc/test/src/time/difftime_test.cpp index dc22494114dfd1b8846bb6712c9924d5256bdd5f..187df4add1e727cd82ab7e559d221af3536793ed 100644 --- a/libc/test/src/time/difftime_test.cpp +++ b/libc/test/src/time/difftime_test.cpp @@ -12,23 +12,23 @@ #include "test/UnitTest/ErrnoSetterMatcher.h" #include "test/UnitTest/Test.h" -using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; -using __llvm_libc::time_utils::TimeConstants; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; +using LIBC_NAMESPACE::time_utils::TimeConstants; TEST(LlvmLibcDifftime, SmokeTest) { time_t t1_seconds = TimeConstants::SECONDS_PER_HOUR; time_t t2_seconds = 0; - __llvm_libc::fputil::FPBits expected_fp = - __llvm_libc::fputil::FPBits(); - expected_fp = __llvm_libc::fputil::FPBits( + LIBC_NAMESPACE::fputil::FPBits expected_fp = + LIBC_NAMESPACE::fputil::FPBits(); + expected_fp = LIBC_NAMESPACE::fputil::FPBits( static_cast(t1_seconds)); - double result = __llvm_libc::difftime(t1_seconds, t2_seconds); + double result = LIBC_NAMESPACE::difftime(t1_seconds, t2_seconds); - __llvm_libc::fputil::FPBits actual_fp = - __llvm_libc::fputil::FPBits(); - actual_fp = __llvm_libc::fputil::FPBits( + LIBC_NAMESPACE::fputil::FPBits actual_fp = + LIBC_NAMESPACE::fputil::FPBits(); + actual_fp = LIBC_NAMESPACE::fputil::FPBits( static_cast(result)); EXPECT_EQ(actual_fp.bits, expected_fp.bits); diff --git a/libc/test/src/time/gettimeofday_test.cpp b/libc/test/src/time/gettimeofday_test.cpp index a852d4fd30ef1200d2b48f5392509ec40069eb77..44250787c5381ef720a5d168e516171e8ef32af4 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 0d210b6f04fe6e28a64799aeccd5383e2264cc95..2276b4803f1922de016f8c779c946bfdb8586c69 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 4d990b3da5bc15a690ac47ea187fdcf144f74798..6b1d029a693c383219e829e01fb892023d34d972 100644 --- a/libc/test/src/time/gmtime_test.cpp +++ b/libc/test/src/time/gmtime_test.cpp @@ -15,9 +15,9 @@ #include -using __llvm_libc::testing::ErrnoSetterMatcher::Fails; -using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; -using __llvm_libc::time_utils::TimeConstants; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; +using LIBC_NAMESPACE::time_utils::TimeConstants; TEST(LlvmLibcGmTime, OutOfRange) { if (sizeof(time_t) < sizeof(int64_t)) @@ -25,7 +25,7 @@ TEST(LlvmLibcGmTime, OutOfRange) { time_t seconds = 1 + INT_MAX * static_cast( TimeConstants::NUMBER_OF_SECONDS_IN_LEAP_YEAR); - struct tm *tm_data = __llvm_libc::gmtime(&seconds); + struct tm *tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TRUE(tm_data == nullptr); EXPECT_EQ(libc_errno, EOVERFLOW); @@ -33,7 +33,7 @@ TEST(LlvmLibcGmTime, OutOfRange) { seconds = INT_MIN * static_cast( TimeConstants::NUMBER_OF_SECONDS_IN_LEAP_YEAR) - 1; - tm_data = __llvm_libc::gmtime(&seconds); + tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TRUE(tm_data == nullptr); EXPECT_EQ(libc_errno, EOVERFLOW); } @@ -43,7 +43,7 @@ TEST(LlvmLibcGmTime, InvalidSeconds) { struct tm *tm_data = nullptr; // -1 second from 1970-01-01 00:00:00 returns 1969-12-31 23:59:59. seconds = -1; - tm_data = __llvm_libc::gmtime(&seconds); + tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{59, // sec 59, // min 23, // hr @@ -56,7 +56,7 @@ TEST(LlvmLibcGmTime, InvalidSeconds) { *tm_data); // 60 seconds from 1970-01-01 00:00:00 returns 1970-01-01 00:01:00. seconds = 60; - tm_data = __llvm_libc::gmtime(&seconds); + tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{0, // sec 1, // min 0, // hr @@ -74,7 +74,7 @@ TEST(LlvmLibcGmTime, InvalidMinutes) { struct tm *tm_data = nullptr; // -1 minute from 1970-01-01 00:00:00 returns 1969-12-31 23:59:00. seconds = -TimeConstants::SECONDS_PER_MIN; - tm_data = __llvm_libc::gmtime(&seconds); + tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{0, // sec 59, // min 23, // hr @@ -87,7 +87,7 @@ TEST(LlvmLibcGmTime, InvalidMinutes) { *tm_data); // 60 minutes from 1970-01-01 00:00:00 returns 1970-01-01 01:00:00. seconds = 60 * TimeConstants::SECONDS_PER_MIN; - tm_data = __llvm_libc::gmtime(&seconds); + tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{0, // sec 0, // min 1, // hr @@ -105,7 +105,7 @@ TEST(LlvmLibcGmTime, InvalidHours) { struct tm *tm_data = nullptr; // -1 hour from 1970-01-01 00:00:00 returns 1969-12-31 23:00:00. seconds = -TimeConstants::SECONDS_PER_HOUR; - tm_data = __llvm_libc::gmtime(&seconds); + tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{0, // sec 0, // min 23, // hr @@ -118,7 +118,7 @@ TEST(LlvmLibcGmTime, InvalidHours) { *tm_data); // 24 hours from 1970-01-01 00:00:00 returns 1970-01-02 00:00:00. seconds = 24 * TimeConstants::SECONDS_PER_HOUR; - tm_data = __llvm_libc::gmtime(&seconds); + tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{0, // sec 0, // min 0, // hr @@ -135,7 +135,7 @@ TEST(LlvmLibcGmTime, InvalidYear) { // -1 year from 1970-01-01 00:00:00 returns 1969-01-01 00:00:00. time_t seconds = -TimeConstants::DAYS_PER_NON_LEAP_YEAR * TimeConstants::SECONDS_PER_DAY; - struct tm *tm_data = __llvm_libc::gmtime(&seconds); + struct tm *tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{0, // sec 0, // min 0, // hr @@ -153,7 +153,7 @@ TEST(LlvmLibcGmTime, InvalidMonths) { struct tm *tm_data = nullptr; // -1 month from 1970-01-01 00:00:00 returns 1969-12-01 00:00:00. seconds = -31 * TimeConstants::SECONDS_PER_DAY; - tm_data = __llvm_libc::gmtime(&seconds); + tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{0, // sec 0, // min 0, // hr @@ -167,7 +167,7 @@ TEST(LlvmLibcGmTime, InvalidMonths) { // 1970-13-01 00:00:00 returns 1971-01-01 00:00:00. seconds = TimeConstants::DAYS_PER_NON_LEAP_YEAR * TimeConstants::SECONDS_PER_DAY; - tm_data = __llvm_libc::gmtime(&seconds); + tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{0, // sec 0, // min 0, // hr @@ -185,7 +185,7 @@ TEST(LlvmLibcGmTime, InvalidDays) { struct tm *tm_data = nullptr; // -1 day from 1970-01-01 00:00:00 returns 1969-12-31 00:00:00. seconds = -1 * TimeConstants::SECONDS_PER_DAY; - tm_data = __llvm_libc::gmtime(&seconds); + tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{0, // sec 0, // min 0, // hr @@ -199,7 +199,7 @@ TEST(LlvmLibcGmTime, InvalidDays) { // 1970-01-32 00:00:00 returns 1970-02-01 00:00:00. seconds = 31 * TimeConstants::SECONDS_PER_DAY; - tm_data = __llvm_libc::gmtime(&seconds); + tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{0, // sec 0, // min 0, // hr @@ -213,7 +213,7 @@ TEST(LlvmLibcGmTime, InvalidDays) { // 1970-02-29 00:00:00 returns 1970-03-01 00:00:00. seconds = 59 * TimeConstants::SECONDS_PER_DAY; - tm_data = __llvm_libc::gmtime(&seconds); + tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{0, // sec 0, // min 0, // hr @@ -228,7 +228,7 @@ TEST(LlvmLibcGmTime, InvalidDays) { // 1972-02-30 00:00:00 returns 1972-03-01 00:00:00. seconds = ((2 * TimeConstants::DAYS_PER_NON_LEAP_YEAR) + 60) * TimeConstants::SECONDS_PER_DAY; - tm_data = __llvm_libc::gmtime(&seconds); + tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{0, // sec 0, // min 0, // hr @@ -245,7 +245,7 @@ TEST(LlvmLibcGmTime, EndOf32BitEpochYear) { // Test for maximum value of a signed 32-bit integer. // Test implementation can encode time for Tue 19 January 2038 03:14:07 UTC. time_t seconds = 0x7FFFFFFF; - struct tm *tm_data = __llvm_libc::gmtime(&seconds); + struct tm *tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{7, // sec 14, // min 3, // hr @@ -263,7 +263,7 @@ TEST(LlvmLibcGmTime, Max64BitYear) { return; // Mon Jan 1 12:50:50 2170 (200 years from 1970), time_t seconds = 6311479850; - struct tm *tm_data = __llvm_libc::gmtime(&seconds); + struct tm *tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{50, // sec 50, // min 12, // hr @@ -277,7 +277,7 @@ TEST(LlvmLibcGmTime, Max64BitYear) { // Test for Tue Jan 1 12:50:50 in 2,147,483,647th year. seconds = 67767976202043050; - tm_data = __llvm_libc::gmtime(&seconds); + tm_data = LIBC_NAMESPACE::gmtime(&seconds); EXPECT_TM_EQ((tm{50, // sec 50, // min 12, // hr diff --git a/libc/test/src/time/mktime_test.cpp b/libc/test/src/time/mktime_test.cpp index 6cf115e89f05ef56936012d3ea45c0353d6dbf5e..753363ec3975862ddba3185d765cb382a90135ad 100644 --- a/libc/test/src/time/mktime_test.cpp +++ b/libc/test/src/time/mktime_test.cpp @@ -15,9 +15,9 @@ #include -using __llvm_libc::testing::ErrnoSetterMatcher::Fails; -using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; -using __llvm_libc::time_utils::Month; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; +using LIBC_NAMESPACE::time_utils::Month; static inline constexpr int tm_year(int year) { return year - TimeConstants::TIME_YEAR_BASE; @@ -29,7 +29,7 @@ TEST(LlvmLibcMkTime, FailureSetsErrno) { .tm_mday = INT_MAX, .tm_mon = INT_MAX - 1, .tm_year = tm_year(INT_MAX), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), Fails(EOVERFLOW)); + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Fails(EOVERFLOW)); } TEST(LlvmLibcMkTime, InvalidSeconds) { @@ -40,7 +40,7 @@ TEST(LlvmLibcMkTime, InvalidSeconds) { .tm_mon = Month::JANUARY, .tm_year = tm_year(1970), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), Succeeds(-1)); + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(-1)); EXPECT_TM_EQ((tm{.tm_sec = 59, .tm_min = 59, .tm_hour = 23, @@ -59,7 +59,7 @@ TEST(LlvmLibcMkTime, InvalidSeconds) { .tm_mon = Month::JANUARY, .tm_year = tm_year(1970), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), Succeeds(60)); + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(60)); EXPECT_TM_EQ((tm{.tm_sec = 0, .tm_min = 1, .tm_hour = 0, @@ -80,7 +80,7 @@ TEST(LlvmLibcMkTime, InvalidMinutes) { .tm_mon = Month::JANUARY, .tm_year = tm_year(1970), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(-TimeConstants::SECONDS_PER_MIN)); EXPECT_TM_EQ((tm{.tm_sec = 0, .tm_min = 59, @@ -100,7 +100,7 @@ TEST(LlvmLibcMkTime, InvalidMinutes) { .tm_mon = Month::JANUARY, .tm_year = tm_year(1970), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(60 * TimeConstants::SECONDS_PER_MIN)); EXPECT_TM_EQ((tm{.tm_sec = 0, .tm_min = 0, @@ -122,7 +122,7 @@ TEST(LlvmLibcMkTime, InvalidHours) { .tm_mon = Month::JANUARY, .tm_year = tm_year(1970), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(-TimeConstants::SECONDS_PER_HOUR)); EXPECT_TM_EQ((tm{.tm_sec = 0, .tm_min = 0, @@ -142,7 +142,7 @@ TEST(LlvmLibcMkTime, InvalidHours) { .tm_mon = Month::JANUARY, .tm_year = tm_year(1970), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(24 * TimeConstants::SECONDS_PER_HOUR)); EXPECT_TM_EQ((tm{.tm_sec = 0, .tm_min = 0, @@ -163,7 +163,7 @@ TEST(LlvmLibcMkTime, InvalidYear) { .tm_mon = Month::JANUARY, .tm_year = tm_year(1969), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(-TimeConstants::DAYS_PER_NON_LEAP_YEAR * TimeConstants::SECONDS_PER_DAY)); EXPECT_TM_EQ((tm{.tm_sec = 0, @@ -187,7 +187,7 @@ TEST(LlvmLibcMkTime, InvalidEndOf32BitEpochYear) { .tm_mon = Month::JANUARY, .tm_year = tm_year(2038), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), Fails(EOVERFLOW)); + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Fails(EOVERFLOW)); } { @@ -197,7 +197,7 @@ TEST(LlvmLibcMkTime, InvalidEndOf32BitEpochYear) { .tm_mon = Month::JANUARY, .tm_year = tm_year(2038), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), Fails(EOVERFLOW)); + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Fails(EOVERFLOW)); } { @@ -207,7 +207,7 @@ TEST(LlvmLibcMkTime, InvalidEndOf32BitEpochYear) { .tm_mon = Month::JANUARY, .tm_year = tm_year(2038), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), Fails(EOVERFLOW)); + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Fails(EOVERFLOW)); } { @@ -217,7 +217,7 @@ TEST(LlvmLibcMkTime, InvalidEndOf32BitEpochYear) { .tm_mon = Month::JANUARY, .tm_year = tm_year(2038), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), Fails(EOVERFLOW)); + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Fails(EOVERFLOW)); } { @@ -227,7 +227,7 @@ TEST(LlvmLibcMkTime, InvalidEndOf32BitEpochYear) { .tm_mon = Month::FEBRUARY, .tm_year = tm_year(2038), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), Fails(EOVERFLOW)); + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Fails(EOVERFLOW)); } { @@ -237,7 +237,7 @@ TEST(LlvmLibcMkTime, InvalidEndOf32BitEpochYear) { .tm_mon = Month::JANUARY, .tm_year = tm_year(2039), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), Fails(EOVERFLOW)); + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Fails(EOVERFLOW)); } } @@ -248,7 +248,7 @@ TEST(LlvmLibcMkTime, InvalidMonths) { .tm_sec = 0, .tm_min = 0, .tm_hour = 0, .tm_mday = 0, .tm_mon = -1, .tm_year = tm_year(1970), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(-32 * TimeConstants::SECONDS_PER_DAY)); EXPECT_TM_EQ((tm{.tm_sec = 0, .tm_min = 0, @@ -267,7 +267,7 @@ TEST(LlvmLibcMkTime, InvalidMonths) { .tm_sec = 0, .tm_min = 0, .tm_hour = 0, .tm_mday = 1, .tm_mon = 12, .tm_year = tm_year(1970), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(TimeConstants::DAYS_PER_NON_LEAP_YEAR * TimeConstants::SECONDS_PER_DAY)); EXPECT_TM_EQ((tm{.tm_sec = 0, @@ -290,7 +290,7 @@ TEST(LlvmLibcMkTime, InvalidDays) { .tm_mon = Month::JANUARY, .tm_year = tm_year(1970), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(-1 * TimeConstants::SECONDS_PER_DAY)); EXPECT_TM_EQ((tm{.tm_sec = 0, .tm_min = 0, @@ -310,7 +310,7 @@ TEST(LlvmLibcMkTime, InvalidDays) { .tm_mon = Month::JANUARY, .tm_year = tm_year(1970), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(31 * TimeConstants::SECONDS_PER_DAY)); EXPECT_TM_EQ((tm{.tm_sec = 0, .tm_min = 0, @@ -330,7 +330,7 @@ TEST(LlvmLibcMkTime, InvalidDays) { .tm_mon = Month::FEBRUARY, .tm_year = tm_year(1970), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(59 * TimeConstants::SECONDS_PER_DAY)); EXPECT_TM_EQ((tm{.tm_sec = 0, .tm_min = 0, @@ -350,7 +350,7 @@ TEST(LlvmLibcMkTime, InvalidDays) { .tm_mon = Month::FEBRUARY, .tm_year = tm_year(1972), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(((2 * TimeConstants::DAYS_PER_NON_LEAP_YEAR) + 60) * TimeConstants::SECONDS_PER_DAY)); EXPECT_TM_EQ((tm{.tm_sec = 0, @@ -373,7 +373,7 @@ TEST(LlvmLibcMkTime, EndOf32BitEpochYear) { .tm_mon = Month::JANUARY, .tm_year = tm_year(2038), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), Succeeds(0x7FFFFFFF)); + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(0x7FFFFFFF)); EXPECT_TM_EQ((tm{.tm_sec = 7, .tm_min = 14, .tm_hour = 3, @@ -395,7 +395,7 @@ TEST(LlvmLibcMkTime, Max64BitYear) { .tm_mon = Month::JANUARY, .tm_year = tm_year(2170), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), Succeeds(6311479850)); + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(6311479850)); EXPECT_TM_EQ((tm{.tm_sec = 50, .tm_min = 50, .tm_hour = 12, @@ -414,7 +414,7 @@ TEST(LlvmLibcMkTime, Max64BitYear) { .tm_mon = Month::JANUARY, .tm_year = tm_year(2147483647), .tm_wday = 0, .tm_yday = 0 }; - EXPECT_THAT(__llvm_libc::mktime(&tm_data), Succeeds(67767976202043050)); + EXPECT_THAT(LIBC_NAMESPACE::mktime(&tm_data), Succeeds(67767976202043050)); EXPECT_TM_EQ((tm{.tm_sec = 50, .tm_min = 50, .tm_hour = 12, diff --git a/libc/test/src/time/nanosleep_test.cpp b/libc/test/src/time/nanosleep_test.cpp index e89d4fdfc05763ef08abfe53c021b7caadb003b1..2826ed14dfedabaa092375d9b0af5d2ed138577c 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 92fd8e48a77a399af2cd5df1ae9d29f41d79b0b8..1d938e8dae7adb237e578434ea7422fb7226f448 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 2fb11fed92b310fc779d9360c1133ba06c5ca8d9..f2e2293e026f2ff1a4ae7e6cd1c7357975543ed2 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 f0fa9de8e62564e21e5eb0ce5934df09662debc9..ed1fe96f4f4a1672312168bd678733516f4a4ee9 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 a19fb29c6ebabac9514266bf7b3c11b32ab2cf83..dfdeacdc8e42afc8276abb4fcbc4d748f3d12eed 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 bde5b9605e6aa56dc1963ee492f096c1099a0ea0..ff870db0334c93dca4086650484583a1e5ed5481 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 11a540c44706a937237a861e0a684c66b67abad9..279cfbfea1b144be6a3b1e0bcd3f8b28d2cc8f02 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 9a0f8056b8ae8e14d6fdba2380ba43a071053d55..38c439125db3d7bb65bf81f2318f2449abe8f0d7 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 3e04acd7f42131461b5611435353afb0e6c65ae8..27d4489f6447ea010b18025eea7ba0b2ea5658d5 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 217ab95f1fedb55a14305d00334b93fd4e632f41..ae743b385e220dbe611e230c0f737e61185c760b 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 6ac6abafd60e8843f147845c9b59a973fd7f845e..aa8e2e6f217a211d299263581ff4f8048f1f56de 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 0fcf941b5edb10b6660693e72525ad4335d6af85..1ca7c99e1ce37312ca96db5cc4043170b201db5f 100644 --- a/libc/test/src/unistd/getopt_test.cpp +++ b/libc/test/src/unistd/getopt_test.cpp @@ -15,7 +15,7 @@ #include -using __llvm_libc::cpp::array; +using LIBC_NAMESPACE::cpp::array; namespace test_globals { char *optarg; @@ -29,7 +29,7 @@ unsigned optpos; // This can't be a constructor because it will get run before the constructor // which sets the default state in getopt. void set_state(FILE *errstream) { - __llvm_libc::impl::set_getopt_state( + LIBC_NAMESPACE::impl::set_getopt_state( &test_globals::optarg, &test_globals::optind, &test_globals::optopt, &test_globals::optpos, &test_globals::opterr, errstream); } @@ -52,16 +52,18 @@ static cookie_io_functions_t cookie{nullptr, &cookie_write, nullptr, nullptr}; // doesn't currently support fmemopen but does have fopencookie. In the future // just use that instead. This memopen does no error checking for the size // of the buffer, etc. -FILE *memopen(char **pos) { return __llvm_libc::fopencookie(pos, "w", cookie); } +FILE *memopen(char **pos) { + return LIBC_NAMESPACE::fopencookie(pos, "w", cookie); +} -struct LlvmLibcGetoptTest : public __llvm_libc::testing::Test { +struct LlvmLibcGetoptTest : public LIBC_NAMESPACE::testing::Test { FILE *errstream; char buf[256]; char *pos = buf; void reset_errstream() { pos = buf; } const char *get_error_msg() { - __llvm_libc::fflush(errstream); + LIBC_NAMESPACE::fflush(errstream); return buf; } @@ -85,32 +87,32 @@ TEST_F(LlvmLibcGetoptTest, NoMatch) { array argv{"prog"_c, "arg1"_c, nullptr}; // optind >= argc - EXPECT_EQ(__llvm_libc::getopt(1, argv.data(), "..."), -1); + EXPECT_EQ(LIBC_NAMESPACE::getopt(1, argv.data(), "..."), -1); // argv[optind] == nullptr test_globals::optind = 2; - EXPECT_EQ(__llvm_libc::getopt(100, argv.data(), "..."), -1); + EXPECT_EQ(LIBC_NAMESPACE::getopt(100, argv.data(), "..."), -1); // argv[optind][0] != '-' test_globals::optind = 1; - EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), "a"), -1); + EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), "a"), -1); ASSERT_EQ(test_globals::optind, 1); // argv[optind] == "-" argv[1] = "-"_c; - EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), "a"), -1); + EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), "a"), -1); ASSERT_EQ(test_globals::optind, 1); // argv[optind] == "--", then return -1 and incremement optind argv[1] = "--"_c; - EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), "a"), -1); + EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), "a"), -1); EXPECT_EQ(test_globals::optind, 2); } TEST_F(LlvmLibcGetoptTest, WrongMatch) { array argv{"prog"_c, "-b"_c, nullptr}; - EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), "a"), int('?')); + EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), "a"), int('?')); EXPECT_EQ(test_globals::optopt, (int)'b'); EXPECT_EQ(test_globals::optind, 1); EXPECT_STREQ(get_error_msg(), "prog: illegal option -- b\n"); @@ -121,7 +123,7 @@ TEST_F(LlvmLibcGetoptTest, OpterrFalse) { test_globals::opterr = 0; set_state(errstream); - EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), "a"), int('?')); + EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), "a"), int('?')); EXPECT_EQ(test_globals::optopt, (int)'b'); EXPECT_EQ(test_globals::optind, 1); EXPECT_STREQ(get_error_msg(), ""); @@ -130,11 +132,11 @@ TEST_F(LlvmLibcGetoptTest, OpterrFalse) { TEST_F(LlvmLibcGetoptTest, MissingArg) { array argv{"prog"_c, "-b"_c, nullptr}; - EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), ":b:"), (int)':'); + EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), ":b:"), (int)':'); ASSERT_EQ(test_globals::optind, 1); EXPECT_STREQ(get_error_msg(), "prog: option requires an argument -- b\n"); reset_errstream(); - EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), "b:"), int('?')); + EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), "b:"), int('?')); EXPECT_EQ(test_globals::optind, 1); EXPECT_STREQ(get_error_msg(), "prog: option requires an argument -- b\n"); } @@ -142,7 +144,7 @@ TEST_F(LlvmLibcGetoptTest, MissingArg) { TEST_F(LlvmLibcGetoptTest, ParseArgInCurrent) { array argv{"prog"_c, "-barg"_c, nullptr}; - EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), "b:"), (int)'b'); + EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), "b:"), (int)'b'); EXPECT_STREQ(test_globals::optarg, "arg"); EXPECT_EQ(test_globals::optind, 2); } @@ -150,7 +152,7 @@ TEST_F(LlvmLibcGetoptTest, ParseArgInCurrent) { TEST_F(LlvmLibcGetoptTest, ParseArgInNext) { array argv{"prog"_c, "-b"_c, "arg"_c, nullptr}; - EXPECT_EQ(__llvm_libc::getopt(3, argv.data(), "b:"), (int)'b'); + EXPECT_EQ(LIBC_NAMESPACE::getopt(3, argv.data(), "b:"), (int)'b'); EXPECT_STREQ(test_globals::optarg, "arg"); EXPECT_EQ(test_globals::optind, 3); } @@ -158,10 +160,10 @@ TEST_F(LlvmLibcGetoptTest, ParseArgInNext) { TEST_F(LlvmLibcGetoptTest, ParseMutliInOne) { array argv{"prog"_c, "-abc"_c, nullptr}; - EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), "abc"), (int)'a'); + EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), "abc"), (int)'a'); ASSERT_EQ(test_globals::optind, 1); - EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), "abc"), (int)'b'); + EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), "abc"), (int)'b'); ASSERT_EQ(test_globals::optind, 1); - EXPECT_EQ(__llvm_libc::getopt(2, argv.data(), "abc"), (int)'c'); + EXPECT_EQ(LIBC_NAMESPACE::getopt(2, argv.data(), "abc"), (int)'c'); EXPECT_EQ(test_globals::optind, 2); } diff --git a/libc/test/src/unistd/getpid_test.cpp b/libc/test/src/unistd/getpid_test.cpp index fc8805309d43c08a9063408c2721a0aabc466a85..9d6c926415ee40500f36b715b101466380ee9087 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 e9724765a478df42aa835b98caac41ef67efd845..3e674afab5c9488b260f61ce9c2b4bf8a639139d 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 8f2d9d9a7be62c452eed233e629bce376c99ac78..a76eee64a6eef91a29e435aa966df12865f3b542 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 538101d3567da65b82ea570cb7867af107f69fcd..fce4a3e5f5062aa383a8ff7ece89cf3644804a92 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 7acb9dc86a0549b94438bc9f6d3cc63c1a199e2d..b1b9383cb62ee07f7abcd16f88e51849a498f06b 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 dcb6bff594a789e211ebe0a25014ff6ec98fa84b..2ef41cd4e75f6a7840b85ce93a12ed0257518e39 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 cb04db462e414ba93688d9354c138a1cb88021dd..1a13d54dbc2328cebe9c738dcc5fcd97707144c4 100644 --- a/libc/test/src/unistd/lseek_test.cpp +++ b/libc/test/src/unistd/lseek_test.cpp @@ -17,44 +17,45 @@ #include TEST(LlvmLibcUniStd, LseekTest) { - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; constexpr const char *TEST_FILE = "testdata/lseek.test"; - int fd = __llvm_libc::open(TEST_FILE, O_RDONLY); + int fd = LIBC_NAMESPACE::open(TEST_FILE, O_RDONLY); ASSERT_EQ(libc_errno, 0); ASSERT_GT(fd, 0); constexpr const char LSEEK_TEST[] = "lseek test"; constexpr int LSEEK_TEST_SIZE = sizeof(LSEEK_TEST) - 1; char read_buf[20]; - ASSERT_THAT(__llvm_libc::read(fd, read_buf, LSEEK_TEST_SIZE), + ASSERT_THAT(LIBC_NAMESPACE::read(fd, read_buf, LSEEK_TEST_SIZE), Succeeds(LSEEK_TEST_SIZE)); read_buf[LSEEK_TEST_SIZE] = '\0'; EXPECT_STREQ(read_buf, LSEEK_TEST); // Seek to the beginning of the file and re-read. - ASSERT_THAT(__llvm_libc::lseek(fd, 0, SEEK_SET), Succeeds(0)); - ASSERT_THAT(__llvm_libc::read(fd, read_buf, LSEEK_TEST_SIZE), + ASSERT_THAT(LIBC_NAMESPACE::lseek(fd, 0, SEEK_SET), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::read(fd, read_buf, LSEEK_TEST_SIZE), Succeeds(LSEEK_TEST_SIZE)); read_buf[LSEEK_TEST_SIZE] = '\0'; EXPECT_STREQ(read_buf, LSEEK_TEST); // Seek to the beginning of the file from the end and re-read. - ASSERT_THAT(__llvm_libc::lseek(fd, -LSEEK_TEST_SIZE, SEEK_END), Succeeds(0)); - ASSERT_THAT(__llvm_libc::read(fd, read_buf, LSEEK_TEST_SIZE), + ASSERT_THAT(LIBC_NAMESPACE::lseek(fd, -LSEEK_TEST_SIZE, SEEK_END), + Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::read(fd, read_buf, LSEEK_TEST_SIZE), Succeeds(LSEEK_TEST_SIZE)); read_buf[LSEEK_TEST_SIZE] = '\0'; EXPECT_STREQ(read_buf, LSEEK_TEST); - ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0)); } TEST(LlvmLibcUniStd, LseekFailsTest) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; constexpr const char *TEST_FILE = "testdata/lseek.test"; - int fd = __llvm_libc::open(TEST_FILE, O_RDONLY); + int fd = LIBC_NAMESPACE::open(TEST_FILE, O_RDONLY); ASSERT_EQ(libc_errno, 0); ASSERT_GT(fd, 0); - EXPECT_THAT(__llvm_libc::lseek(fd, -1, SEEK_CUR), Fails(EINVAL)); - ASSERT_THAT(__llvm_libc::close(fd), Succeeds(0)); + EXPECT_THAT(LIBC_NAMESPACE::lseek(fd, -1, SEEK_CUR), Fails(EINVAL)); + ASSERT_THAT(LIBC_NAMESPACE::close(fd), Succeeds(0)); } diff --git a/libc/test/src/unistd/pread_pwrite_test.cpp b/libc/test/src/unistd/pread_pwrite_test.cpp index 4d0158a8173a02061a45456f2dae8a2ed743728f..6819f559424f3e03eea69248552b013ce1e3974b 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 ed819a93d5f82724d786a96d883253584eca0921..20b51bb8082b1209c84912ecaae3b571f32c98d0 100644 --- a/libc/test/src/unistd/read_write_test.cpp +++ b/libc/test/src/unistd/read_write_test.cpp @@ -16,42 +16,42 @@ #include "test/UnitTest/Test.h" TEST(LlvmLibcUniStd, WriteAndReadBackTest) { - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; constexpr const char *TEST_FILE = "__unistd_read_write.test"; - int write_fd = __llvm_libc::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU); + int write_fd = LIBC_NAMESPACE::open(TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU); ASSERT_EQ(libc_errno, 0); ASSERT_GT(write_fd, 0); constexpr const char HELLO[] = "hello"; constexpr int HELLO_SIZE = sizeof(HELLO); - ASSERT_THAT(__llvm_libc::write(write_fd, HELLO, HELLO_SIZE), + ASSERT_THAT(LIBC_NAMESPACE::write(write_fd, HELLO, HELLO_SIZE), Succeeds(HELLO_SIZE)); - ASSERT_THAT(__llvm_libc::fsync(write_fd), Succeeds(0)); - ASSERT_THAT(__llvm_libc::close(write_fd), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::fsync(write_fd), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(write_fd), Succeeds(0)); - int read_fd = __llvm_libc::open(TEST_FILE, O_RDONLY); + int read_fd = LIBC_NAMESPACE::open(TEST_FILE, O_RDONLY); ASSERT_EQ(libc_errno, 0); ASSERT_GT(read_fd, 0); char read_buf[10]; - ASSERT_THAT(__llvm_libc::read(read_fd, read_buf, HELLO_SIZE), + ASSERT_THAT(LIBC_NAMESPACE::read(read_fd, read_buf, HELLO_SIZE), Succeeds(HELLO_SIZE)); EXPECT_STREQ(read_buf, HELLO); - ASSERT_THAT(__llvm_libc::close(read_fd), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::close(read_fd), Succeeds(0)); // TODO: 'remove' the test file after the test. } TEST(LlvmLibcUniStd, WriteFails) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; - EXPECT_THAT(__llvm_libc::write(-1, "", 1), Fails(EBADF)); - EXPECT_THAT(__llvm_libc::write(1, reinterpret_cast(-1), 1), + EXPECT_THAT(LIBC_NAMESPACE::write(-1, "", 1), Fails(EBADF)); + EXPECT_THAT(LIBC_NAMESPACE::write(1, reinterpret_cast(-1), 1), Fails(EFAULT)); } TEST(LlvmLibcUniStd, ReadFails) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; - EXPECT_THAT(__llvm_libc::read(-1, nullptr, 1), Fails(EBADF)); - EXPECT_THAT(__llvm_libc::read(0, reinterpret_cast(-1), 1), + EXPECT_THAT(LIBC_NAMESPACE::read(-1, nullptr, 1), Fails(EBADF)); + EXPECT_THAT(LIBC_NAMESPACE::read(0, reinterpret_cast(-1), 1), Fails(EFAULT)); } diff --git a/libc/test/src/unistd/readlink_test.cpp b/libc/test/src/unistd/readlink_test.cpp index dbb957f29fd05c83fa1c373420b1af93e706ae4b..b2d018a50ec79312a6ba02dff505b8a02ded754c 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 39127c0288b0b45a8c5a846ab4a305452d7a525d..19f0ceec3cf7c5982a35afba9c5ef488e8ac990c 100644 --- a/libc/test/src/unistd/readlinkat_test.cpp +++ b/libc/test/src/unistd/readlinkat_test.cpp @@ -16,10 +16,10 @@ #include -namespace cpp = __llvm_libc::cpp; +namespace cpp = LIBC_NAMESPACE::cpp; TEST(LlvmLibcReadlinkatTest, CreateAndUnlink) { - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; constexpr const char LINK_VAL[] = "readlinkat_test_value"; constexpr const char LINK[] = "testdata/readlinkat.test.link"; libc_errno = 0; @@ -28,20 +28,20 @@ TEST(LlvmLibcReadlinkatTest, CreateAndUnlink) { // 1. Create a symlink with value LINK_VAL. // 2. Read the symlink with readlink. The link value read should be LINK_VAL // 3. Cleanup the symlink created in step #1. - ASSERT_THAT(__llvm_libc::symlink(LINK_VAL, LINK), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::symlink(LINK_VAL, LINK), Succeeds(0)); char buf[sizeof(LINK_VAL)]; - ssize_t len = __llvm_libc::readlinkat(AT_FDCWD, LINK, buf, sizeof(buf)); + ssize_t len = LIBC_NAMESPACE::readlinkat(AT_FDCWD, LINK, buf, sizeof(buf)); ASSERT_EQ(libc_errno, 0); ASSERT_EQ(cpp::string_view(buf, len), cpp::string_view(LINK_VAL)); - ASSERT_THAT(__llvm_libc::unlink(LINK), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::unlink(LINK), Succeeds(0)); } TEST(LlvmLibcReadlinkatTest, ReadlinkInNonExistentPath) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; char buf[8]; - ASSERT_THAT( - __llvm_libc::readlinkat(AT_FDCWD, "non-existent-link", buf, sizeof(buf)), - Fails(ENOENT)); + ASSERT_THAT(LIBC_NAMESPACE::readlinkat(AT_FDCWD, "non-existent-link", buf, + sizeof(buf)), + Fails(ENOENT)); } diff --git a/libc/test/src/unistd/rmdir_test.cpp b/libc/test/src/unistd/rmdir_test.cpp index 3fcf328b67d988240283be6897ec32296b1bcb8b..69228ce98c82244e14645582a21d1672314ae1a5 100644 --- a/libc/test/src/unistd/rmdir_test.cpp +++ b/libc/test/src/unistd/rmdir_test.cpp @@ -15,13 +15,14 @@ #include TEST(LlvmLibcRmdirTest, CreateAndRemove) { - using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; constexpr const char *TEST_DIR = "testdata/rmdir.testdir"; - ASSERT_THAT(__llvm_libc::mkdir(TEST_DIR, S_IRWXU), Succeeds(0)); - ASSERT_THAT(__llvm_libc::rmdir(TEST_DIR), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::mkdir(TEST_DIR, S_IRWXU), Succeeds(0)); + ASSERT_THAT(LIBC_NAMESPACE::rmdir(TEST_DIR), Succeeds(0)); } TEST(LlvmLibcRmdirTest, RemoveNonExistentDir) { - using __llvm_libc::testing::ErrnoSetterMatcher::Fails; - ASSERT_THAT(__llvm_libc::rmdir("testdata/non-existent-dir"), Fails(ENOENT)); + using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; + ASSERT_THAT(LIBC_NAMESPACE::rmdir("testdata/non-existent-dir"), + Fails(ENOENT)); } diff --git a/libc/test/src/unistd/swab_test.cpp b/libc/test/src/unistd/swab_test.cpp index 9b94924ee3cf13a4fa690aa92eeb9fcac76f3040..f75120d192ba3b684ae4e5fb1f6ad510c9561a9f 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 7017d4bb4f941f19ee99d48c191efac25ed07955..84d963b7a207ce8f86d2a68cdb4bcdc26384c9e4 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 e629c14f0f7a17d87bfef431be363a23588c9756..b0308787f2052a2644fd80648c283f140acf1d78 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 03b9a547cdcb7e4c1ae398e6e48c3884aef8d8a8..4a53f674b8f3d61e42e5986671dcb105c75a732f 100644 --- a/libc/test/src/unistd/syscall_test.cpp +++ b/libc/test/src/unistd/syscall_test.cpp @@ -15,7 +15,7 @@ #include // For syscall numbers. #include -using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; +using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds; // We only do a smoke test here. Actual functionality tests are // done by the unit tests of the syscall wrappers like mmap. @@ -24,11 +24,11 @@ using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds; // There is no function named "syscall" in llvm-libc, we instead use a macro to // set up the arguments properly. We still need to specify the namespace though // because the macro generates a call to the actual internal function -// (__llvm_libc_syscall) which is inside the namespace. +// (LIBC_NAMESPACE_syscall) which is inside the namespace. TEST(LlvmLibcSyscallTest, TrivialCall) { libc_errno = 0; - ASSERT_GE(__llvm_libc::syscall(SYS_gettid), 0l); + ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_gettid), 0l); ASSERT_EQ(libc_errno, 0); } @@ -37,9 +37,10 @@ TEST(LlvmLibcSyscallTest, SymlinkCreateDestroy) { constexpr const char LINK[] = "testdata/syscall_readlink.test.link"; #ifdef SYS_symlink - ASSERT_GE(__llvm_libc::syscall(SYS_symlink, LINK_VAL, LINK), 0l); + ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_symlink, LINK_VAL, LINK), 0l); #elif defined(SYS_symlinkat) - ASSERT_GE(__llvm_libc::syscall(SYS_symlinkat, LINK_VAL, AT_FDCWD, LINK), 0l); + ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_symlinkat, LINK_VAL, AT_FDCWD, LINK), + 0l); #else #error "symlink and symlinkat syscalls not available." #endif @@ -48,18 +49,18 @@ TEST(LlvmLibcSyscallTest, SymlinkCreateDestroy) { char buf[sizeof(LINK_VAL)]; #ifdef SYS_readlink - ASSERT_GE(__llvm_libc::syscall(SYS_readlink, LINK, buf, sizeof(buf)), 0l); + ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_readlink, LINK, buf, sizeof(buf)), 0l); #elif defined(SYS_readlinkat) ASSERT_GE( - __llvm_libc::syscall(SYS_readlinkat, AT_FDCWD, LINK, buf, sizeof(buf)), + LIBC_NAMESPACE::syscall(SYS_readlinkat, AT_FDCWD, LINK, buf, sizeof(buf)), 0l); #endif ASSERT_EQ(libc_errno, 0); #ifdef SYS_unlink - ASSERT_GE(__llvm_libc::syscall(SYS_unlink, LINK), 0l); + ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_unlink, LINK), 0l); #elif defined(SYS_unlinkat) - ASSERT_GE(__llvm_libc::syscall(SYS_unlinkat, AT_FDCWD, LINK, 0), 0l); + ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_unlinkat, AT_FDCWD, LINK, 0), 0l); #else #error "unlink and unlinkat syscalls not available." #endif @@ -74,23 +75,24 @@ TEST(LlvmLibcSyscallTest, FileReadWrite) { #ifdef SYS_open int fd = - __llvm_libc::syscall(SYS_open, TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU); + LIBC_NAMESPACE::syscall(SYS_open, TEST_FILE, O_WRONLY | O_CREAT, S_IRWXU); #elif defined(SYS_openat) - int fd = __llvm_libc::syscall(SYS_openat, AT_FDCWD, TEST_FILE, - O_WRONLY | O_CREAT, S_IRWXU); + int fd = LIBC_NAMESPACE::syscall(SYS_openat, AT_FDCWD, TEST_FILE, + O_WRONLY | O_CREAT, S_IRWXU); #else #error "open and openat syscalls not available." #endif ASSERT_GT(fd, 0); ASSERT_EQ(libc_errno, 0); - ASSERT_GE(__llvm_libc::syscall(SYS_pwrite64, fd, HELLO, HELLO_SIZE, 0), 0l); + ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_pwrite64, fd, HELLO, HELLO_SIZE, 0), + 0l); ASSERT_EQ(libc_errno, 0); - ASSERT_GE(__llvm_libc::syscall(SYS_fsync, fd), 0l); + ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_fsync, fd), 0l); ASSERT_EQ(libc_errno, 0); - ASSERT_GE(__llvm_libc::syscall(SYS_close, fd), 0l); + ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_close, fd), 0l); ASSERT_EQ(libc_errno, 0); } @@ -109,40 +111,41 @@ TEST(LlvmLibcSyscallTest, FileLinkCreateDestroy) { // 4. Cleanup the file and its link. #ifdef SYS_open - int write_fd = __llvm_libc::syscall(SYS_open, TEST_FILE_PATH, - O_WRONLY | O_CREAT, S_IRWXU); + int write_fd = LIBC_NAMESPACE::syscall(SYS_open, TEST_FILE_PATH, + O_WRONLY | O_CREAT, S_IRWXU); #elif defined(SYS_openat) - int write_fd = __llvm_libc::syscall(SYS_openat, AT_FDCWD, TEST_FILE_PATH, - O_WRONLY | O_CREAT, S_IRWXU); + int write_fd = LIBC_NAMESPACE::syscall(SYS_openat, AT_FDCWD, TEST_FILE_PATH, + O_WRONLY | O_CREAT, S_IRWXU); #else #error "open and openat syscalls not available." #endif ASSERT_GT(write_fd, 0); ASSERT_EQ(libc_errno, 0); - ASSERT_GE(__llvm_libc::syscall(SYS_close, write_fd), 0l); + ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_close, write_fd), 0l); ASSERT_EQ(libc_errno, 0); #ifdef SYS_open - int dir_fd = __llvm_libc::syscall(SYS_open, TEST_DIR, O_DIRECTORY, 0); + int dir_fd = LIBC_NAMESPACE::syscall(SYS_open, TEST_DIR, O_DIRECTORY, 0); #elif defined(SYS_openat) int dir_fd = - __llvm_libc::syscall(SYS_openat, AT_FDCWD, TEST_DIR, O_DIRECTORY, 0); + LIBC_NAMESPACE::syscall(SYS_openat, AT_FDCWD, TEST_DIR, O_DIRECTORY, 0); #else #error "open and openat syscalls not available." #endif ASSERT_GT(dir_fd, 0); ASSERT_EQ(libc_errno, 0); - ASSERT_GE(__llvm_libc::syscall(SYS_linkat, dir_fd, TEST_FILE, dir_fd, - TEST_FILE_LINK, 0), + ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_linkat, dir_fd, TEST_FILE, dir_fd, + TEST_FILE_LINK, 0), 0l); ASSERT_EQ(libc_errno, 0); #ifdef SYS_open - int link_fd = __llvm_libc::syscall(SYS_open, TEST_FILE_LINK_PATH, O_PATH, 0); + int link_fd = + LIBC_NAMESPACE::syscall(SYS_open, TEST_FILE_LINK_PATH, O_PATH, 0); #elif defined(SYS_openat) - int link_fd = __llvm_libc::syscall(SYS_openat, AT_FDCWD, TEST_FILE_LINK_PATH, - O_PATH, 0); + int link_fd = LIBC_NAMESPACE::syscall(SYS_openat, AT_FDCWD, + TEST_FILE_LINK_PATH, O_PATH, 0); #else #error "open and openat syscalls not available." #endif @@ -150,9 +153,9 @@ TEST(LlvmLibcSyscallTest, FileLinkCreateDestroy) { ASSERT_EQ(libc_errno, 0); #ifdef SYS_unlink - ASSERT_GE(__llvm_libc::syscall(SYS_unlink, TEST_FILE_PATH), 0l); + ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_unlink, TEST_FILE_PATH), 0l); #elif defined(SYS_unlinkat) - ASSERT_GE(__llvm_libc::syscall(SYS_unlinkat, AT_FDCWD, TEST_FILE_PATH, 0), + ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_unlinkat, AT_FDCWD, TEST_FILE_PATH, 0), 0l); #else #error "unlink and unlinkat syscalls not available." @@ -160,15 +163,16 @@ TEST(LlvmLibcSyscallTest, FileLinkCreateDestroy) { ASSERT_EQ(libc_errno, 0); #ifdef SYS_unlink - ASSERT_GE(__llvm_libc::syscall(SYS_unlink, TEST_FILE_LINK_PATH), 0l); + ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_unlink, TEST_FILE_LINK_PATH), 0l); #elif defined(SYS_unlinkat) ASSERT_GE( - __llvm_libc::syscall(SYS_unlinkat, AT_FDCWD, TEST_FILE_LINK_PATH, 0), 0l); + LIBC_NAMESPACE::syscall(SYS_unlinkat, AT_FDCWD, TEST_FILE_LINK_PATH, 0), + 0l); #else #error "unlink and unlinkat syscalls not available." #endif ASSERT_EQ(libc_errno, 0); - ASSERT_GE(__llvm_libc::syscall(SYS_close, dir_fd), 0l); + ASSERT_GE(LIBC_NAMESPACE::syscall(SYS_close, dir_fd), 0l); ASSERT_EQ(libc_errno, 0); } diff --git a/libc/test/src/unistd/sysconf_test.cpp b/libc/test/src/unistd/sysconf_test.cpp index eda2e566b0257ddb38ded8f1f635ffeabad49de1..85bc1258a4863855e39c981c8e41e0f739836845 100644 --- a/libc/test/src/unistd/sysconf_test.cpp +++ b/libc/test/src/unistd/sysconf_test.cpp @@ -12,6 +12,6 @@ #include TEST(LlvmLibcSysconfTest, PagesizeTest) { - long pagesize = __llvm_libc::sysconf(_SC_PAGESIZE); + long pagesize = LIBC_NAMESPACE::sysconf(_SC_PAGESIZE); ASSERT_GT(pagesize, 0l); } diff --git a/libc/test/src/unistd/truncate_test.cpp b/libc/test/src/unistd/truncate_test.cpp index 4885a12225854d40c91bcea1e840f44c45e5a4a1..15940321e5ad456a7e12054a4cb9ede727bb88cf 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 ff55123fa0a4ea4284b582eb21d084c77c6a239b..8a64f88ee6f26db0b59f0a965bd691745f6fc4b2 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 ecb9d3a771392a288bdce6b9a7f6efe51eaa73e0..5953085bf12b66ca7379223f511a18378f5bf7f7 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 cfac485cdecc7734db5b56e987e7ada91ce4368a..b5fcb451bd07b0315f243f29e27eeeed9b92de8d 100644 --- a/libc/test/src/wchar/btowc_test.cpp +++ b/libc/test/src/wchar/btowc_test.cpp @@ -17,8 +17,8 @@ TEST(LlvmLibcBtowc, DefaultLocale) { // everything else returns WEOF. for (int c = 0; c < 255; ++c) { if (c < 128) - EXPECT_EQ(__llvm_libc::btowc(c), static_cast(c)); + EXPECT_EQ(LIBC_NAMESPACE::btowc(c), static_cast(c)); else - EXPECT_EQ(__llvm_libc::btowc(c), WEOF); + EXPECT_EQ(LIBC_NAMESPACE::btowc(c), WEOF); } } diff --git a/libc/test/src/wchar/wctob_test.cpp b/libc/test/src/wchar/wctob_test.cpp index 7a8d6eea0c82a09a80826098731a173ce2ee3f00..3f911884a7c12c6b3a6bcc5691348841212fe823 100644 --- a/libc/test/src/wchar/wctob_test.cpp +++ b/libc/test/src/wchar/wctob_test.cpp @@ -17,8 +17,8 @@ TEST(LlvmLibcWctob, DefaultLocale) { // itself and everything else returns EOF. for (wint_t c = 0; c < 32767; ++c) { if (c < 128) - EXPECT_EQ(__llvm_libc::wctob(c), static_cast(c)); + EXPECT_EQ(LIBC_NAMESPACE::wctob(c), static_cast(c)); else - EXPECT_EQ(__llvm_libc::wctob(c), EOF); + EXPECT_EQ(LIBC_NAMESPACE::wctob(c), EOF); } } diff --git a/libc/test/utils/FPUtil/x86_long_double_test.cpp b/libc/test/utils/FPUtil/x86_long_double_test.cpp index e116482c500a2482b03ddd22247a9f6f0ed46f42..6ca9b16377c0b80efc58f440975753c0470034b5 100644 --- a/libc/test/utils/FPUtil/x86_long_double_test.cpp +++ b/libc/test/utils/FPUtil/x86_long_double_test.cpp @@ -11,7 +11,7 @@ #include -using FPBits = __llvm_libc::fputil::FPBits; +using FPBits = LIBC_NAMESPACE::fputil::FPBits; TEST(LlvmLibcX86LongDoubleTest, is_nan) { // In the nan checks below, we use the macro isnan from math.h to ensure that diff --git a/libc/test/utils/UnitTest/testfilter_test.cpp b/libc/test/utils/UnitTest/testfilter_test.cpp index 8a62f7d767101abcbce8ccb4f7c91d763326044a..567b5e2bde855300306fbb1f06580a8ee2deae35 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 86f0220a510ad0a9f6da46c8c41ed8d0de0c2655..551b97caf81fd690c3145456557bc90ba1584d95 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 e9f13fe4d0ad4027cbe85ebd7d0362875363a75a..e23a3c2034cb2837e10f7acef48e49c586a596ee 100644 --- a/libc/utils/MPFRWrapper/MPFRUtils.cpp +++ b/libc/utils/MPFRWrapper/MPFRUtils.cpp @@ -23,9 +23,9 @@ #include "mpfr_inc.h" -template using FPBits = __llvm_libc::fputil::FPBits; +template using FPBits = LIBC_NAMESPACE::fputil::FPBits; -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { namespace mpfr { @@ -51,7 +51,7 @@ template <> struct ExtraPrecision { template static inline unsigned int get_precision(double ulp_tolerance) { if (ulp_tolerance <= 0.5) { - return __llvm_libc::fputil::FloatProperties::MANTISSA_PRECISION; + return LIBC_NAMESPACE::fputil::FloatProperties::MANTISSA_PRECISION; } else { return ExtraPrecision::VALUE; } @@ -1011,4 +1011,4 @@ template long double round(long double, RoundingMode); } // namespace mpfr } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE diff --git a/libc/utils/MPFRWrapper/MPFRUtils.h b/libc/utils/MPFRWrapper/MPFRUtils.h index 0ba5ab6888bb79a97c22cbf0e8de66de9e10fc5c..baac2d0e3a410ebdfe74717f1a27647c69039235 100644 --- a/libc/utils/MPFRWrapper/MPFRUtils.h +++ b/libc/utils/MPFRWrapper/MPFRUtils.h @@ -15,7 +15,7 @@ #include -namespace __llvm_libc { +namespace LIBC_NAMESPACE { namespace testing { namespace mpfr { @@ -87,12 +87,12 @@ enum class Operation : int { EndTernaryOperationsSingleOutput, }; -using __llvm_libc::fputil::testing::ForceRoundingMode; -using __llvm_libc::fputil::testing::RoundingMode; +using LIBC_NAMESPACE::fputil::testing::ForceRoundingMode; +using LIBC_NAMESPACE::fputil::testing::RoundingMode; template struct BinaryInput { static_assert( - __llvm_libc::cpp::is_floating_point_v, + LIBC_NAMESPACE::cpp::is_floating_point_v, "Template parameter of BinaryInput must be a floating point type."); using Type = T; @@ -101,7 +101,7 @@ template struct BinaryInput { template struct TernaryInput { static_assert( - __llvm_libc::cpp::is_floating_point_v, + LIBC_NAMESPACE::cpp::is_floating_point_v, "Template parameter of TernaryInput must be a floating point type."); using Type = T; @@ -316,7 +316,7 @@ template bool round_to_long(T x, RoundingMode mode, long &result); } // namespace mpfr } // namespace testing -} // namespace __llvm_libc +} // namespace LIBC_NAMESPACE // GET_MPFR_DUMMY_ARG is going to be added to the end of GET_MPFR_MACRO as a // simple way to avoid the compiler warning `gnu-zero-variadic-macro-arguments`. @@ -326,14 +326,15 @@ template bool round_to_long(T x, RoundingMode mode, long &result); #define EXPECT_MPFR_MATCH_DEFAULT(op, input, match_value, ulp_tolerance) \ EXPECT_THAT(match_value, \ - __llvm_libc::testing::mpfr::get_mpfr_matcher( \ + LIBC_NAMESPACE::testing::mpfr::get_mpfr_matcher( \ input, match_value, ulp_tolerance, \ - __llvm_libc::testing::mpfr::RoundingMode::Nearest)) + LIBC_NAMESPACE::testing::mpfr::RoundingMode::Nearest)) #define EXPECT_MPFR_MATCH_ROUNDING(op, input, match_value, ulp_tolerance, \ rounding) \ - EXPECT_THAT(match_value, __llvm_libc::testing::mpfr::get_mpfr_matcher( \ - input, match_value, ulp_tolerance, rounding)) + EXPECT_THAT(match_value, \ + LIBC_NAMESPACE::testing::mpfr::get_mpfr_matcher( \ + input, match_value, ulp_tolerance, rounding)) #define EXPECT_MPFR_MATCH(...) \ GET_MPFR_MACRO(__VA_ARGS__, EXPECT_MPFR_MATCH_ROUNDING, \ @@ -342,8 +343,8 @@ template bool round_to_long(T x, RoundingMode mode, long &result); #define TEST_MPFR_MATCH_ROUNDING(op, input, match_value, ulp_tolerance, \ rounding) \ - __llvm_libc::testing::mpfr::get_mpfr_matcher(input, match_value, \ - ulp_tolerance, rounding) \ + LIBC_NAMESPACE::testing::mpfr::get_mpfr_matcher(input, match_value, \ + ulp_tolerance, rounding) \ .match(match_value) #define TEST_MPFR_MATCH(...) \ @@ -353,7 +354,7 @@ template bool round_to_long(T x, RoundingMode mode, long &result); #define EXPECT_MPFR_MATCH_ALL_ROUNDING(op, input, match_value, ulp_tolerance) \ { \ - namespace mpfr = __llvm_libc::testing::mpfr; \ + namespace mpfr = LIBC_NAMESPACE::testing::mpfr; \ mpfr::ForceRoundingMode __r1(mpfr::RoundingMode::Nearest); \ if (__r1.success) \ EXPECT_MPFR_MATCH(op, input, match_value, ulp_tolerance, \ @@ -374,20 +375,21 @@ template bool round_to_long(T x, RoundingMode mode, long &result); #define TEST_MPFR_MATCH_ROUNDING_SILENTLY(op, input, match_value, \ ulp_tolerance, rounding) \ - __llvm_libc::testing::mpfr::get_silent_mpfr_matcher( \ + LIBC_NAMESPACE::testing::mpfr::get_silent_mpfr_matcher( \ input, match_value, ulp_tolerance, rounding) \ .match(match_value) #define ASSERT_MPFR_MATCH_DEFAULT(op, input, match_value, ulp_tolerance) \ ASSERT_THAT(match_value, \ - __llvm_libc::testing::mpfr::get_mpfr_matcher( \ + LIBC_NAMESPACE::testing::mpfr::get_mpfr_matcher( \ input, match_value, ulp_tolerance, \ - __llvm_libc::testing::mpfr::RoundingMode::Nearest)) + LIBC_NAMESPACE::testing::mpfr::RoundingMode::Nearest)) #define ASSERT_MPFR_MATCH_ROUNDING(op, input, match_value, ulp_tolerance, \ rounding) \ - ASSERT_THAT(match_value, __llvm_libc::testing::mpfr::get_mpfr_matcher( \ - input, match_value, ulp_tolerance, rounding)) + ASSERT_THAT(match_value, \ + LIBC_NAMESPACE::testing::mpfr::get_mpfr_matcher( \ + input, match_value, ulp_tolerance, rounding)) #define ASSERT_MPFR_MATCH(...) \ GET_MPFR_MACRO(__VA_ARGS__, ASSERT_MPFR_MATCH_ROUNDING, \ @@ -396,7 +398,7 @@ template bool round_to_long(T x, RoundingMode mode, long &result); #define ASSERT_MPFR_MATCH_ALL_ROUNDING(op, input, match_value, ulp_tolerance) \ { \ - namespace mpfr = __llvm_libc::testing::mpfr; \ + namespace mpfr = LIBC_NAMESPACE::testing::mpfr; \ mpfr::ForceRoundingMode __r1(mpfr::RoundingMode::Nearest); \ if (__r1.success) \ ASSERT_MPFR_MATCH(op, input, match_value, ulp_tolerance, \ diff --git a/libc/utils/gpu/loader/amdgpu/Loader.cpp b/libc/utils/gpu/loader/amdgpu/Loader.cpp index 1d0247a6dc5dca01d583e03ec4c9ab89920f2c5c..1fb67e841cfec2ea2ddc2dda022caf878c56e01e 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 a772cd1d22e50730c4bfddd63f05cd6c9513d908..fa6a4e324c0c281381cd4077eaeb8b5c530d9cf3 100644 --- a/libc/utils/gpu/server/rpc_server.cpp +++ b/libc/utils/gpu/server/rpc_server.cpp @@ -19,7 +19,7 @@ #include #include -using namespace __llvm_libc; +using namespace LIBC_NAMESPACE; static_assert(sizeof(rpc_buffer_t) == sizeof(rpc::Buffer), "Buffer size mismatch"); diff --git a/libc/utils/gpu/server/rpc_server.h b/libc/utils/gpu/server/rpc_server.h index 2fde0001185c16bd8ebcff877ed00613d9b8baa7..6b87830890b837910294c8365e87fe87a89428b2 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 {