summaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-05-11 19:44:21 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-05-12 15:19:28 +0200
commit52a06992f1404a4b85f99aedd75377fd60a489b9 (patch)
tree9d4220493fd72dd8b44ff046c07300004e68c50a /external
parent0ec327662a11554fe407c83abaf0ddbb97e73ed7 (diff)
help msvc -analyzer out wrt SkASSERT
Change-Id: I32387c80273d0bc080e47a1d9ccf7454a4a3d79a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167518 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'external')
-rw-r--r--external/skia/UnpackedTarball_skia.mk1
-rw-r--r--external/skia/help-msvc-analyzer.patch25
2 files changed, 26 insertions, 0 deletions
diff --git a/external/skia/UnpackedTarball_skia.mk b/external/skia/UnpackedTarball_skia.mk
index 683de8e9d69c..b985d8aa9744 100644
--- a/external/skia/UnpackedTarball_skia.mk
+++ b/external/skia/UnpackedTarball_skia.mk
@@ -42,6 +42,7 @@ skia_patches := \
incomplete-type-SkImageGenerator.patch.1 \
0001-AvoidCombiningExtrememelyLargeMeshes.patch.1 \
sort-comparison-assumption.patch.0 \
+ help-msvc-analyzer.patch \
$(eval $(call gb_UnpackedTarball_set_patchlevel,skia,1))
diff --git a/external/skia/help-msvc-analyzer.patch b/external/skia/help-msvc-analyzer.patch
new file mode 100644
index 000000000000..d7305a81cf07
--- /dev/null
+++ b/external/skia/help-msvc-analyzer.patch
@@ -0,0 +1,25 @@
+--- skia/include/private/base/SkAssert.h.orig
++++ skia/include/private/base/SkAssert.h
+@@ -43,6 +43,13 @@
+ } while (false)
+ #endif
+
++// when building with msvc and only when using these headers outside the skia build
++#if defined(_MSC_VER) && !defined(SKIA_IMPLEMENTATION)
++# define SkANALYSIS_ASSUME(condition) __analysis_assume(condition)
++#else
++# define SkANALYSIS_ASSUME(condition) static_cast<void>(0)
++#endif
++
+ // SkASSERT, SkASSERTF and SkASSERT_RELEASE can be used as stand alone assertion expressions, e.g.
+ // uint32_t foo(int x) {
+ // SkASSERT(x > 4);
+@@ -54,7 +60,7 @@
+ // x - 4;
+ // }
+ #define SkASSERT_RELEASE(cond) \
+- static_cast<void>( (cond) ? (void)0 : []{ SK_ABORT("assert(%s)", #cond); }() )
++ static_cast<void>( (cond) ? (void)0 : [&]{ SK_ABORT("assert(%s)", #cond); SkANALYSIS_ASSUME(cond); }() )
+
+ #if defined(SK_DEBUG)
+ #define SkASSERT(cond) SkASSERT_RELEASE(cond)