From a71f5e235e33100d1a98c9264d094b7ec2170afb Mon Sep 17 00:00:00 2001 From: Dhiogo Brustolin Date: Fri, 1 Mar 2024 15:17:03 +0100 Subject: [PATCH] fix: Move headers out of Extern C (#3690) If a project uses a C++ compiler, it will not compile because of some headers inside a "extern C" block referencing C++ code. This appears to be an inheritance from KSCrash that I don't fully understand the reasoning behind. Moving these headers out of the extern block hasn't caused any crashes in our default pipeline, so I believe we're fine with it. --- CHANGELOG.md | 1 + .../SentryCrash/Recording/Monitors/SentryCrashMonitor.h | 8 ++++---- .../Recording/Monitors/SentryCrashMonitor_CPPException.h | 4 ++-- .../Recording/Tools/SentryCrashStackCursor_Backtrace.h | 4 ++-- .../Tools/SentryCrashStackCursor_MachineContext.h | 4 ++-- .../Recording/Tools/SentryCrashStackCursor_SelfThread.h | 4 ++-- .../SentryCrash/Recording/Tools/SentryCrashSymbolicator.h | 6 +++--- 7 files changed, 16 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0c7e088724..a24331cd2b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Make SentryFramesTracker available for HybridSDKs ([#3683](https://github.com/getsentry/sentry-cocoa/pull/3683)) - Make SentrySwizzle available for HybridSDKs ([#3684](https://github.com/getsentry/sentry-cocoa/pull/3684)) +- Move headers reference out of "extern C" (#3690) ## 8.21.0-beta.0 diff --git a/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor.h b/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor.h index 8e4c9259a71..49bd0e2c06a 100644 --- a/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor.h +++ b/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor.h @@ -31,15 +31,15 @@ #ifndef HDR_SentryCrashMonitor_h #define HDR_SentryCrashMonitor_h -#ifdef __cplusplus -extern "C" { -#endif - #include "SentryCrashMonitorType.h" #include "SentryCrashThread.h" #include +#ifdef __cplusplus +extern "C" { +#endif + struct SentryCrash_MonitorContext; // ============================================================================ diff --git a/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_CPPException.h b/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_CPPException.h index 39908fb7cb4..3b684fbe23a 100644 --- a/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_CPPException.h +++ b/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_CPPException.h @@ -26,12 +26,12 @@ #ifndef HDR_SentryCrashMonitor_CPPException_h #define HDR_SentryCrashMonitor_CPPException_h +#include "SentryCrashMonitor.h" + #ifdef __cplusplus extern "C" { #endif -#include "SentryCrashMonitor.h" - /** Access the Monitor API. */ SentryCrashMonitorAPI *sentrycrashcm_cppexception_getAPI(void); diff --git a/Sources/SentryCrash/Recording/Tools/SentryCrashStackCursor_Backtrace.h b/Sources/SentryCrash/Recording/Tools/SentryCrashStackCursor_Backtrace.h index 0b60ebb76d9..f9bc2854d71 100644 --- a/Sources/SentryCrash/Recording/Tools/SentryCrashStackCursor_Backtrace.h +++ b/Sources/SentryCrash/Recording/Tools/SentryCrashStackCursor_Backtrace.h @@ -26,12 +26,12 @@ #ifndef SentryCrashStackCursor_Backtrace_h #define SentryCrashStackCursor_Backtrace_h +#import "SentryCrashStackCursor.h" + #ifdef __cplusplus extern "C" { #endif -#include "SentryCrashStackCursor.h" - /** Exposed for other internal systems to use. */ typedef struct { diff --git a/Sources/SentryCrash/Recording/Tools/SentryCrashStackCursor_MachineContext.h b/Sources/SentryCrash/Recording/Tools/SentryCrashStackCursor_MachineContext.h index a76013b360f..1d6419b6642 100644 --- a/Sources/SentryCrash/Recording/Tools/SentryCrashStackCursor_MachineContext.h +++ b/Sources/SentryCrash/Recording/Tools/SentryCrashStackCursor_MachineContext.h @@ -26,12 +26,12 @@ #ifndef SentryCrashStackCursor_MachineContext_h #define SentryCrashStackCursor_MachineContext_h +#import "SentryCrashStackCursor.h" + #ifdef __cplusplus extern "C" { #endif -#include "SentryCrashStackCursor.h" - #define MAX_STACKTRACE_LENGTH 100 /** Initialize a stack cursor for a machine context. diff --git a/Sources/SentryCrash/Recording/Tools/SentryCrashStackCursor_SelfThread.h b/Sources/SentryCrash/Recording/Tools/SentryCrashStackCursor_SelfThread.h index e4ad9232ee5..d674a46f9f4 100644 --- a/Sources/SentryCrash/Recording/Tools/SentryCrashStackCursor_SelfThread.h +++ b/Sources/SentryCrash/Recording/Tools/SentryCrashStackCursor_SelfThread.h @@ -26,12 +26,12 @@ #ifndef SentryCrashStackCursor_SelfThread_h #define SentryCrashStackCursor_SelfThread_h +#import "SentryCrashStackCursor.h" + #ifdef __cplusplus extern "C" { #endif -#include "SentryCrashStackCursor.h" - /** Initialize a stack cursor for the current thread. * You may want to skip some entries to account for the trace immediately * leading up to this init function. diff --git a/Sources/SentryCrash/Recording/Tools/SentryCrashSymbolicator.h b/Sources/SentryCrash/Recording/Tools/SentryCrashSymbolicator.h index 915cdddbe86..7994cdefe9b 100644 --- a/Sources/SentryCrash/Recording/Tools/SentryCrashSymbolicator.h +++ b/Sources/SentryCrash/Recording/Tools/SentryCrashSymbolicator.h @@ -26,13 +26,13 @@ #ifndef SentryCrashSymbolicator_h #define SentryCrashSymbolicator_h +#import "SentryCrashStackCursor.h" +#include + #ifdef __cplusplus extern "C" { #endif -#include "SentryCrashStackCursor.h" -#include - /** Symbolicate a stack cursor. * * @param cursor The cursor to symbolicate.