From c1feec07cca0b4f87d743cbf6de06ee0e594dc34 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?=
 <bernhard.rosenkraenzer.ext@huawei.com>
Date: Thu, 2 Sep 2021 20:45:07 +0200
Subject: [PATCH] cairo: Remove -Werror=array-bounds from compiler flags
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

cairo uses zero-length array tricks causing array-bounds warnings.

The warnings have been verifited to be harmless in 1.16.0; for extra
security, this should be re-checked after updating.

Removing -Werror=array-bounds here allows us to use -Werror=array-bounds
globally in OPTIMIZE_FOR=security mode.

Signed-off-by: Bernhard Rosenkränzer <bernhard.rosenkraenzer.ext@huawei.com>
---
 .../recipes-graphics/cairo/cairo_%.bbappend          | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 meta-ohos-core/recipes-graphics/cairo/cairo_%.bbappend

diff --git a/meta-ohos-core/recipes-graphics/cairo/cairo_%.bbappend b/meta-ohos-core/recipes-graphics/cairo/cairo_%.bbappend
new file mode 100644
index 00000000..7d81f0d4
--- /dev/null
+++ b/meta-ohos-core/recipes-graphics/cairo/cairo_%.bbappend
@@ -0,0 +1,12 @@
+# SPDX-FileCopyrightText: Huawei Inc.
+# SPDX-License-Identifier: Apache-2.0
+
+# cairo uses zero-length array tricks that trigger warnings with
+# -Warray-bounds.
+#
+# Those have been verified to be harmless in 1.16.0.
+#
+# Removing -Werror=array-bounds here allows us to use -Werror=array-bounds
+# globally in OPTIMIZE_FOR=security mode while keeping mesa building.
+
+TARGET_CFLAGS_remove = "-Werror=array-bounds"
-- 
GitLab