aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Desaulniers <ndesaulniers@google.com>2024-04-17 09:49:59 -0700
committerNick Desaulniers <ndesaulniers@google.com>2024-04-17 10:50:41 -0700
commitc574f79afaaad84c62e2e03d9a4894392358db74 (patch)
tree6c8ba70a0c0385e2d76dde5121c106b42b9b922a
parentd73b7b3e2424a67ee2753dad820e2ad375db20d1 (diff)
downloadbionic-c574f79afaaad84c62e2e03d9a4894392358db74.tar.gz
Clean up __always_inline
While studying the implementation of POSIX pthread_rwlock* functions, I noticed that two functions were marked __always_inline twice. "They must really mean it this time." Also add back `inline` keyword to one other usage of __always_inline to be consistent with other uses of __always_inline throughout the codebase. Change-Id: Ibf9eaed5fc9fd03afcdd969cff82dec71a8ce30f
-rw-r--r--libc/arch-riscv64/dynamic_function_dispatch.cpp2
-rw-r--r--libc/bionic/pthread_rwlock.cpp5
-rw-r--r--libc/malloc_debug/malloc_debug.cpp2
3 files changed, 5 insertions, 4 deletions
diff --git a/libc/arch-riscv64/dynamic_function_dispatch.cpp b/libc/arch-riscv64/dynamic_function_dispatch.cpp
index 265ce3ee6..bb2ba5101 100644
--- a/libc/arch-riscv64/dynamic_function_dispatch.cpp
+++ b/libc/arch-riscv64/dynamic_function_dispatch.cpp
@@ -35,7 +35,7 @@
extern "C" {
-static __always_inline int ifunc_faccessat(int dir_fd, const char* path, int mode) {
+static inline __always_inline int ifunc_faccessat(int dir_fd, const char* path, int mode) {
register long a0 __asm__("a0") = dir_fd;
register long a1 __asm__("a1") = reinterpret_cast<long>(path);
register long a2 __asm__("a2") = mode;
diff --git a/libc/bionic/pthread_rwlock.cpp b/libc/bionic/pthread_rwlock.cpp
index ebf6697a0..6f3c6feb8 100644
--- a/libc/bionic/pthread_rwlock.cpp
+++ b/libc/bionic/pthread_rwlock.cpp
@@ -69,11 +69,12 @@
#define RWLOCKATTR_KIND_MASK 2
#define RWLOCKATTR_RESERVED_MASK (~3)
-static inline __always_inline __always_inline bool __rwlockattr_getpshared(const pthread_rwlockattr_t* attr) {
+static inline __always_inline bool __rwlockattr_getpshared(const pthread_rwlockattr_t* attr) {
return (*attr & RWLOCKATTR_PSHARED_MASK) >> RWLOCKATTR_PSHARED_SHIFT;
}
-static inline __always_inline __always_inline void __rwlockattr_setpshared(pthread_rwlockattr_t* attr, int pshared) {
+static inline __always_inline void __rwlockattr_setpshared(pthread_rwlockattr_t* attr,
+ int pshared) {
*attr = (*attr & ~RWLOCKATTR_PSHARED_MASK) | (pshared << RWLOCKATTR_PSHARED_SHIFT);
}
diff --git a/libc/malloc_debug/malloc_debug.cpp b/libc/malloc_debug/malloc_debug.cpp
index 3731a5d26..b66b8e27f 100644
--- a/libc/malloc_debug/malloc_debug.cpp
+++ b/libc/malloc_debug/malloc_debug.cpp
@@ -70,7 +70,7 @@ bool* g_zygote_child;
const MallocDispatch* g_dispatch;
-static __always_inline uint64_t Nanotime() {
+static inline __always_inline uint64_t Nanotime() {
struct timespec t = {};
clock_gettime(CLOCK_MONOTONIC, &t);
return static_cast<uint64_t>(t.tv_sec) * 1000000000LL + t.tv_nsec;