[libc-commits] [libc] e2f8c55 - [libc][NFC] separate macros in several targets
Guillaume Chatelet via libc-commits
libc-commits at lists.llvm.org
Thu Feb 9 02:51:28 PST 2023
Author: Guillaume Chatelet
Date: 2023-02-09T10:51:19Z
New Revision: e2f8c5566426198c79367893decfda31fea6f57c
URL: https://github.com/llvm/llvm-project/commit/e2f8c5566426198c79367893decfda31fea6f57c
DIFF: https://github.com/llvm/llvm-project/commit/e2f8c5566426198c79367893decfda31fea6f57c.diff
LOG: [libc][NFC] separate macros in several targets
Added:
libc/src/__support/macros/CMakeLists.txt
libc/src/__support/macros/properties/CMakeLists.txt
Modified:
libc/src/__support/CMakeLists.txt
libc/src/__support/CPP/CMakeLists.txt
libc/src/__support/FPUtil/CMakeLists.txt
libc/src/__support/FPUtil/FEnvImpl.h
libc/src/__support/FPUtil/aarch64/FEnvImpl.h
libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
libc/src/__support/FPUtil/x86_64/FEnvImpl.h
libc/src/__support/UInt.h
libc/src/__support/builtin_wrappers.h
libc/src/string/memory_utils/CMakeLists.txt
libc/src/string/memory_utils/utils.h
libc/test/src/string/CMakeLists.txt
libc/test/src/string/memory_utils/CMakeLists.txt
libc/test/src/string/memory_utils/memory_check_utils.h
utils/bazel/llvm-project-overlay/libc/BUILD.bazel
utils/bazel/llvm-project-overlay/libc/test/src/string/BUILD.bazel
Removed:
################################################################################
diff --git a/libc/src/__support/CMakeLists.txt b/libc/src/__support/CMakeLists.txt
index 67663bf201152..3ff22bbd592cb 100644
--- a/libc/src/__support/CMakeLists.txt
+++ b/libc/src/__support/CMakeLists.txt
@@ -1,4 +1,5 @@
add_subdirectory(CPP)
+add_subdirectory(macros)
add_header_library(
blockstore
@@ -14,20 +15,6 @@ add_header_library(
named_pair.h
)
-add_header_library(
- compiler_features
- HDRS
- macros/properties/compiler.h
-)
-
-add_header_library(
- sanitizer
- HDRS
- macros/sanitizer.h
- DEPENDS
- libc.src.__support.compiler_features
-)
-
add_header_library(
common
HDRS
@@ -44,9 +31,9 @@ add_header_library(
builtin_wrappers.h
DEPENDS
.named_pair
- libc.src.__support.common
- libc.src.__support.compiler_features
libc.src.__support.CPP.type_traits
+ libc.src.__support.macros.attributes
+ libc.src.__support.macros.properties.compiler
)
add_header_library(
@@ -192,6 +179,7 @@ add_header_library(
.integer_utils
libc.src.__support.CPP.array
libc.src.__support.CPP.type_traits
+ libc.src.__support.macros.attributes
)
add_header_library(
diff --git a/libc/src/__support/CPP/CMakeLists.txt b/libc/src/__support/CPP/CMakeLists.txt
index e242d4e424fb0..11041142627bb 100644
--- a/libc/src/__support/CPP/CMakeLists.txt
+++ b/libc/src/__support/CPP/CMakeLists.txt
@@ -9,7 +9,7 @@ add_header_library(
HDRS
bit.h
DEPENDS
- libc.src.__support.compiler_features
+ libc.src.__support.macros.properties.compiler
)
add_header_library(
diff --git a/libc/src/__support/FPUtil/CMakeLists.txt b/libc/src/__support/FPUtil/CMakeLists.txt
index 401dcaa3c389e..bd9faa72d5cb8 100644
--- a/libc/src/__support/FPUtil/CMakeLists.txt
+++ b/libc/src/__support/FPUtil/CMakeLists.txt
@@ -4,8 +4,9 @@ add_header_library(
FEnvImpl.h
DEPENDS
libc.include.fenv
- libc.src.__support.common
- libc.src.__support.compiler_features
+ libc.src.__support.macros.attributes
+ libc.src.__support.macros.properties.architectures
+ libc.src.__support.macros.sanitizer
)
add_header_library(
diff --git a/libc/src/__support/FPUtil/FEnvImpl.h b/libc/src/__support/FPUtil/FEnvImpl.h
index 129935e798c31..f24e273066c47 100644
--- a/libc/src/__support/FPUtil/FEnvImpl.h
+++ b/libc/src/__support/FPUtil/FEnvImpl.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_SUPPORT_FPUTIL_FENVIMPL_H
#define LLVM_LIBC_SRC_SUPPORT_FPUTIL_FENVIMPL_H
-#include "src/__support/common.h"
+#include "src/__support/macros/attributes.h" // LIBC_INLINE
#include "src/__support/macros/properties/architectures.h"
#if defined(LIBC_TARGET_ARCH_IS_AARCH64)
diff --git a/libc/src/__support/FPUtil/aarch64/FEnvImpl.h b/libc/src/__support/FPUtil/aarch64/FEnvImpl.h
index 3bf4c7baf7a0d..e43c718e6ca5c 100644
--- a/libc/src/__support/FPUtil/aarch64/FEnvImpl.h
+++ b/libc/src/__support/FPUtil/aarch64/FEnvImpl.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_SUPPORT_FPUTIL_AARCH64_FENVIMPL_H
#define LLVM_LIBC_SRC_SUPPORT_FPUTIL_AARCH64_FENVIMPL_H
-#include "src/__support/common.h"
+#include "src/__support/macros/attributes.h" // LIBC_INLINE
#include "src/__support/macros/properties/architectures.h"
#if !defined(LIBC_TARGET_ARCH_IS_AARCH64) || defined(__APPLE__)
diff --git a/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h b/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
index 38ae3f8b9b684..ae6ff787aea19 100644
--- a/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
+++ b/libc/src/__support/FPUtil/aarch64/fenv_darwin_impl.h
@@ -9,7 +9,7 @@
#ifndef LLVM_LIBC_SRC_SUPPORT_FPUTIL_AARCH64_FENV_DARWIN_IMPL_H
#define LLVM_LIBC_SRC_SUPPORT_FPUTIL_AARCH64_FENV_DARWIN_IMPL_H
-#include "src/__support/common.h"
+#include "src/__support/macros/attributes.h" // LIBC_INLINE
#include "src/__support/macros/properties/architectures.h"
#if !defined(LIBC_TARGET_ARCH_IS_AARCH64) || !defined(__APPLE__)
diff --git a/libc/src/__support/FPUtil/x86_64/FEnvImpl.h b/libc/src/__support/FPUtil/x86_64/FEnvImpl.h
index 4e9e723ecf575..5a496f631b011 100644
--- a/libc/src/__support/FPUtil/x86_64/FEnvImpl.h
+++ b/libc/src/__support/FPUtil/x86_64/FEnvImpl.h
@@ -9,6 +9,7 @@
#ifndef LLVM_LIBC_SRC_SUPPORT_FPUTIL_X86_64_FENVIMPL_H
#define LLVM_LIBC_SRC_SUPPORT_FPUTIL_X86_64_FENVIMPL_H
+#include "src/__support/macros/attributes.h" // LIBC_INLINE
#include "src/__support/macros/properties/architectures.h"
#if !defined(LIBC_TARGET_ARCH_IS_X86)
diff --git a/libc/src/__support/UInt.h b/libc/src/__support/UInt.h
index d369576a17553..ee1e540801cdf 100644
--- a/libc/src/__support/UInt.h
+++ b/libc/src/__support/UInt.h
@@ -14,8 +14,8 @@
#include "src/__support/CPP/optional.h"
#include "src/__support/CPP/type_traits.h"
#include "src/__support/builtin_wrappers.h"
-#include "src/__support/common.h"
#include "src/__support/integer_utils.h"
+#include "src/__support/macros/attributes.h" // LIBC_UNLIKELY
#include "src/__support/number_pair.h"
#include <stddef.h> // For size_t
diff --git a/libc/src/__support/builtin_wrappers.h b/libc/src/__support/builtin_wrappers.h
index 81f6622d197a0..a46e9572a3870 100644
--- a/libc/src/__support/builtin_wrappers.h
+++ b/libc/src/__support/builtin_wrappers.h
@@ -12,8 +12,8 @@
#include "named_pair.h"
#include "src/__support/CPP/type_traits.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/properties/compiler.h"
+#include "src/__support/macros/attributes.h" // LIBC_INLINE
+#include "src/__support/macros/properties/compiler.h" // LIBC_HAS_BUILTIN
namespace __llvm_libc {
diff --git a/libc/src/__support/macros/CMakeLists.txt b/libc/src/__support/macros/CMakeLists.txt
new file mode 100644
index 0000000000000..1b3728856676a
--- /dev/null
+++ b/libc/src/__support/macros/CMakeLists.txt
@@ -0,0 +1,15 @@
+add_subdirectory(properties)
+
+add_header_library(
+ attributes
+ HDRS
+ attributes.h
+)
+
+add_header_library(
+ sanitizer
+ HDRS
+ sanitizer.h
+ DEPENDS
+ libc.src.__support.macros.properties.compiler
+)
diff --git a/libc/src/__support/macros/properties/CMakeLists.txt b/libc/src/__support/macros/properties/CMakeLists.txt
new file mode 100644
index 0000000000000..8ddd16a1e3669
--- /dev/null
+++ b/libc/src/__support/macros/properties/CMakeLists.txt
@@ -0,0 +1,17 @@
+add_header_library(
+ architectures
+ HDRS
+ architectures.h
+)
+
+add_header_library(
+ compiler
+ HDRS
+ compiler.h
+)
+
+add_header_library(
+ cpu_features
+ HDRS
+ cpu_features.h
+)
diff --git a/libc/src/string/memory_utils/CMakeLists.txt b/libc/src/string/memory_utils/CMakeLists.txt
index 9a4df7c950837..97d314d607ec3 100644
--- a/libc/src/string/memory_utils/CMakeLists.txt
+++ b/libc/src/string/memory_utils/CMakeLists.txt
@@ -15,7 +15,7 @@ add_header_library(
utils.h
DEPS
libc.src.__support.common
- libc.src.__support.compiler_features
+ libc.src.__support.macros.properties.compiler
libc.src.__support.CPP.bit
libc.src.__support.CPP.cstddef
libc.src.__support.CPP.type_traits
diff --git a/libc/src/string/memory_utils/utils.h b/libc/src/string/memory_utils/utils.h
index 5d42641296a19..e90016f814cf0 100644
--- a/libc/src/string/memory_utils/utils.h
+++ b/libc/src/string/memory_utils/utils.h
@@ -12,8 +12,8 @@
#include "src/__support/CPP/bit.h"
#include "src/__support/CPP/cstddef.h"
#include "src/__support/CPP/type_traits.h"
-#include "src/__support/common.h"
-#include "src/__support/macros/properties/compiler.h"
+#include "src/__support/macros/attributes.h" //LIBC_INLINE
+#include "src/__support/macros/properties/compiler.h" // LIBC_HAS_BUILTIN
#include <stddef.h> // size_t
#include <stdint.h> // intptr_t / uintptr_t
diff --git a/libc/test/src/string/CMakeLists.txt b/libc/test/src/string/CMakeLists.txt
index f7a0e9aa16119..c9623a330b1c2 100644
--- a/libc/test/src/string/CMakeLists.txt
+++ b/libc/test/src/string/CMakeLists.txt
@@ -367,7 +367,7 @@ function(add_libc_multi_impl_test name)
${ARGN}
DEPENDS
${fq_config_name}
- libc.src.__support.sanitizer
+ libc.src.__support.macros.sanitizer
)
get_fq_target_name(${fq_config_name}_test fq_target_name)
else()
diff --git a/libc/test/src/string/memory_utils/CMakeLists.txt b/libc/test/src/string/memory_utils/CMakeLists.txt
index c06058e04b7da..e222a616321bb 100644
--- a/libc/test/src/string/memory_utils/CMakeLists.txt
+++ b/libc/test/src/string/memory_utils/CMakeLists.txt
@@ -9,9 +9,9 @@ add_libc_unittest(
${LIBC_COMPILE_OPTIONS_NATIVE}
-ffreestanding
DEPENDS
- libc.src.__support.compiler_features
libc.src.__support.CPP.array
libc.src.__support.CPP.cstddef
libc.src.__support.CPP.span
+ libc.src.__support.macros.sanitizer
libc.src.string.memory_utils.memory_utils
)
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 19cbe0cf5ae60..325cba30c61bb 100644
--- a/libc/test/src/string/memory_utils/memory_check_utils.h
+++ b/libc/test/src/string/memory_utils/memory_check_utils.h
@@ -10,7 +10,6 @@
#define LIBC_TEST_SRC_STRING_MEMORY_UTILS_MEMORY_CHECK_UTILS_H
#include "src/__support/CPP/span.h"
-#include "src/__support/macros/properties/compiler.h"
#include "src/__support/macros/sanitizer.h"
#include "src/string/memory_utils/utils.h"
#include <assert.h> // assert
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index dbed8e43926d3..a63110be660c2 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -61,18 +61,33 @@ cc_library(
############################## Support libraries #############################
libc_support_library(
- name = "__support_compiler_features",
+ name = "__support_macros_properties_architectures",
+ hdrs = ["src/__support/macros/properties/architectures.h"],
+ deps = [":libc_root"],
+)
+
+libc_support_library(
+ name = "__support_macros_properties_compiler",
hdrs = ["src/__support/macros/properties/compiler.h"],
deps = [":libc_root"],
)
libc_support_library(
- name = "__support_sanitizer",
+ name = "__support_macros_properties_cpu_features",
+ hdrs = ["src/__support/macros/properties/cpu_features.h"],
+ deps = [":libc_root"],
+)
+
+libc_support_library(
+ name = "__support_macros_attributes",
+ hdrs = ["src/__support/macros/attributes.h"],
+ deps = [":libc_root"],
+)
+
+libc_support_library(
+ name = "__support_macros_sanitizer",
hdrs = ["src/__support/macros/sanitizer.h"],
- deps = [
- ":__support_compiler_features",
- ":libc_root",
- ],
+ deps = [":libc_root"],
)
libc_support_library(
@@ -80,11 +95,12 @@ libc_support_library(
hdrs = [
"src/__support/common.h",
"src/__support/endian.h",
- "src/__support/macros/attributes.h",
- "src/__support/macros/properties/architectures.h",
- "src/__support/macros/properties/cpu_features.h",
],
- deps = [":libc_root"],
+ deps = [
+ ":__support_macros_attributes",
+ ":__support_macros_properties_architectures",
+ ":libc_root",
+ ],
)
libc_support_library(
@@ -97,7 +113,7 @@ libc_support_library(
name = "__support_cpp_bit",
hdrs = ["src/__support/CPP/bit.h"],
deps = [
- ":__support_compiler_features",
+ ":__support_macros_properties_compiler",
":libc_root",
],
)
@@ -205,13 +221,12 @@ libc_support_library(
hdrs = ["src/__support/UInt.h"],
deps = [
"__support_builtin_wrappers",
- "__support_common",
- "__support_compiler_features",
"__support_cpp_array",
"__support_cpp_limits",
"__support_cpp_optional",
"__support_cpp_type_traits",
"__support_integer_utils",
+ "__support_macros_attributes",
"__support_number_pair",
":libc_root",
],
@@ -277,9 +292,9 @@ libc_support_library(
name = "__support_builtin_wrappers",
hdrs = ["src/__support/builtin_wrappers.h"],
deps = [
- ":__support_common",
- ":__support_compiler_features",
":__support_cpp_type_traits",
+ ":__support_macros_attributes",
+ ":__support_macros_properties_compiler",
":__support_named_pair",
":libc_root",
],
@@ -318,10 +333,10 @@ libc_support_library(
"src/__support/FPUtil/aarch64/fenv_darwin_impl.h",
],
deps = [
- ":__support_common",
- ":__support_compiler_features",
":__support_fputil_fp_bits",
- ":__support_sanitizer",
+ ":__support_macros_attributes",
+ ":__support_macros_properties_architectures",
+ ":__support_macros_sanitizer",
":libc_root",
],
)
@@ -473,6 +488,7 @@ libc_support_library(
":__support_fputil_fenv_impl",
":__support_fputil_float_properties",
":__support_fputil_fp_bits",
+ ":__support_macros_properties_cpu_features",
":__support_uint128",
":libc_root",
],
@@ -1345,11 +1361,12 @@ libc_support_library(
],
deps = [
":__support_common",
- ":__support_compiler_features",
":__support_cpp_array",
":__support_cpp_bit",
":__support_cpp_cstddef",
":__support_cpp_type_traits",
+ ":__support_macros_attributes",
+ ":__support_macros_properties_compiler",
":libc_root",
],
)
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/string/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/string/BUILD.bazel
index 21a9d61fae783..78e8b3a89f348 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/string/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/string/BUILD.bazel
@@ -111,7 +111,7 @@ cc_library(
hdrs = ["memory_utils/memory_check_utils.h"],
deps = [
"//libc:__support_cpp_span",
- "//libc:__support_sanitizer",
+ "//libc:__support_macros_sanitizer",
"//libc:string_memory_utils",
],
)
More information about the libc-commits
mailing list