From a2e4ee7ed26a28dcdcf0c0091f5ee44c8ea2cfbe Mon Sep 17 00:00:00 2001 From: Michael D Kinney Date: Tue, 24 Jun 2025 21:55:32 -0700 Subject: [PATCH] UnitTestFrameworkPkg: Add -Wno-write-strings to host unit tests Disable write strings warning for host-based unit test builds when building modules of type HOST_APPLICATION. Modules of type HOST_APPLICATION may compile and link code under test into the host-based unit test. When building GoogleTest based unit tests, the G++ compiler is used. The G++ compiler is stricter than GCC for passing a const string into a function parameter that is not const. This is not a warning for GCC build of firmware code. But GoogleTest builds that use g++ detect as a warning and that breaks the build. The firmware code under test can not be changed, so the warning -Wno-write-strings is added to CC_FLAGS to ignore this warning. Signed-off-by: Michael D Kinney --- UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc b/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc index e257ce5ff9..0f68516362 100644 --- a/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc +++ b/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc @@ -71,6 +71,7 @@ # # GCC # + GCC:*_*_*_CC_FLAGS = -Wno-write-strings GCC:*_*_IA32_DLINK_FLAGS == -o $(BIN_DIR)/$(MODULE_NAME_GUID) -m32 -no-pie GCC:*_*_X64_DLINK_FLAGS == -o $(BIN_DIR)/$(MODULE_NAME_GUID) -m64 -no-pie #