Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8097002e authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Check if ALWAYS_INLINE is already defined" into main

parents 75800c9c 593b19b5
Loading
Loading
Loading
Loading
+17 −11
Original line number Original line Diff line number Diff line
@@ -37,7 +37,9 @@
# endif // !WEAKS_AVAILABLE
# endif // !WEAKS_AVAILABLE
#endif // CALLSTACK_WEAK predefined
#endif // CALLSTACK_WEAK predefined


#define ALWAYS_INLINE __attribute__((always_inline))
#ifndef CALLSTACK_ALWAYS_INLINE
#define CALLSTACK_ALWAYS_INLINE __attribute__((always_inline))
#endif  // CALLSTACK_ALWAYS_INLINE predefined


namespace android {
namespace android {


@@ -102,7 +104,7 @@ public:


    // Return current call stack if possible, nullptr otherwise.
    // Return current call stack if possible, nullptr otherwise.
#ifdef WEAKS_AVAILABLE
#ifdef WEAKS_AVAILABLE
    static CallStackUPtr ALWAYS_INLINE getCurrent(int32_t ignoreDepth = 1) {
    static CallStackUPtr CALLSTACK_ALWAYS_INLINE getCurrent(int32_t ignoreDepth = 1) {
        if (reinterpret_cast<uintptr_t>(getCurrentInternal) == 0) {
        if (reinterpret_cast<uintptr_t>(getCurrentInternal) == 0) {
            ALOGW("CallStack::getCurrentInternal not linked, returning null");
            ALOGW("CallStack::getCurrentInternal not linked, returning null");
            return CallStackUPtr(nullptr);
            return CallStackUPtr(nullptr);
@@ -111,13 +113,14 @@ public:
        }
        }
    }
    }
#else // !WEAKS_AVAILABLE
#else // !WEAKS_AVAILABLE
    static CallStackUPtr ALWAYS_INLINE getCurrent(int32_t = 1) {
    static CallStackUPtr CALLSTACK_ALWAYS_INLINE getCurrent(int32_t = 1) {
        return CallStackUPtr(nullptr);
        return CallStackUPtr(nullptr);
    }
    }
#endif // !WEAKS_AVAILABLE
#endif // !WEAKS_AVAILABLE


#ifdef WEAKS_AVAILABLE
#ifdef WEAKS_AVAILABLE
    static void ALWAYS_INLINE logStack(const char* logtag, CallStack* stack = getCurrent().get(),
    static void CALLSTACK_ALWAYS_INLINE logStack(const char* logtag,
                                                 CallStack* stack = getCurrent().get(),
                                                 android_LogPriority priority = ANDROID_LOG_DEBUG) {
                                                 android_LogPriority priority = ANDROID_LOG_DEBUG) {
        if (reinterpret_cast<uintptr_t>(logStackInternal) != 0 && stack != nullptr) {
        if (reinterpret_cast<uintptr_t>(logStackInternal) != 0 && stack != nullptr) {
            logStackInternal(logtag, stack, priority);
            logStackInternal(logtag, stack, priority);
@@ -127,15 +130,16 @@ public:
    }
    }


#else
#else
    static void ALWAYS_INLINE logStack(const char* logtag, CallStack* = getCurrent().get(),
    static void CALLSTACK_ALWAYS_INLINE logStack(const char* logtag,
                                                 CallStack* = getCurrent().get(),
                                                 android_LogPriority = ANDROID_LOG_DEBUG) {
                                                 android_LogPriority = ANDROID_LOG_DEBUG) {
        ALOG(LOG_WARN, logtag, "CallStack::logStackInternal not linked");
        ALOG(LOG_WARN, logtag, "CallStack::logStackInternal not linked");
    }
    }
#endif // !WEAKS_AVAILABLE
#endif // !WEAKS_AVAILABLE


#ifdef WEAKS_AVAILABLE
#ifdef WEAKS_AVAILABLE
    static String8 ALWAYS_INLINE stackToString(const char* prefix = nullptr,
    static String8 CALLSTACK_ALWAYS_INLINE
                                               const CallStack* stack = getCurrent().get()) {
    stackToString(const char* prefix = nullptr, const CallStack* stack = getCurrent().get()) {
        if (reinterpret_cast<uintptr_t>(stackToStringInternal) != 0 && stack != nullptr) {
        if (reinterpret_cast<uintptr_t>(stackToStringInternal) != 0 && stack != nullptr) {
            return stackToStringInternal(prefix, stack);
            return stackToStringInternal(prefix, stack);
        } else {
        } else {
@@ -143,7 +147,7 @@ public:
        }
        }
    }
    }
#else // !WEAKS_AVAILABLE
#else // !WEAKS_AVAILABLE
    static String8 ALWAYS_INLINE stackToString(const char* prefix = nullptr,
    static String8 CALLSTACK_ALWAYS_INLINE stackToString(const char* prefix = nullptr,
                                                         const CallStack* = getCurrent().get()) {
                                                         const CallStack* = getCurrent().get()) {
        return String8::format("%s<CallStack package not linked>", (prefix ? prefix : ""));
        return String8::format("%s<CallStack package not linked>", (prefix ? prefix : ""));
    }
    }
@@ -165,4 +169,6 @@ public:


}  // namespace android
}  // namespace android


#undef CALLSTACK_ALWAYS_INLINE

#endif // ANDROID_CALLSTACK_H
#endif // ANDROID_CALLSTACK_H