Skip to content

Commit

Permalink
Fix noinline attribute usage
Browse files Browse the repository at this point in the history
  • Loading branch information
bamx23 committed Nov 3, 2024
1 parent 8428818 commit edfd311
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion Sources/KSCrashCore/include/KSCompilerDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@

/// Disables optimisations to ensure a function remains in stacktrace.
/// Usually used in pair with `KS_THWART_TAIL_CALL_OPTIMISATION`.
#define KS_KEEP_FUNCTION_IN_STACKTRACE __attribute__((disable_tail_calls)) __attribute__((noinline))
#define KS_KEEP_FUNCTION_IN_STACKTRACE __attribute__((disable_tail_calls))

/// Disables inline optimisation.
/// Usually used in pair with `KS_KEEP_FUNCTION_IN_STACKTRACE`.
#define KS_NOINLINE __attribute__((noinline))

/// Extra safety measure to ensure a method is not tail-call optimised.
/// This define should be placed at the end of a function.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static KSStackCursor g_stackCursor;
#pragma mark - Callbacks -
// ============================================================================

static void captureStackTrace(void *, std::type_info *tinfo, void (*)(void *)) KS_KEEP_FUNCTION_IN_STACKTRACE
static KS_NOINLINE void captureStackTrace(void *, std::type_info *tinfo, void (*)(void *)) KS_KEEP_FUNCTION_IN_STACKTRACE

Check failure on line 81 in Sources/KSCrashRecording/Monitors/KSCrashMonitor_CPPException.cpp

View workflow job for this annotation

GitHub Actions / Formatting Check

Sources/KSCrashRecording/Monitors/KSCrashMonitor_CPPException.cpp:81:73: error: code should be clang-formatted [-Wclang-format-violations]
{
if (tinfo != nullptr && strcmp(tinfo->name(), "NSException") == 0) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
#pragma mark - Callbacks -
// ============================================================================

static void initStackCursor(KSStackCursor *cursor, NSException *exception, uintptr_t *callstack,
static KS_NOINLINE void initStackCursor(KSStackCursor *cursor, NSException *exception, uintptr_t *callstack,

Check failure on line 58 in Sources/KSCrashRecording/Monitors/KSCrashMonitor_NSException.m

View workflow job for this annotation

GitHub Actions / Formatting Check

Sources/KSCrashRecording/Monitors/KSCrashMonitor_NSException.m:58:109: error: code should be clang-formatted [-Wclang-format-violations]
BOOL isUserReported) KS_KEEP_FUNCTION_IN_STACKTRACE
{
// Use stacktrace from NSException if present,
Expand Down Expand Up @@ -91,7 +91,7 @@ static void initStackCursor(KSStackCursor *cursor, NSException *exception, uintp
*
* @param exception The exception that was raised.
*/
static void handleException(NSException *exception, BOOL isUserReported,
static KS_NOINLINE void handleException(NSException *exception, BOOL isUserReported,

Check failure on line 94 in Sources/KSCrashRecording/Monitors/KSCrashMonitor_NSException.m

View workflow job for this annotation

GitHub Actions / Formatting Check

Sources/KSCrashRecording/Monitors/KSCrashMonitor_NSException.m:94:85: error: code should be clang-formatted [-Wclang-format-violations]
BOOL logAllThreads) KS_KEEP_FUNCTION_IN_STACKTRACE
{
KSLOG_DEBUG(@"Trapped exception %@", exception);
Expand Down

0 comments on commit edfd311

Please sign in to comment.