From 232cf876041eb1e63e96d7e1268983917f2c93cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?=
 <bernhard.rosenkraenzer.ext@huawei.com>
Date: Fri, 3 Sep 2021 15:47:58 +0200
Subject: [PATCH] busybox: Add -Wno-error=format-nonliteral to compiler flags
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

busybox implements some of its own string handling that triggers
warnings with -Wformat-nonliteral.
This has been verified to be harmless in 1.31.1.

Removing -Werror=format-nonliteral here allows us to use
-Werror=format-nonliteral globally in OPTIMIZE_FOR=security mode
while keeping busybox building.

Signed-off-by: Bernhard Rosenkränzer <bernhard.rosenkraenzer.ext@huawei.com>
---
 .../recipes-core/busybox/busybox_%.bbappend           | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/meta-ohos-core/recipes-core/busybox/busybox_%.bbappend b/meta-ohos-core/recipes-core/busybox/busybox_%.bbappend
index c3b3e351..b6ff047c 100644
--- a/meta-ohos-core/recipes-core/busybox/busybox_%.bbappend
+++ b/meta-ohos-core/recipes-core/busybox/busybox_%.bbappend
@@ -5,3 +5,14 @@
 FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
 SRC_URI += "file://busybox-1.31.1-Wformat-security.patch \
 	file://allscenarios.cfg"
+
+# busybox implements some of its own string handling that triggers
+# warnings with -Wformat-nonliteral.
+# This has been verified to be harmless in 1.31.1.
+#
+# Removing -Werror=format-nonliteral here allows us to use
+# -Werror=format-nonliteral globally in OPTIMIZE_FOR=security mode
+# while keeping busybox building.
+
+TARGET_CFLAGS_remove = "-Wformat-nonliteral -Werror=format-nonliteral"
+
-- 
GitLab