Skip to content

Commit fee21bc

Browse files
authored
Merge pull request swiftlang#41464 from lorentey/nfc-error-reporting-cleanup
[runtime][NFC] Unify reportOnCrash implementations into a single function
2 parents 1fada7b + b0a60fa commit fee21bc

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

stdlib/public/runtime/Errors.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,13 @@ struct crashreporter_annotations_t gCRAnnotations
268268
__attribute__((__section__("__DATA," CRASHREPORTER_ANNOTATIONS_SECTION))) = {
269269
CRASHREPORTER_ANNOTATIONS_VERSION, 0, 0, 0, 0, 0, 0, 0};
270270
}
271+
#endif // SWIFT_HAVE_CRASHREPORTERCLIENT
271272

272273
// Report a message to any forthcoming crash log.
273274
static void
274275
reportOnCrash(uint32_t flags, const char *message)
275276
{
277+
#ifdef SWIFT_HAVE_CRASHREPORTERCLIENT
276278
// We must use an "unsafe" mutex in this pathway since the normal "safe"
277279
// mutex calls fatalError when an error is detected and fatalError ends up
278280
// calling us. In other words we could get infinite recursion if the
@@ -293,18 +295,11 @@ reportOnCrash(uint32_t flags, const char *message)
293295
CRSetCrashLogMessage(newMessage);
294296

295297
crashlogLock.unlock();
296-
}
297-
298298
#else
299-
300-
static void
301-
reportOnCrash(uint32_t flags, const char *message)
302-
{
303299
// empty
300+
#endif // SWIFT_HAVE_CRASHREPORTERCLIENT
304301
}
305302

306-
#endif
307-
308303
// Report a message to system console and stderr.
309304
static void
310305
reportNow(uint32_t flags, const char *message)

0 commit comments

Comments
 (0)