[libc-commits] [PATCH] D150731: [libc] Fix definition and use of LIBC_INLINE macro

Roland McGrath via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue May 16 15:11:56 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2c874d2128e3: [libc] Fix definition and use of LIBC_INLINE macro (authored by mcgrathr).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150731/new/

https://reviews.llvm.org/D150731

Files:
  libc/src/__support/endian.h
  libc/src/__support/macros/config.h
  libc/src/__support/macros/optimization.h


Index: libc/src/__support/macros/optimization.h
===================================================================
--- libc/src/__support/macros/optimization.h
+++ libc/src/__support/macros/optimization.h
@@ -10,6 +10,7 @@
 #ifndef LLVM_LIBC_SRC_SUPPORT_MACROS_OPTIMIZATION_H
 #define LLVM_LIBC_SRC_SUPPORT_MACROS_OPTIMIZATION_H
 
+#include "src/__support/macros/attributes.h"          // LIBC_INLINE
 #include "src/__support/macros/config.h"              // LIBC_HAS_BUILTIN
 #include "src/__support/macros/properties/compiler.h" // LIBC_COMPILER_IS_CLANG
 
@@ -17,7 +18,7 @@
 // accidentally pass an integer.
 namespace __llvm_libc::details {
 template <typename T>
-constexpr LIBC_INLINE bool expects_bool_condition(T value, T expected) {
+LIBC_INLINE constexpr bool expects_bool_condition(T value, T expected) {
   return __builtin_expect(value, expected);
 }
 } // namespace __llvm_libc::details
Index: libc/src/__support/macros/config.h
===================================================================
--- libc/src/__support/macros/config.h
+++ libc/src/__support/macros/config.h
@@ -13,8 +13,6 @@
 #ifndef LLVM_LIBC_SUPPORT_MACROS_CONFIG_H
 #define LLVM_LIBC_SUPPORT_MACROS_CONFIG_H
 
-#define LIBC_INLINE inline
-
 // LIBC_HAS_BUILTIN()
 //
 // Checks whether the compiler supports a Clang Feature Checking Macro, and if
Index: libc/src/__support/endian.h
===================================================================
--- libc/src/__support/endian.h
+++ libc/src/__support/endian.h
@@ -32,8 +32,8 @@
 template <unsigned ORDER> struct Endian {
   static constexpr const bool IS_LITTLE = ORDER == __ORDER_LITTLE_ENDIAN__;
   static constexpr const bool IS_BIG = ORDER == __ORDER_BIG_ENDIAN__;
-  template <typename T> static T to_big_endian(T value);
-  template <typename T> static T to_little_endian(T value);
+  template <typename T> LIBC_INLINE static T to_big_endian(T value);
+  template <typename T> LIBC_INLINE static T to_little_endian(T value);
 };
 
 // Little Endian specializations


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150731.522809.patch
Type: text/x-patch
Size: 2011 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230516/0fc2eda0/attachment.bin>


More information about the libc-commits mailing list