From 1ae4bd83ce2ac9d8a32493bbc5612bc19c374a49 Mon Sep 17 00:00:00 2001 From: Guillaume Chatelet Date: Tue, 7 Feb 2023 10:40:08 +0000 Subject: [PATCH] [libc][NFC] Move compiler_features to macros folder --- libc/src/__support/CMakeLists.txt | 2 +- libc/src/__support/CPP/bit.h | 2 +- libc/src/__support/builtin_wrappers.h | 2 +- .../src/__support/{ => macros}/compiler_features.h | 22 +++++++++++----------- libc/src/__support/sanitizer.h | 2 +- libc/src/string/memory_utils/op_generic.h | 2 +- libc/src/string/memory_utils/utils.h | 2 +- .../src/string/memory_utils/memory_check_utils.h | 2 +- utils/bazel/llvm-project-overlay/libc/BUILD.bazel | 2 +- 9 files changed, 19 insertions(+), 19 deletions(-) rename libc/src/__support/{ => macros}/compiler_features.h (68%) diff --git a/libc/src/__support/CMakeLists.txt b/libc/src/__support/CMakeLists.txt index a937e5b..78e3018 100644 --- a/libc/src/__support/CMakeLists.txt +++ b/libc/src/__support/CMakeLists.txt @@ -17,7 +17,7 @@ add_header_library( add_header_library( compiler_features HDRS - compiler_features.h + macros/compiler_features.h ) add_header_library( diff --git a/libc/src/__support/CPP/bit.h b/libc/src/__support/CPP/bit.h index 4617e25..8af0976 100644 --- a/libc/src/__support/CPP/bit.h +++ b/libc/src/__support/CPP/bit.h @@ -9,7 +9,7 @@ #ifndef LLVM_LIBC_SUPPORT_CPP_BIT_H #define LLVM_LIBC_SUPPORT_CPP_BIT_H -#include "src/__support/compiler_features.h" +#include "src/__support/macros/compiler_features.h" namespace __llvm_libc::cpp { diff --git a/libc/src/__support/builtin_wrappers.h b/libc/src/__support/builtin_wrappers.h index e41808e..c28d2ad 100644 --- a/libc/src/__support/builtin_wrappers.h +++ b/libc/src/__support/builtin_wrappers.h @@ -13,7 +13,7 @@ #include "named_pair.h" #include "src/__support/CPP/type_traits.h" #include "src/__support/common.h" -#include "src/__support/compiler_features.h" +#include "src/__support/macros/compiler_features.h" namespace __llvm_libc { diff --git a/libc/src/__support/compiler_features.h b/libc/src/__support/macros/compiler_features.h similarity index 68% rename from libc/src/__support/compiler_features.h rename to libc/src/__support/macros/compiler_features.h index fed5759..04c1bbdd 100644 --- a/libc/src/__support/compiler_features.h +++ b/libc/src/__support/macros/compiler_features.h @@ -6,25 +6,25 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_SUPPORT_COMPILER_FEATURES_H -#define LLVM_LIBC_SUPPORT_COMPILER_FEATURES_H +#ifndef LLVM_LIBC_SUPPORT_MACROS_COMPILER_FEATURES_H +#define LLVM_LIBC_SUPPORT_MACROS_COMPILER_FEATURES_H #if defined(__clang__) -#define LLVM_LIBC_COMPILER_CLANG +#define LIBC_COMPILER_IS_CLANG #endif #if defined(__GNUC__) && !defined(__clang__) -#define LLVM_LIBC_COMPILER_GCC +#define LIBC_COMPILER_IS_GCC #endif #if defined(_MSC_VER) -#define LLVM_LIBC_COMPILER_MSC +#define LIBC_COMPILER_IS_MSC #endif // Compiler builtin-detection. // clang.llvm.org/docs/LanguageExtensions.html#has-builtin -#if defined(LLVM_LIBC_COMPILER_CLANG) || \ - (defined(LLVM_LIBC_COMPILER_GCC) && (__GNUC__ >= 10)) +#if defined(LIBC_COMPILER_IS_CLANG) || \ + (defined(LIBC_COMPILER_IS_GCC) && (__GNUC__ >= 10)) #define LLVM_LIBC_HAS_BUILTIN(BUILTIN) __has_builtin(BUILTIN) #else #define LLVM_LIBC_HAS_BUILTIN(BUILTIN) 0 @@ -32,18 +32,18 @@ // Compiler feature-detection. // clang.llvm.org/docs/LanguageExtensions.html#has-feature-and-has-extension -#if defined(LLVM_LIBC_COMPILER_CLANG) +#if defined(LIBC_COMPILER_IS_CLANG) #define LLVM_LIBC_HAS_FEATURE(FEATURE) __has_feature(FEATURE) #else #define LLVM_LIBC_HAS_FEATURE(FEATURE) 0 #endif -#if defined(LLVM_LIBC_COMPILER_CLANG) +#if defined(LIBC_COMPILER_IS_CLANG) #define LLVM_LIBC_LOOP_NOUNROLL _Pragma("nounroll") -#elif defined(LLVM_LIBC_COMPILER_GCC) +#elif defined(LIBC_COMPILER_IS_GCC) #define LLVM_LIBC_LOOP_NOUNROLL _Pragma("GCC unroll 0") #else #define LLVM_LIBC_LOOP_NOUNROLL #endif -#endif // LLVM_LIBC_SUPPORT_COMPILER_FEATURES_H +#endif // LLVM_LIBC_SUPPORT_MACROS_COMPILER_FEATURES_H diff --git a/libc/src/__support/sanitizer.h b/libc/src/__support/sanitizer.h index 186e765..47c130e 100644 --- a/libc/src/__support/sanitizer.h +++ b/libc/src/__support/sanitizer.h @@ -9,7 +9,7 @@ #ifndef LLVM_LIBC_SRC_SUPPORT_SANITIZER_H #define LLVM_LIBC_SRC_SUPPORT_SANITIZER_H -#include "src/__support/compiler_features.h" +#include "src/__support/macros/compiler_features.h" // MemorySanitizer (MSan) is a detector of uninitialized reads. It consists of // a compiler instrumentation module and a run-time library. diff --git a/libc/src/string/memory_utils/op_generic.h b/libc/src/string/memory_utils/op_generic.h index 70d234d..7d827fd 100644 --- a/libc/src/string/memory_utils/op_generic.h +++ b/libc/src/string/memory_utils/op_generic.h @@ -26,8 +26,8 @@ #include "src/__support/CPP/array.h" #include "src/__support/CPP/type_traits.h" #include "src/__support/common.h" -#include "src/__support/compiler_features.h" #include "src/__support/endian.h" +#include "src/__support/macros/compiler_features.h" #include "src/string/memory_utils/op_builtin.h" #include "src/string/memory_utils/utils.h" diff --git a/libc/src/string/memory_utils/utils.h b/libc/src/string/memory_utils/utils.h index 8e5ddd6..d83cd0c 100644 --- a/libc/src/string/memory_utils/utils.h +++ b/libc/src/string/memory_utils/utils.h @@ -13,7 +13,7 @@ #include "src/__support/CPP/cstddef.h" #include "src/__support/CPP/type_traits.h" #include "src/__support/common.h" -#include "src/__support/compiler_features.h" +#include "src/__support/macros/compiler_features.h" #include // size_t #include // intptr_t / uintptr_t 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 4fd565a..f548a1f 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,7 @@ #define LIBC_TEST_SRC_STRING_MEMORY_UTILS_MEMORY_CHECK_UTILS_H #include "src/__support/CPP/span.h" -#include "src/__support/compiler_features.h" +#include "src/__support/macros/compiler_features.h" #include "src/string/memory_utils/utils.h" #include // assert #include // size_t diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel index c87482c..dbfb31c 100644 --- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel @@ -62,7 +62,7 @@ cc_library( libc_support_library( name = "__support_compiler_features", - hdrs = ["src/__support/compiler_features.h"], + hdrs = ["src/__support/macros/compiler_features.h"], ) libc_support_library( -- 2.7.4