[libc-commits] [libc] 1ae4bd8 - [libc][NFC] Move compiler_features to macros folder

Guillaume Chatelet via libc-commits libc-commits at lists.llvm.org
Tue Feb 7 02:40:27 PST 2023


Author: Guillaume Chatelet
Date: 2023-02-07T10:40:13Z
New Revision: 1ae4bd83ce2ac9d8a32493bbc5612bc19c374a49

URL: https://github.com/llvm/llvm-project/commit/1ae4bd83ce2ac9d8a32493bbc5612bc19c374a49
DIFF: https://github.com/llvm/llvm-project/commit/1ae4bd83ce2ac9d8a32493bbc5612bc19c374a49.diff

LOG: [libc][NFC] Move compiler_features to macros folder

Added: 
    libc/src/__support/macros/compiler_features.h

Modified: 
    libc/src/__support/CMakeLists.txt
    libc/src/__support/CPP/bit.h
    libc/src/__support/builtin_wrappers.h
    libc/src/__support/sanitizer.h
    libc/src/string/memory_utils/op_generic.h
    libc/src/string/memory_utils/utils.h
    libc/test/src/string/memory_utils/memory_check_utils.h
    utils/bazel/llvm-project-overlay/libc/BUILD.bazel

Removed: 
    libc/src/__support/compiler_features.h


################################################################################
diff  --git a/libc/src/__support/CMakeLists.txt b/libc/src/__support/CMakeLists.txt
index a937e5bdb90d1..78e3018308500 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 4617e25d6dee3..8af0976517f18 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 e41808e1b94df..c28d2ada0dfb8 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 fed57592067b6..04c1bbdd34e02 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 186e765abcaf2..47c130eea97eb 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 70d234d9c2bb2..7d827fd202c69 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 8e5ddd6723cea..d83cd0c6f6b8b 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 <stddef.h> // size_t
 #include <stdint.h> // 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 4fd565aa0e97d..f548a1f89ad67 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.h> // assert
 #include <stddef.h> // size_t

diff  --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index c87482c19e9f7..dbfb31ca083ad 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(


        


More information about the libc-commits mailing list