Title: [288577] trunk/Source/WTF
- Revision
- 288577
- Author
- ape...@igalia.com
- Date
- 2022-01-25 13:09:40 -0800 (Tue, 25 Jan 2022)
Log Message
[WTF] Make CRASH_WITH_INFO more useful when using GCC
https://bugs.webkit.org/show_bug.cgi?id=235573
Make CRASH_WITH_INFO() print out the additional information instead of silently crash
when WebKit is compiled with GCC.
Reviewed by Yusuke Suzuki.
* wtf/Assertions.h: Add a variant of CRASH_WITH_INFO() which uses __VA_OPT__ for
GCC and Clang; MSVC is left with the existing version as the version currently in
use is not happy about __VA_OPT__.
(CRASH_WITH_INFO): Deleted inline function for GCC.
(CRASH_WITH_SECURITY_IMPLICATION_AND_INFO): Ditto.
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (288576 => 288577)
--- trunk/Source/WTF/ChangeLog 2022-01-25 20:36:51 UTC (rev 288576)
+++ trunk/Source/WTF/ChangeLog 2022-01-25 21:09:40 UTC (rev 288577)
@@ -1,3 +1,19 @@
+2022-01-25 Adrian Perez de Castro <ape...@igalia.com>
+
+ [WTF] Make CRASH_WITH_INFO more useful when using GCC
+ https://bugs.webkit.org/show_bug.cgi?id=235573
+
+ Make CRASH_WITH_INFO() print out the additional information instead of silently crash
+ when WebKit is compiled with GCC.
+
+ Reviewed by Yusuke Suzuki.
+
+ * wtf/Assertions.h: Add a variant of CRASH_WITH_INFO() which uses __VA_OPT__ for
+ GCC and Clang; MSVC is left with the existing version as the version currently in
+ use is not happy about __VA_OPT__.
+ (CRASH_WITH_INFO): Deleted inline function for GCC.
+ (CRASH_WITH_SECURITY_IMPLICATION_AND_INFO): Ditto.
+
2022-01-24 Mark Lam <mark....@apple.com>
Rename Vector and FixedVector::findMatching to findIf to match stl naming.
Modified: trunk/Source/WTF/wtf/Assertions.h (288576 => 288577)
--- trunk/Source/WTF/wtf/Assertions.h 2022-01-25 20:36:51 UTC (rev 288576)
+++ trunk/Source/WTF/wtf/Assertions.h 2022-01-25 21:09:40 UTC (rev 288577)
@@ -760,7 +760,9 @@
#ifndef CRASH_WITH_INFO
// This is useful if you are going to stuff data into registers before crashing, like the
// crashWithInfo functions below.
-#if COMPILER(CLANG) || COMPILER(MSVC)
+#if COMPILER(MSVC)
+// FIXME: Re-check whether MSVC 2020 supports __VA_OPT__ and remove the special
+// casing once older versions of the compiler are no longer supported.
#define CRASH_WITH_INFO(...) do { \
WTF::isIntegralOrPointerType(__VA_ARGS__); \
compilerFenceForCrash(); \
@@ -767,24 +769,11 @@
WTFCrashWithInfo(__LINE__, __FILE__, WTF_PRETTY_FUNCTION, __COUNTER__, ##__VA_ARGS__); \
} while (false)
#else
-// GCC does not allow ##__VA_ARGS__ unless GNU extensions are enabled (--std=gnu++NN instead of
-// --std=c++NN) and I think we don't want that, so we'll have a fallback path for GCC. Obviously
-// this will not actually succeed at getting the desired info into registers before crashing, but
-// it's just a fallback anyway.
-//
-// FIXME: When we enable C++20, we should replace ##__VA_ARGS__ with format __VA_OPT__(,) __VA_ARGS__
-// so that we can remove this fallback.
-inline NO_RETURN_DUE_TO_CRASH void CRASH_WITH_INFO(...)
-{
- CRASH();
-}
-
-// We must define this here because CRASH_WITH_INFO() is not defined as a macro.
-// FIXME: Remove this when upgrading to C++20.
-inline NO_RETURN_DUE_TO_CRASH void CRASH_WITH_SECURITY_IMPLICATION_AND_INFO(...)
-{
- CRASH();
-}
+#define CRASH_WITH_INFO(...) do { \
+ WTF::isIntegralOrPointerType(__VA_ARGS__); \
+ compilerFenceForCrash(); \
+ WTFCrashWithInfo(__LINE__, __FILE__, WTF_PRETTY_FUNCTION, __COUNTER__ __VA_OPT__(,) __VA_ARGS__); \
+ } while (false)
#endif
#endif // CRASH_WITH_INFO
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes