[llvm] [libc] [libc][NFC] Fix missing LIBC_INLINE + style (PR #73659)

Guillaume Chatelet via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 7 01:09:53 PST 2023


================
@@ -24,74 +26,74 @@ constexpr unsigned long long ULLONG_MAX = ~0ULL;
 
 template <class T> class numeric_limits {
 public:
-  static constexpr T max();
-  static constexpr T min();
+  LIBC_INLINE static constexpr T max();
+  LIBC_INLINE static constexpr T min();
 };
 
 // TODO: Add numeric_limits specializations as needed for new types.
 
 template <> class numeric_limits<int> {
 public:
-  static constexpr int max() { return INT_MAX; }
-  static constexpr int min() { return INT_MIN; }
+  LIBC_INLINE static constexpr int max() { return INT_MAX; }
----------------
gchatelet wrote:

As of today, the clang-tidy makes sure that `LIBC_INLINE` is in first position. This makes sense given Fuchsia' s definition but this makes it impossible to use `LIBC_INLINE` functions with attributes: e.g.:
```
[[nodiscard]] LIBC_INLINE constexpr int countl_zero(T value) ; // clang-tidy unhappy
```
```
LIBC_INLINE [[nodiscard]] constexpr int countl_zero(T value) ; // clang unhappy
```

https://github.com/llvm/llvm-project/pull/73659


More information about the llvm-commits mailing list