summaryrefslogtreecommitdiff
path: root/libc/src/__support/macros
diff options
context:
space:
mode:
authorPetr Hosek <phosek@google.com>2024-07-12 09:28:41 -0700
committerGitHub <noreply@github.com>2024-07-12 09:28:41 -0700
commit5ff3ff33ff930e4ec49da7910612d8a41eb068cb (patch)
treeffb876db6deb2dfd4c6c0c11ddf692db75082f7f /libc/src/__support/macros
parentdd866040aeb2703debacc141f60429ea0f567146 (diff)
[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98597)
This is a part of #97655.
Diffstat (limited to 'libc/src/__support/macros')
-rw-r--r--libc/src/__support/macros/config.h1
-rw-r--r--libc/src/__support/macros/optimization.h7
2 files changed, 6 insertions, 2 deletions
diff --git a/libc/src/__support/macros/config.h b/libc/src/__support/macros/config.h
index 2ab0fba095e6..8b1263e08249 100644
--- a/libc/src/__support/macros/config.h
+++ b/libc/src/__support/macros/config.h
@@ -15,6 +15,7 @@
// Workaround for compilers that do not support builtin detection.
// FIXME: This is only required for the GPU portion which should be moved.
+#include "src/__support/macros/config.h"
#ifndef __has_builtin
#define __has_builtin(b) 0
#endif
diff --git a/libc/src/__support/macros/optimization.h b/libc/src/__support/macros/optimization.h
index 05a47791deed..5ffd474d35c5 100644
--- a/libc/src/__support/macros/optimization.h
+++ b/libc/src/__support/macros/optimization.h
@@ -11,16 +11,19 @@
#define LLVM_LIBC_SRC___SUPPORT_MACROS_OPTIMIZATION_H
#include "src/__support/macros/attributes.h" // LIBC_INLINE
+#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/compiler.h" // LIBC_COMPILER_IS_CLANG
// We use a template to implement likely/unlikely to make sure that we don't
// accidentally pass an integer.
-namespace LIBC_NAMESPACE::details {
+namespace LIBC_NAMESPACE_DECL {
+namespace details {
template <typename T>
LIBC_INLINE constexpr bool expects_bool_condition(T value, T expected) {
return __builtin_expect(value, expected);
}
-} // namespace LIBC_NAMESPACE::details
+} // namespace details
+} // namespace LIBC_NAMESPACE_DECL
#define LIBC_LIKELY(x) LIBC_NAMESPACE::details::expects_bool_condition(x, true)
#define LIBC_UNLIKELY(x) \
LIBC_NAMESPACE::details::expects_bool_condition(x, false)