[libc-commits] [libc] aefeb5f - [libc][NFC] Make __support/common.h an in tree header.

Siva Chandra Reddy via libc-commits libc-commits at lists.llvm.org
Mon Jan 11 13:11:09 PST 2021


Author: Siva Chandra Reddy
Date: 2021-01-11T13:10:56-08:00
New Revision: aefeb5f136e7b72b251ce2881cb39a1fe8f0d76a

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

LOG: [libc][NFC] Make __support/common.h an in tree header.

It was previously a generated header. It can easily converted to a
generated header if required in future.

Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D94445

Added: 
    libc/src/__support/common.h

Modified: 
    libc/src/__support/CMakeLists.txt

Removed: 
    libc/src/__support/common.h.def


################################################################################
diff  --git a/libc/src/__support/CMakeLists.txt b/libc/src/__support/CMakeLists.txt
index e9f9579b6d0f..980b510e374c 100644
--- a/libc/src/__support/CMakeLists.txt
+++ b/libc/src/__support/CMakeLists.txt
@@ -1,9 +1,5 @@
-add_gen_header(
+add_header_library(
   common
-  DEF_FILE common.h.def
-  PARAMS
-    platform_defs=../../config/${LIBC_TARGET_OS}/platform_defs.h.inc
-  GEN_HDR common.h
-  DATA_FILES
-    ../../config/${LIBC_TARGET_OS}/platform_defs.h.inc
+  HDRS
+    common.h
 )

diff  --git a/libc/src/__support/common.h.def b/libc/src/__support/common.h
similarity index 54%
rename from libc/src/__support/common.h.def
rename to libc/src/__support/common.h
index d2d18c696dff..208c8bdfea41 100644
--- a/libc/src/__support/common.h.def
+++ b/libc/src/__support/common.h
@@ -11,22 +11,22 @@
 
 #define LIBC_INLINE_ASM __asm__ __volatile__
 
-#define likely(x) __builtin_expect (!!(x), 1)
-#define unlikely(x) __builtin_expect (x, 0)
+#define likely(x) __builtin_expect(!!(x), 1)
+#define unlikely(x) __builtin_expect(x, 0)
 #define UNUSED __attribute__((unused))
 
 #ifndef LLVM_LIBC_FUNCTION_ATTR
-  #define LLVM_LIBC_FUNCTION_ATTR
+#define LLVM_LIBC_FUNCTION_ATTR
 #endif
 
 #ifdef LLVM_LIBC_PUBLIC_PACKAGING
-#define LLVM_LIBC_FUNCTION(type, name, arglist) \
-  LLVM_LIBC_FUNCTION_ATTR decltype(__llvm_libc::name) __##name##_impl__ __asm__(#name); \
-  decltype(__llvm_libc::name) name [[gnu::alias(#name)]]; \
-  type __##name##_impl__ arglist                                        
+#define LLVM_LIBC_FUNCTION(type, name, arglist)                                \
+  LLVM_LIBC_FUNCTION_ATTR decltype(__llvm_libc::name)                          \
+      __##name##_impl__ __asm__(#name);                                        \
+  decltype(__llvm_libc::name) name [[gnu::alias(#name)]];                      \
+  type __##name##_impl__ arglist
 #else
-#define LLVM_LIBC_FUNCTION(type, name, arglist)\
-  type name arglist
+#define LLVM_LIBC_FUNCTION(type, name, arglist) type name arglist
 #endif
 
 #endif // LLVM_LIBC_SUPPORT_COMMON_H


        


More information about the libc-commits mailing list