diff options
author | Petr Hosek <phosek@google.com> | 2024-07-11 12:35:22 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-11 12:35:22 -0700 |
commit | 3f30effe1bd81fa1b039218a9bfe79c3b03fafad (patch) | |
tree | f3f9bbaca2e1088607359c74c4c696742383c032 /libc/src/stdlib | |
parent | 2d7e136fc0e31207b962397250bc1581203c8d59 (diff) | |
download | llvm-3f30effe1bd81fa1b039218a9bfe79c3b03fafad.zip llvm-3f30effe1bd81fa1b039218a9bfe79c3b03fafad.tar.gz llvm-3f30effe1bd81fa1b039218a9bfe79c3b03fafad.tar.bz2 |
[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98075)
This is a part of #97655.
Diffstat (limited to 'libc/src/stdlib')
80 files changed, 263 insertions, 160 deletions
diff --git a/libc/src/stdlib/_Exit.cpp b/libc/src/stdlib/_Exit.cpp index 03a7662..859598c 100644 --- a/libc/src/stdlib/_Exit.cpp +++ b/libc/src/stdlib/_Exit.cpp @@ -8,13 +8,14 @@ #include "src/__support/OSUtil/exit.h" #include "src/__support/common.h" +#include "src/__support/macros/config.h" #include "src/stdlib/_Exit.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { [[noreturn]] LLVM_LIBC_FUNCTION(void, _Exit, (int status)) { internal::exit(status); } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/_Exit.h b/libc/src/stdlib/_Exit.h index bc05faf..398ab53 100644 --- a/libc/src/stdlib/_Exit.h +++ b/libc/src/stdlib/_Exit.h @@ -9,10 +9,12 @@ #ifndef LLVM_LIBC_SRC_STDLIB__EXIT_H #define LLVM_LIBC_SRC_STDLIB__EXIT_H -namespace LIBC_NAMESPACE { +#include "src/__support/macros/config.h" + +namespace LIBC_NAMESPACE_DECL { [[noreturn]] void _Exit(int status); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB__EXIT_H diff --git a/libc/src/stdlib/abort.h b/libc/src/stdlib/abort.h index d3bf1e9..2bb292b 100644 --- a/libc/src/stdlib/abort.h +++ b/libc/src/stdlib/abort.h @@ -9,10 +9,12 @@ #ifndef LLVM_LIBC_SRC_STDLIB_ABORT_H #define LLVM_LIBC_SRC_STDLIB_ABORT_H -namespace LIBC_NAMESPACE { +#include "src/__support/macros/config.h" + +namespace LIBC_NAMESPACE_DECL { [[noreturn]] void abort(); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_ABORT_H diff --git a/libc/src/stdlib/abs.cpp b/libc/src/stdlib/abs.cpp index 6be63e0..688c504 100644 --- a/libc/src/stdlib/abs.cpp +++ b/libc/src/stdlib/abs.cpp @@ -9,9 +9,10 @@ #include "src/stdlib/abs.h" #include "src/__support/common.h" #include "src/__support/integer_operations.h" +#include "src/__support/macros/config.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(int, abs, (int n)) { return integer_abs(n); } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/abs.h b/libc/src/stdlib/abs.h index 19cef14..56ab04b 100644 --- a/libc/src/stdlib/abs.h +++ b/libc/src/stdlib/abs.h @@ -9,10 +9,12 @@ #ifndef LLVM_LIBC_SRC_STDLIB_ABS_H #define LLVM_LIBC_SRC_STDLIB_ABS_H -namespace LIBC_NAMESPACE { +#include "src/__support/macros/config.h" + +namespace LIBC_NAMESPACE_DECL { int abs(int n); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_ABS_H diff --git a/libc/src/stdlib/aligned_alloc.h b/libc/src/stdlib/aligned_alloc.h index 7f294c8..0205c02 100644 --- a/libc/src/stdlib/aligned_alloc.h +++ b/libc/src/stdlib/aligned_alloc.h @@ -6,15 +6,16 @@ // //===----------------------------------------------------------------------===// +#include "src/__support/macros/config.h" #include <stddef.h> #ifndef LLVM_LIBC_SRC_STDLIB_ALIGNED_ALLOC_H #define LLVM_LIBC_SRC_STDLIB_ALIGNED_ALLOC_H -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { void *aligned_alloc(size_t alignment, size_t size); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_ALIGNED_ALLOC_H diff --git a/libc/src/stdlib/at_quick_exit.cpp b/libc/src/stdlib/at_quick_exit.cpp index 752d67e..7acae8c 100644 --- a/libc/src/stdlib/at_quick_exit.cpp +++ b/libc/src/stdlib/at_quick_exit.cpp @@ -9,9 +9,10 @@ #include "src/stdlib/at_quick_exit.h" #include "hdr/types/atexithandler_t.h" #include "src/__support/common.h" +#include "src/__support/macros/config.h" #include "src/stdlib/exit_handler.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(int, at_quick_exit, (__atexithandler_t callback)) { return add_atexit_unit( @@ -19,4 +20,4 @@ LLVM_LIBC_FUNCTION(int, at_quick_exit, (__atexithandler_t callback)) { {&stdc_at_exit_func, reinterpret_cast<void *>(callback)}); } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/at_quick_exit.h b/libc/src/stdlib/at_quick_exit.h index c36c797..0bfd4ff 100644 --- a/libc/src/stdlib/at_quick_exit.h +++ b/libc/src/stdlib/at_quick_exit.h @@ -10,11 +10,12 @@ #define LLVM_LIBC_SRC_STDLIB_AT_QUICK_EXIT_H #include "hdr/types/atexithandler_t.h" +#include "src/__support/macros/config.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { int at_quick_exit(__atexithandler_t); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_AT_QUICK_EXIT_H diff --git a/libc/src/stdlib/atexit.cpp b/libc/src/stdlib/atexit.cpp index ca3cbfe..6844fb7 100644 --- a/libc/src/stdlib/atexit.cpp +++ b/libc/src/stdlib/atexit.cpp @@ -9,9 +9,10 @@ #include "src/stdlib/atexit.h" #include "hdr/types/atexithandler_t.h" #include "src/__support/common.h" +#include "src/__support/macros/config.h" #include "src/stdlib/exit_handler.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { extern "C" { @@ -32,4 +33,4 @@ LLVM_LIBC_FUNCTION(int, atexit, (__atexithandler_t callback)) { {&stdc_at_exit_func, reinterpret_cast<void *>(callback)}); } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/atexit.h b/libc/src/stdlib/atexit.h index 7faaf65..39ce2dc 100644 --- a/libc/src/stdlib/atexit.h +++ b/libc/src/stdlib/atexit.h @@ -10,10 +10,12 @@ #define LLVM_LIBC_SRC_STDLIB_ATEXIT_H #include "hdr/types/atexithandler_t.h" -namespace LIBC_NAMESPACE { +#include "src/__support/macros/config.h" + +namespace LIBC_NAMESPACE_DECL { int atexit(__atexithandler_t); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_ATEXIT_H diff --git a/libc/src/stdlib/atof.cpp b/libc/src/stdlib/atof.cpp index 61eb7db..18a65c6 100644 --- a/libc/src/stdlib/atof.cpp +++ b/libc/src/stdlib/atof.cpp @@ -8,10 +8,11 @@ #include "src/stdlib/atof.h" #include "src/__support/common.h" +#include "src/__support/macros/config.h" #include "src/__support/str_to_float.h" #include "src/errno/libc_errno.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(double, atof, (const char *str)) { auto result = internal::strtofloatingpoint<double>(str); @@ -21,4 +22,4 @@ LLVM_LIBC_FUNCTION(double, atof, (const char *str)) { return result.value; } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/atof.h b/libc/src/stdlib/atof.h index cc9ae51..dfa97c3 100644 --- a/libc/src/stdlib/atof.h +++ b/libc/src/stdlib/atof.h @@ -9,10 +9,12 @@ #ifndef LLVM_LIBC_SRC_STDLIB_ATOF_H #define LLVM_LIBC_SRC_STDLIB_ATOF_H -namespace LIBC_NAMESPACE { +#include "src/__support/macros/config.h" + +namespace LIBC_NAMESPACE_DECL { double atof(const char *str); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_ATOF_H diff --git a/libc/src/stdlib/atoi.cpp b/libc/src/stdlib/atoi.cpp index d1dc320..9e46b53 100644 --- a/libc/src/stdlib/atoi.cpp +++ b/libc/src/stdlib/atoi.cpp @@ -8,10 +8,11 @@ #include "src/stdlib/atoi.h" #include "src/__support/common.h" +#include "src/__support/macros/config.h" #include "src/__support/str_to_integer.h" #include "src/errno/libc_errno.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(int, atoi, (const char *str)) { // This is done because the standard specifies that atoi is identical to @@ -23,4 +24,4 @@ LLVM_LIBC_FUNCTION(int, atoi, (const char *str)) { return static_cast<int>(result); } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/atoi.h b/libc/src/stdlib/atoi.h index fb5de31..218c051 100644 --- a/libc/src/stdlib/atoi.h +++ b/libc/src/stdlib/atoi.h @@ -9,10 +9,12 @@ #ifndef LLVM_LIBC_SRC_STDLIB_ATOI_H #define LLVM_LIBC_SRC_STDLIB_ATOI_H -namespace LIBC_NAMESPACE { +#include "src/__support/macros/config.h" + +namespace LIBC_NAMESPACE_DECL { int atoi(const char *str); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_ATOI_H diff --git a/libc/src/stdlib/atol.cpp b/libc/src/stdlib/atol.cpp index 5586db7..7f3414a 100644 --- a/libc/src/stdlib/atol.cpp +++ b/libc/src/stdlib/atol.cpp @@ -8,10 +8,11 @@ #include "src/stdlib/atol.h" #include "src/__support/common.h" +#include "src/__support/macros/config.h" #include "src/__support/str_to_integer.h" #include "src/errno/libc_errno.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(long, atol, (const char *str)) { auto result = internal::strtointeger<long>(str, 10); @@ -21,4 +22,4 @@ LLVM_LIBC_FUNCTION(long, atol, (const char *str)) { return result; } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/atol.h b/libc/src/stdlib/atol.h index 690731f..3787dc1 100644 --- a/libc/src/stdlib/atol.h +++ b/libc/src/stdlib/atol.h @@ -9,10 +9,12 @@ #ifndef LLVM_LIBC_SRC_STDLIB_ATOL_H #define LLVM_LIBC_SRC_STDLIB_ATOL_H -namespace LIBC_NAMESPACE { +#include "src/__support/macros/config.h" + +namespace LIBC_NAMESPACE_DECL { long atol(const char *str); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_ATOL_H diff --git a/libc/src/stdlib/atoll.cpp b/libc/src/stdlib/atoll.cpp index 921459d..4f1a02a 100644 --- a/libc/src/stdlib/atoll.cpp +++ b/libc/src/stdlib/atoll.cpp @@ -8,10 +8,11 @@ #include "src/stdlib/atoll.h" #include "src/__support/common.h" +#include "src/__support/macros/config.h" #include "src/__support/str_to_integer.h" #include "src/errno/libc_errno.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(long long, atoll, (const char *str)) { auto result = internal::strtointeger<long long>(str, 10); @@ -21,4 +22,4 @@ LLVM_LIBC_FUNCTION(long long, atoll, (const char *str)) { return result; } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/atoll.h b/libc/src/stdlib/atoll.h index 4746eb1..b3035fdc 100644 --- a/libc/src/stdlib/atoll.h +++ b/libc/src/stdlib/atoll.h @@ -9,10 +9,12 @@ #ifndef LLVM_LIBC_SRC_STDLIB_ATOLL_H #define LLVM_LIBC_SRC_STDLIB_ATOLL_H -namespace LIBC_NAMESPACE { +#include "src/__support/macros/config.h" + +namespace LIBC_NAMESPACE_DECL { long long atoll(const char *str); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_ATOLL_H diff --git a/libc/src/stdlib/baremetal/abort.cpp b/libc/src/stdlib/baremetal/abort.cpp index 4dd8536..98cf710 100644 --- a/libc/src/stdlib/baremetal/abort.cpp +++ b/libc/src/stdlib/baremetal/abort.cpp @@ -7,11 +7,12 @@ //===----------------------------------------------------------------------===// #include "src/__support/common.h" +#include "src/__support/macros/config.h" #include "src/stdlib/abort.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(void, abort, ()) { __builtin_trap(); } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/bsearch.cpp b/libc/src/stdlib/bsearch.cpp index 4292d6b..69b3e74 100644 --- a/libc/src/stdlib/bsearch.cpp +++ b/libc/src/stdlib/bsearch.cpp @@ -8,10 +8,11 @@ #include "src/stdlib/bsearch.h" #include "src/__support/common.h" +#include "src/__support/macros/config.h" #include <stdint.h> -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(void *, bsearch, (const void *key, const void *array, size_t array_size, @@ -44,4 +45,4 @@ LLVM_LIBC_FUNCTION(void *, bsearch, return nullptr; } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/bsearch.h b/libc/src/stdlib/bsearch.h index 3590198..cef37ea 100644 --- a/libc/src/stdlib/bsearch.h +++ b/libc/src/stdlib/bsearch.h @@ -9,13 +9,14 @@ #ifndef LLVM_LIBC_SRC_STDLIB_BSEARCH_H #define LLVM_LIBC_SRC_STDLIB_BSEARCH_H +#include "src/__support/macros/config.h" #include <stddef.h> // size_t -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { void *bsearch(const void *key, const void *array, size_t array_size, size_t elem_size, int (*compare)(const void *, const void *)); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif //LLVM_LIBC_SRC_STDLIB_BSEARCH_H diff --git a/libc/src/stdlib/calloc.h b/libc/src/stdlib/calloc.h index bdb025b..a8cf734 100644 --- a/libc/src/stdlib/calloc.h +++ b/libc/src/stdlib/calloc.h @@ -6,15 +6,16 @@ // //===----------------------------------------------------------------------===// +#include "src/__support/macros/config.h" #include <stddef.h> #ifndef LLVM_LIBC_SRC_STDLIB_CALLOC_H #define LLVM_LIBC_SRC_STDLIB_CALLOC_H -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { void *calloc(size_t num, size_t size); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_CALLOC_H diff --git a/libc/src/stdlib/div.cpp b/libc/src/stdlib/div.cpp index ee7c335..766e8ae 100644 --- a/libc/src/stdlib/div.cpp +++ b/libc/src/stdlib/div.cpp @@ -9,8 +9,9 @@ #include "src/stdlib/div.h" #include "src/__support/common.h" #include "src/__support/integer_operations.h" +#include "src/__support/macros/config.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(div_t, div, (int x, int y)) { div_t res; @@ -18,4 +19,4 @@ LLVM_LIBC_FUNCTION(div_t, div, (int x, int y)) { return res; } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/div.h b/libc/src/stdlib/div.h index 3a6853f..e76f79b 100644 --- a/libc/src/stdlib/div.h +++ b/libc/src/stdlib/div.h @@ -9,12 +9,13 @@ #ifndef LLVM_LIBC_SRC_STDLIB_DIV_H #define LLVM_LIBC_SRC_STDLIB_DIV_H +#include "src/__support/macros/config.h" #include <stdlib.h> -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { div_t div(int x, int y); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_DIV_H diff --git a/libc/src/stdlib/exit.cpp b/libc/src/stdlib/exit.cpp index 1afeec5..28a6f8a 100644 --- a/libc/src/stdlib/exit.cpp +++ b/libc/src/stdlib/exit.cpp @@ -9,8 +9,9 @@ #include "src/stdlib/exit.h" #include "src/__support/OSUtil/exit.h" #include "src/__support/common.h" +#include "src/__support/macros/config.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { extern "C" void __cxa_finalize(void *); @@ -19,4 +20,4 @@ extern "C" void __cxa_finalize(void *); internal::exit(status); } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/exit.h b/libc/src/stdlib/exit.h index b135735..1f0153b 100644 --- a/libc/src/stdlib/exit.h +++ b/libc/src/stdlib/exit.h @@ -9,12 +9,13 @@ #ifndef LLVM_LIBC_SRC_STDLIB_EXIT_H #define LLVM_LIBC_SRC_STDLIB_EXIT_H +#include "src/__support/macros/config.h" #include <stdlib.h> -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { [[noreturn]] void exit(int status); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_EXIT_H diff --git a/libc/src/stdlib/exit_handler.cpp b/libc/src/stdlib/exit_handler.cpp index ed41247..ed0751a 100644 --- a/libc/src/stdlib/exit_handler.cpp +++ b/libc/src/stdlib/exit_handler.cpp @@ -8,8 +8,9 @@ #include "src/stdlib/exit_handler.h" #include "src/__support/CPP/mutex.h" // lock_guard +#include "src/__support/macros/config.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { constinit ExitCallbackList at_quick_exit_callbacks; constinit ExitCallbackList atexit_callbacks; @@ -39,4 +40,4 @@ int add_atexit_unit(ExitCallbackList &callbacks, const AtExitUnit &unit) { return -1; } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/exit_handler.h b/libc/src/stdlib/exit_handler.h index 8494c2f..41733b7 100644 --- a/libc/src/stdlib/exit_handler.h +++ b/libc/src/stdlib/exit_handler.h @@ -13,9 +13,10 @@ #include "src/__support/blockstore.h" #include "src/__support/common.h" #include "src/__support/fixedvector.h" +#include "src/__support/macros/config.h" #include "src/__support/threads/mutex.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { using AtExitCallback = void(void *); using StdCAtExitCallback = void(void); @@ -48,6 +49,6 @@ void call_exit_callbacks(ExitCallbackList &callbacks); int add_atexit_unit(ExitCallbackList &callbacks, const AtExitUnit &unit); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_EXIT_HANDLER_H diff --git a/libc/src/stdlib/free.h b/libc/src/stdlib/free.h index b3970fd..1b250f3 100644 --- a/libc/src/stdlib/free.h +++ b/libc/src/stdlib/free.h @@ -6,15 +6,16 @@ // //===----------------------------------------------------------------------===// +#include "src/__support/macros/config.h" #include <stdlib.h> #ifndef LLVM_LIBC_SRC_STDLIB_FREE_H #define LLVM_LIBC_SRC_STDLIB_FREE_H -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { void free(void *ptr); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_FREE_H diff --git a/libc/src/stdlib/freelist_malloc.cpp b/libc/src/stdlib/freelist_malloc.cpp index 684c447..cfffa04 100644 --- a/libc/src/stdlib/freelist_malloc.cpp +++ b/libc/src/stdlib/freelist_malloc.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #include "src/__support/freelist_heap.h" +#include "src/__support/macros/config.h" #include "src/stdlib/aligned_alloc.h" #include "src/stdlib/calloc.h" #include "src/stdlib/free.h" @@ -15,7 +16,7 @@ #include <stddef.h> -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { namespace { #ifdef LIBC_FREELIST_MALLOC_SIZE @@ -47,4 +48,4 @@ LLVM_LIBC_FUNCTION(void *, aligned_alloc, (size_t alignment, size_t size)) { return freelist_heap->aligned_allocate(alignment, size); } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/getenv.cpp b/libc/src/stdlib/getenv.cpp index 7a8eb19..6b1bb69 100644 --- a/libc/src/stdlib/getenv.cpp +++ b/libc/src/stdlib/getenv.cpp @@ -10,10 +10,11 @@ #include "config/linux/app.h" #include "src/__support/CPP/string_view.h" #include "src/__support/common.h" +#include "src/__support/macros/config.h" #include <stddef.h> // For size_t. -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(char *, getenv, (const char *name)) { char **env_ptr = reinterpret_cast<char **>(LIBC_NAMESPACE::app.env_ptr); @@ -41,4 +42,4 @@ LLVM_LIBC_FUNCTION(char *, getenv, (const char *name)) { return nullptr; } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/getenv.h b/libc/src/stdlib/getenv.h index adb386b..a5d41fe 100644 --- a/libc/src/stdlib/getenv.h +++ b/libc/src/stdlib/getenv.h @@ -9,10 +9,12 @@ #ifndef LLVM_LIBC_SRC_STDLIB_GETENV_H #define LLVM_LIBC_SRC_STDLIB_GETENV_H -namespace LIBC_NAMESPACE { +#include "src/__support/macros/config.h" + +namespace LIBC_NAMESPACE_DECL { char *getenv(const char *name); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_GETENV_H diff --git a/libc/src/stdlib/gpu/abort.cpp b/libc/src/stdlib/gpu/abort.cpp index f3b052b..fee1986 100644 --- a/libc/src/stdlib/gpu/abort.cpp +++ b/libc/src/stdlib/gpu/abort.cpp @@ -8,10 +8,11 @@ #include "src/__support/RPC/rpc_client.h" #include "src/__support/common.h" +#include "src/__support/macros/config.h" #include "src/stdlib/abort.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(void, abort, ()) { // We want to first make sure the server is listening before we abort. @@ -23,4 +24,4 @@ LLVM_LIBC_FUNCTION(void, abort, ()) { gpu::end_program(); } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/gpu/free.cpp b/libc/src/stdlib/gpu/free.cpp index fb5703b..1f0e9ec 100644 --- a/libc/src/stdlib/gpu/free.cpp +++ b/libc/src/stdlib/gpu/free.cpp @@ -10,9 +10,10 @@ #include "src/__support/GPU/allocator.h" #include "src/__support/common.h" +#include "src/__support/macros/config.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(void, free, (void *ptr)) { gpu::deallocate(ptr); } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/gpu/malloc.cpp b/libc/src/stdlib/gpu/malloc.cpp index 9355823..54f2d88 100644 --- a/libc/src/stdlib/gpu/malloc.cpp +++ b/libc/src/stdlib/gpu/malloc.cpp @@ -10,11 +10,12 @@ #include "src/__support/GPU/allocator.h" #include "src/__support/common.h" +#include "src/__support/macros/config.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(void *, malloc, (size_t size)) { return gpu::allocate(size); } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/labs.cpp b/libc/src/stdlib/labs.cpp index d9237fa..a8265e4 100644 --- a/libc/src/stdlib/labs.cpp +++ b/libc/src/stdlib/labs.cpp @@ -9,9 +9,10 @@ #include "src/stdlib/labs.h" #include "src/__support/common.h" #include "src/__support/integer_operations.h" +#include "src/__support/macros/config.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(long, labs, (long n)) { return integer_abs(n); } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/labs.h b/libc/src/stdlib/labs.h index b7af538..c15af79 100644 --- a/libc/src/stdlib/labs.h +++ b/libc/src/stdlib/labs.h @@ -9,10 +9,12 @@ #ifndef LLVM_LIBC_SRC_STDLIB_LABS_H #define LLVM_LIBC_SRC_STDLIB_LABS_H -namespace LIBC_NAMESPACE { +#include "src/__support/macros/config.h" + +namespace LIBC_NAMESPACE_DECL { long labs(long n); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_LABS_H diff --git a/libc/src/stdlib/ldiv.cpp b/libc/src/stdlib/ldiv.cpp index 57e2250..94f385f 100644 --- a/libc/src/stdlib/ldiv.cpp +++ b/libc/src/stdlib/ldiv.cpp @@ -9,8 +9,9 @@ #include "src/stdlib/ldiv.h" #include "src/__support/common.h" #include "src/__support/integer_operations.h" +#include "src/__support/macros/config.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(ldiv_t, ldiv, (long x, long y)) { ldiv_t res; @@ -18,4 +19,4 @@ LLVM_LIBC_FUNCTION(ldiv_t, ldiv, (long x, long y)) { return res; } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/ldiv.h b/libc/src/stdlib/ldiv.h index 0f0fafa..56b71fd 100644 --- a/libc/src/stdlib/ldiv.h +++ b/libc/src/stdlib/ldiv.h @@ -9,12 +9,13 @@ #ifndef LLVM_LIBC_SRC_STDLIB_LDIV_H #define LLVM_LIBC_SRC_STDLIB_LDIV_H +#include "src/__support/macros/config.h" #include <stdlib.h> -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { ldiv_t ldiv(long x, long y); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_LDIV_H diff --git a/libc/src/stdlib/linux/abort.cpp b/libc/src/stdlib/linux/abort.cpp index 59feec3..d78ea67 100644 --- a/libc/src/stdlib/linux/abort.cpp +++ b/libc/src/stdlib/linux/abort.cpp @@ -7,12 +7,13 @@ //===----------------------------------------------------------------------===// #include "src/__support/common.h" +#include "src/__support/macros/config.h" #include "src/signal/raise.h" #include "src/stdlib/_Exit.h" #include "src/stdlib/abort.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(void, abort, ()) { // TODO: When sigprocmask and sigaction land: @@ -27,4 +28,4 @@ LLVM_LIBC_FUNCTION(void, abort, ()) { LIBC_NAMESPACE::_Exit(127); } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/llabs.cpp b/libc/src/stdlib/llabs.cpp index f42c2b8..09636f1 100644 --- a/libc/src/stdlib/llabs.cpp +++ b/libc/src/stdlib/llabs.cpp @@ -9,9 +9,10 @@ #include "src/stdlib/llabs.h" #include "src/__support/common.h" #include "src/__support/integer_operations.h" +#include "src/__support/macros/config.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(long long, llabs, (long long n)) { return integer_abs(n); } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/llabs.h b/libc/src/stdlib/llabs.h index 953fe17..b0cabdd 100644 --- a/libc/src/stdlib/llabs.h +++ b/libc/src/stdlib/llabs.h @@ -9,10 +9,12 @@ #ifndef LLVM_LIBC_SRC_STDLIB_LLABS_H #define LLVM_LIBC_SRC_STDLIB_LLABS_H -namespace LIBC_NAMESPACE { +#include "src/__support/macros/config.h" + +namespace LIBC_NAMESPACE_DECL { long long llabs(long long n); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_LLABS_H diff --git a/libc/src/stdlib/lldiv.cpp b/libc/src/stdlib/lldiv.cpp index ff2fdf8..f55a4f6 100644 --- a/libc/src/stdlib/lldiv.cpp +++ b/libc/src/stdlib/lldiv.cpp @@ -9,8 +9,9 @@ #include "src/stdlib/lldiv.h" #include "src/__support/common.h" #include "src/__support/integer_operations.h" +#include "src/__support/macros/config.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(lldiv_t, lldiv, (long long x, long long y)) { lldiv_t res; @@ -18,4 +19,4 @@ LLVM_LIBC_FUNCTION(lldiv_t, lldiv, (long long x, long long y)) { return res; } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/lldiv.h b/libc/src/stdlib/lldiv.h index ee7f4d3..ad688e0 100644 --- a/libc/src/stdlib/lldiv.h +++ b/libc/src/stdlib/lldiv.h @@ -8,12 +8,13 @@ #ifndef LLVM_LIBC_SRC_STDLIB_LLDIV_H #define LLVM_LIBC_SRC_STDLIB_LLDIV_H +#include "src/__support/macros/config.h" #include <stdlib.h> -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { lldiv_t lldiv(long long x, long long y); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_LLDIV_H diff --git a/libc/src/stdlib/malloc.h b/libc/src/stdlib/malloc.h index 514e2b1..1974f5d 100644 --- a/libc/src/stdlib/malloc.h +++ b/libc/src/stdlib/malloc.h @@ -6,15 +6,16 @@ // //===----------------------------------------------------------------------===// +#include "src/__support/macros/config.h" #include <stdlib.h> #ifndef LLVM_LIBC_SRC_STDLIB_MALLOC_H #define LLVM_LIBC_SRC_STDLIB_MALLOC_H -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { void *malloc(size_t size); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_MALLOC_H diff --git a/libc/src/stdlib/qsort.cpp b/libc/src/stdlib/qsort.cpp index f040f37..048e63ab 100644 --- a/libc/src/stdlib/qsort.cpp +++ b/libc/src/stdlib/qsort.cpp @@ -8,11 +8,12 @@ #include "src/stdlib/qsort.h" #include "src/__support/common.h" +#include "src/__support/macros/config.h" #include "src/stdlib/qsort_util.h" #include <stdint.h> -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(void, qsort, (void *array, size_t array_size, size_t elem_size, @@ -24,4 +25,4 @@ LLVM_LIBC_FUNCTION(void, qsort, array_size, elem_size, c)); } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/qsort.h b/libc/src/stdlib/qsort.h index 5c78481..3898831 100644 --- a/libc/src/stdlib/qsort.h +++ b/libc/src/stdlib/qsort.h @@ -9,13 +9,14 @@ #ifndef LLVM_LIBC_SRC_STDLIB_QSORT_H #define LLVM_LIBC_SRC_STDLIB_QSORT_H +#include "src/__support/macros/config.h" #include <stdlib.h> -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { void qsort(void *array, size_t array_size, size_t elem_size, int (*compare)(const void *, const void *)); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_QSORT_H diff --git a/libc/src/stdlib/qsort_r.cpp b/libc/src/stdlib/qsort_r.cpp index 7589918..efbe5ad 100644 --- a/libc/src/stdlib/qsort_r.cpp +++ b/libc/src/stdlib/qsort_r.cpp @@ -8,11 +8,12 @@ #include "src/stdlib/qsort_r.h" #include "src/__support/common.h" +#include "src/__support/macros/config.h" #include "src/stdlib/qsort_util.h" #include <stdint.h> -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(void, qsort_r, (void *array, size_t array_size, size_t elem_size, @@ -25,4 +26,4 @@ LLVM_LIBC_FUNCTION(void, qsort_r, array_size, elem_size, c)); } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/qsort_r.h b/libc/src/stdlib/qsort_r.h index fab0576..574968a 100644 --- a/libc/src/stdlib/qsort_r.h +++ b/libc/src/stdlib/qsort_r.h @@ -9,9 +9,10 @@ #ifndef LLVM_LIBC_SRC_STDLIB_QSORT_R_H #define LLVM_LIBC_SRC_STDLIB_QSORT_R_H +#include "src/__support/macros/config.h" #include <stdlib.h> -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { // 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 +22,6 @@ namespace LIBC_NAMESPACE { void qsort_r(void *array, size_t array_size, size_t elem_size, int (*compare)(const void *, const void *, void *), void *arg); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #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 f4b8094..3a9cc4b 100644 --- a/libc/src/stdlib/qsort_util.h +++ b/libc/src/stdlib/qsort_util.h @@ -10,10 +10,12 @@ #define LLVM_LIBC_SRC_STDLIB_QSORT_UTIL_H #include "src/__support/macros/attributes.h" +#include "src/__support/macros/config.h" #include <stdint.h> #include <stdlib.h> -namespace LIBC_NAMESPACE::internal { +namespace LIBC_NAMESPACE_DECL { +namespace internal { // A simple quicksort implementation using the Hoare partition scheme. @@ -147,6 +149,7 @@ LIBC_INLINE void quicksort(const Array &array) { quicksort(array.make_array(split_index, array.size() - split_index)); } -} // namespace LIBC_NAMESPACE::internal +} // namespace internal +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_QSORT_UTIL_H diff --git a/libc/src/stdlib/quick_exit.cpp b/libc/src/stdlib/quick_exit.cpp index 38f0a3d..a5abf3e 100644 --- a/libc/src/stdlib/quick_exit.cpp +++ b/libc/src/stdlib/quick_exit.cpp @@ -9,10 +9,11 @@ #include "src/stdlib/quick_exit.h" #include "src/__support/OSUtil/exit.h" #include "src/__support/common.h" +#include "src/__support/macros/config.h" #include "src/stdlib/exit_handler.h" // extern "C" void __cxa_finalize(void *); -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { extern ExitCallbackList at_quick_exit_callbacks; @@ -21,4 +22,4 @@ extern ExitCallbackList at_quick_exit_callbacks; internal::exit(status); } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/quick_exit.h b/libc/src/stdlib/quick_exit.h index 9a3c20c..f41bbaa 100644 --- a/libc/src/stdlib/quick_exit.h +++ b/libc/src/stdlib/quick_exit.h @@ -9,10 +9,12 @@ #ifndef LLVM_LIBC_SRC_STDLIB_QUICK_EXIT_H #define LLVM_LIBC_SRC_STDLIB_QUICK_EXIT_H -namespace LIBC_NAMESPACE { +#include "src/__support/macros/config.h" + +namespace LIBC_NAMESPACE_DECL { [[noreturn]] void quick_exit(int status); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_QUICK_EXIT_H diff --git a/libc/src/stdlib/rand.cpp b/libc/src/stdlib/rand.cpp index ff3875c..1931727e 100644 --- a/libc/src/stdlib/rand.cpp +++ b/libc/src/stdlib/rand.cpp @@ -8,10 +8,11 @@ #include "src/stdlib/rand.h" #include "src/__support/common.h" +#include "src/__support/macros/config.h" #include "src/__support/threads/sleep.h" #include "src/stdlib/rand_util.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { // An implementation of the xorshift64star pseudo random number generator. This // is a good general purpose generator for most non-cryptographics applications. @@ -29,4 +30,4 @@ LLVM_LIBC_FUNCTION(int, rand, (void)) { } } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/rand.h b/libc/src/stdlib/rand.h index 72bb147..df217b5 100644 --- a/libc/src/stdlib/rand.h +++ b/libc/src/stdlib/rand.h @@ -9,12 +9,13 @@ #ifndef LLVM_LIBC_SRC_STDLIB_RAND_H #define LLVM_LIBC_SRC_STDLIB_RAND_H +#include "src/__support/macros/config.h" #include <stdlib.h> -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { int rand(void); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_RAND_H diff --git a/libc/src/stdlib/rand_util.cpp b/libc/src/stdlib/rand_util.cpp index ff3478db..c05bdc7 100644 --- a/libc/src/stdlib/rand_util.cpp +++ b/libc/src/stdlib/rand_util.cpp @@ -9,11 +9,12 @@ #include "src/stdlib/rand_util.h" #include "src/__support/CPP/atomic.h" #include "src/__support/macros/attributes.h" +#include "src/__support/macros/config.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { // 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'. cpp::Atomic<unsigned long> rand_next = 1; -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/rand_util.h b/libc/src/stdlib/rand_util.h index 5d7febf..8bf7e58 100644 --- a/libc/src/stdlib/rand_util.h +++ b/libc/src/stdlib/rand_util.h @@ -11,14 +11,15 @@ #include "src/__support/CPP/atomic.h" #include "src/__support/macros/attributes.h" +#include "src/__support/macros/config.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { // The ISO C standard does not explicitly require thread-safe behavior for the // generic `rand()` function. Some implementations expect it however, so we // provide it here. extern cpp::Atomic<unsigned long> rand_next; -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_RAND_UTIL_H diff --git a/libc/src/stdlib/realloc.h b/libc/src/stdlib/realloc.h index 6e025fa..4d675a6 100644 --- a/libc/src/stdlib/realloc.h +++ b/libc/src/stdlib/realloc.h @@ -6,15 +6,16 @@ // //===----------------------------------------------------------------------===// +#include "src/__support/macros/config.h" #include <stddef.h> #ifndef LLVM_LIBC_SRC_STDLIB_REALLOC_H #define LLVM_LIBC_SRC_STDLIB_REALLOC_H -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { void *realloc(void *ptr, size_t size); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_REALLOC_H diff --git a/libc/src/stdlib/srand.cpp b/libc/src/stdlib/srand.cpp index 21166c7..d11c18e 100644 --- a/libc/src/stdlib/srand.cpp +++ b/libc/src/stdlib/srand.cpp @@ -8,12 +8,13 @@ #include "src/stdlib/srand.h" #include "src/__support/common.h" +#include "src/__support/macros/config.h" #include "src/stdlib/rand_util.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(void, srand, (unsigned int seed)) { rand_next.store(seed, cpp::MemoryOrder::RELAXED); } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/srand.h b/libc/src/stdlib/srand.h index 1bcf8de..c9fce46 100644 --- a/libc/src/stdlib/srand.h +++ b/libc/src/stdlib/srand.h @@ -9,12 +9,13 @@ #ifndef LLVM_LIBC_SRC_STDLIB_SRAND_H #define LLVM_LIBC_SRC_STDLIB_SRAND_H +#include "src/__support/macros/config.h" #include <stdlib.h> -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { void srand(unsigned int seed); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_SRAND_H diff --git a/libc/src/stdlib/str_from_util.h b/libc/src/stdlib/str_from_util.h index 58afa98..7f54bdf 100644 --- a/libc/src/stdlib/str_from_util.h +++ b/libc/src/stdlib/str_from_util.h @@ -18,6 +18,7 @@ #define LLVM_LIBC_SRC_STDLIB_STRFROM_UTIL_H #include "src/__support/CPP/type_traits.h" +#include "src/__support/macros/config.h" #include "src/__support/str_to_integer.h" #include "src/stdio/printf_core/converter_atlas.h" #include "src/stdio/printf_core/core_structs.h" @@ -25,7 +26,8 @@ #include <stddef.h> -namespace LIBC_NAMESPACE::internal { +namespace LIBC_NAMESPACE_DECL { +namespace internal { template <typename T> using storage_type = typename fputil::FPBits<T>::StorageType; @@ -133,6 +135,7 @@ int strfromfloat_convert(printf_core::Writer *writer, return -1; } -} // namespace LIBC_NAMESPACE::internal +} // namespace internal +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_STRFROM_UTIL_H diff --git a/libc/src/stdlib/strfromd.cpp b/libc/src/stdlib/strfromd.cpp index 329f6fd..4c51e4c 100644 --- a/libc/src/stdlib/strfromd.cpp +++ b/libc/src/stdlib/strfromd.cpp @@ -7,9 +7,10 @@ //===----------------------------------------------------------------------===// #include "src/stdlib/strfromd.h" +#include "src/__support/macros/config.h" #include "src/stdlib/str_from_util.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(int, strfromd, (char *__restrict s, size_t n, const char *__restrict format, @@ -36,4 +37,4 @@ LLVM_LIBC_FUNCTION(int, strfromd, return writer.get_chars_written(); } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/strfromd.h b/libc/src/stdlib/strfromd.h index d2c3fef..8a68ff5 100644 --- a/libc/src/stdlib/strfromd.h +++ b/libc/src/stdlib/strfromd.h @@ -9,13 +9,14 @@ #ifndef LLVM_LIBC_SRC_STDLIB_STRFROMD_H #define LLVM_LIBC_SRC_STDLIB_STRFROMD_H +#include "src/__support/macros/config.h" #include <stddef.h> -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { int strfromd(char *__restrict s, size_t n, const char *__restrict format, double fp); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_STRFROMD_H diff --git a/libc/src/stdlib/strfromf.cpp b/libc/src/stdlib/strfromf.cpp index 80e1d74..ea98a69 100644 --- a/libc/src/stdlib/strfromf.cpp +++ b/libc/src/stdlib/strfromf.cpp @@ -7,9 +7,10 @@ //===----------------------------------------------------------------------===// #include "src/stdlib/strfromf.h" +#include "src/__support/macros/config.h" #include "src/stdlib/str_from_util.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(int, strfromf, (char *__restrict s, size_t n, const char *__restrict format, @@ -36,4 +37,4 @@ LLVM_LIBC_FUNCTION(int, strfromf, return writer.get_chars_written(); } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/strfromf.h b/libc/src/stdlib/strfromf.h index 492c2c3..e65e6b3 100644 --- a/libc/src/stdlib/strfromf.h +++ b/libc/src/stdlib/strfromf.h @@ -9,13 +9,14 @@ #ifndef LLVM_LIBC_SRC_STDLIB_STRFROMF_H #define LLVM_LIBC_SRC_STDLIB_STRFROMF_H +#include "src/__support/macros/config.h" #include <stddef.h> -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { int strfromf(char *__restrict s, size_t n, const char *__restrict format, float fp); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_STRFROMF_H diff --git a/libc/src/stdlib/strfroml.cpp b/libc/src/stdlib/strfroml.cpp index f0bc935..d5bee76 100644 --- a/libc/src/stdlib/strfroml.cpp +++ b/libc/src/stdlib/strfroml.cpp @@ -7,9 +7,10 @@ //===----------------------------------------------------------------------===// #include "src/stdlib/strfroml.h" +#include "src/__support/macros/config.h" #include "src/stdlib/str_from_util.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(int, strfroml, (char *__restrict s, size_t n, const char *__restrict format, @@ -41,4 +42,4 @@ LLVM_LIBC_FUNCTION(int, strfroml, return writer.get_chars_written(); } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/strfroml.h b/libc/src/stdlib/strfroml.h index e99d035..1bff12e 100644 --- a/libc/src/stdlib/strfroml.h +++ b/libc/src/stdlib/strfroml.h @@ -9,13 +9,14 @@ #ifndef LLVM_LIBC_SRC_STDLIB_STRFROML_H #define LLVM_LIBC_SRC_STDLIB_STRFROML_H +#include "src/__support/macros/config.h" #include <stddef.h> -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { int strfroml(char *__restrict s, size_t n, const char *__restrict format, long double fp); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_STRFROML_H diff --git a/libc/src/stdlib/strtod.cpp b/libc/src/stdlib/strtod.cpp index 461f7fe..2c68191 100644 --- a/libc/src/stdlib/strtod.cpp +++ b/libc/src/stdlib/strtod.cpp @@ -8,10 +8,11 @@ #include "src/stdlib/strtod.h" #include "src/__support/common.h" +#include "src/__support/macros/config.h" #include "src/__support/str_to_float.h" #include "src/errno/libc_errno.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(double, strtod, (const char *__restrict str, char **__restrict str_end)) { @@ -25,4 +26,4 @@ LLVM_LIBC_FUNCTION(double, strtod, return result.value; } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/strtod.h b/libc/src/stdlib/strtod.h index 5efad84..1a32e38 100644 --- a/libc/src/stdlib/strtod.h +++ b/libc/src/stdlib/strtod.h @@ -9,10 +9,12 @@ #ifndef LLVM_LIBC_SRC_STDLIB_STRTOD_H #define LLVM_LIBC_SRC_STDLIB_STRTOD_H -namespace LIBC_NAMESPACE { +#include "src/__support/macros/config.h" + +namespace LIBC_NAMESPACE_DECL { double strtod(const char *__restrict str, char **__restrict str_end); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_STRTOD_H diff --git a/libc/src/stdlib/strtof.cpp b/libc/src/stdlib/strtof.cpp index 554d096..351bf64 100644 --- a/libc/src/stdlib/strtof.cpp +++ b/libc/src/stdlib/strtof.cpp @@ -8,10 +8,11 @@ #include "src/stdlib/strtof.h" #include "src/__support/common.h" +#include "src/__support/macros/config.h" #include "src/__support/str_to_float.h" #include "src/errno/libc_errno.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(float, strtof, (const char *__restrict str, char **__restrict str_end)) { @@ -25,4 +26,4 @@ LLVM_LIBC_FUNCTION(float, strtof, return result.value; } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/strtof.h b/libc/src/stdlib/strtof.h index d800b22..2e7645f 100644 --- a/libc/src/stdlib/strtof.h +++ b/libc/src/stdlib/strtof.h @@ -9,10 +9,12 @@ #ifndef LLVM_LIBC_SRC_STDLIB_STRTOF_H #define LLVM_LIBC_SRC_STDLIB_STRTOF_H -namespace LIBC_NAMESPACE { +#include "src/__support/macros/config.h" + +namespace LIBC_NAMESPACE_DECL { float strtof(const char *__restrict str, char **__restrict str_end); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_STRTOF_H diff --git a/libc/src/stdlib/strtol.cpp b/libc/src/stdlib/strtol.cpp index e9bedf2..77f8712 100644 --- a/libc/src/stdlib/strtol.cpp +++ b/libc/src/stdlib/strtol.cpp @@ -8,10 +8,11 @@ #include "src/stdlib/strtol.h" #include "src/__support/common.h" +#include "src/__support/macros/config.h" #include "src/__support/str_to_integer.h" #include "src/errno/libc_errno.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(long, strtol, (const char *__restrict str, char **__restrict str_end, @@ -26,4 +27,4 @@ LLVM_LIBC_FUNCTION(long, strtol, return result; } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/strtol.h b/libc/src/stdlib/strtol.h index c46c650..54779d4 100644 --- a/libc/src/stdlib/strtol.h +++ b/libc/src/stdlib/strtol.h @@ -9,10 +9,12 @@ #ifndef LLVM_LIBC_SRC_STDLIB_STRTOL_H #define LLVM_LIBC_SRC_STDLIB_STRTOL_H -namespace LIBC_NAMESPACE { +#include "src/__support/macros/config.h" + +namespace LIBC_NAMESPACE_DECL { long strtol(const char *__restrict str, char **__restrict str_end, int base); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_STRTOL_H diff --git a/libc/src/stdlib/strtold.cpp b/libc/src/stdlib/strtold.cpp index 9c3e1db..88d29c9 100644 --- a/libc/src/stdlib/strtold.cpp +++ b/libc/src/stdlib/strtold.cpp @@ -8,10 +8,11 @@ #include "src/stdlib/strtold.h" #include "src/__support/common.h" +#include "src/__support/macros/config.h" #include "src/__support/str_to_float.h" #include "src/errno/libc_errno.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(long double, strtold, (const char *__restrict str, char **__restrict str_end)) { @@ -25,4 +26,4 @@ LLVM_LIBC_FUNCTION(long double, strtold, return result.value; } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/strtold.h b/libc/src/stdlib/strtold.h index 6a0b5d4..4b663ca 100644 --- a/libc/src/stdlib/strtold.h +++ b/libc/src/stdlib/strtold.h @@ -9,10 +9,12 @@ #ifndef LLVM_LIBC_SRC_STDLIB_STRTOLD_H #define LLVM_LIBC_SRC_STDLIB_STRTOLD_H -namespace LIBC_NAMESPACE { +#include "src/__support/macros/config.h" + +namespace LIBC_NAMESPACE_DECL { long double strtold(const char *__restrict str, char **__restrict str_end); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_STRTOLD_H diff --git a/libc/src/stdlib/strtoll.cpp b/libc/src/stdlib/strtoll.cpp index 99e8205..8d1b3ef 100644 --- a/libc/src/stdlib/strtoll.cpp +++ b/libc/src/stdlib/strtoll.cpp @@ -8,10 +8,11 @@ #include "src/stdlib/strtoll.h" #include "src/__support/common.h" +#include "src/__support/macros/config.h" #include "src/__support/str_to_integer.h" #include "src/errno/libc_errno.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(long long, strtoll, (const char *__restrict str, char **__restrict str_end, @@ -26,4 +27,4 @@ LLVM_LIBC_FUNCTION(long long, strtoll, return result; } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/strtoll.h b/libc/src/stdlib/strtoll.h index d699785..399c20b 100644 --- a/libc/src/stdlib/strtoll.h +++ b/libc/src/stdlib/strtoll.h @@ -9,11 +9,13 @@ #ifndef LLVM_LIBC_SRC_STDLIB_STRTOLL_H #define LLVM_LIBC_SRC_STDLIB_STRTOLL_H -namespace LIBC_NAMESPACE { +#include "src/__support/macros/config.h" + +namespace LIBC_NAMESPACE_DECL { long long strtoll(const char *__restrict str, char **__restrict str_end, int base); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_STRTOLL_H diff --git a/libc/src/stdlib/strtoul.cpp b/libc/src/stdlib/strtoul.cpp index f50ed7e..1d83231 100644 --- a/libc/src/stdlib/strtoul.cpp +++ b/libc/src/stdlib/strtoul.cpp @@ -8,10 +8,11 @@ #include "src/stdlib/strtoul.h" #include "src/__support/common.h" +#include "src/__support/macros/config.h" #include "src/__support/str_to_integer.h" #include "src/errno/libc_errno.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(unsigned long, strtoul, (const char *__restrict str, char **__restrict str_end, @@ -26,4 +27,4 @@ LLVM_LIBC_FUNCTION(unsigned long, strtoul, return result; } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/strtoul.h b/libc/src/stdlib/strtoul.h index af83992..ca1911a 100644 --- a/libc/src/stdlib/strtoul.h +++ b/libc/src/stdlib/strtoul.h @@ -9,11 +9,13 @@ #ifndef LLVM_LIBC_SRC_STDLIB_STRTOUL_H #define LLVM_LIBC_SRC_STDLIB_STRTOUL_H -namespace LIBC_NAMESPACE { +#include "src/__support/macros/config.h" + +namespace LIBC_NAMESPACE_DECL { unsigned long strtoul(const char *__restrict str, char **__restrict str_end, int base); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_STRTOUL_H diff --git a/libc/src/stdlib/strtoull.cpp b/libc/src/stdlib/strtoull.cpp index de3a0d0..dba2261 100644 --- a/libc/src/stdlib/strtoull.cpp +++ b/libc/src/stdlib/strtoull.cpp @@ -8,10 +8,11 @@ #include "src/stdlib/strtoull.h" #include "src/__support/common.h" +#include "src/__support/macros/config.h" #include "src/__support/str_to_integer.h" #include "src/errno/libc_errno.h" -namespace LIBC_NAMESPACE { +namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(unsigned long long, strtoull, (const char *__restrict str, char **__restrict str_end, @@ -26,4 +27,4 @@ LLVM_LIBC_FUNCTION(unsigned long long, strtoull, return result; } -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/stdlib/strtoull.h b/libc/src/stdlib/strtoull.h index 47ed101..58801e5 100644 --- a/libc/src/stdlib/strtoull.h +++ b/libc/src/stdlib/strtoull.h @@ -9,11 +9,13 @@ #ifndef LLVM_LIBC_SRC_STDLIB_STRTOULL_H #define LLVM_LIBC_SRC_STDLIB_STRTOULL_H -namespace LIBC_NAMESPACE { +#include "src/__support/macros/config.h" + +namespace LIBC_NAMESPACE_DECL { unsigned long long strtoull(const char *__restrict str, char **__restrict str_end, int base); -} // namespace LIBC_NAMESPACE +} // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_STDLIB_STRTOULL_H |