flashrom: fix Darwin build

memcpy is a macro on Darwin, and thus requires braced initializer lists
to be parenthesized.
This commit is contained in:
edef
2025-02-15 13:59:43 +01:00
committed by r-vdp
parent 498430e280
commit 4251ec6870
2 changed files with 61 additions and 8 deletions
@@ -0,0 +1,50 @@
From ba84c4aba56420315973026288e7b336006336a9 Mon Sep 17 00:00:00 2001
From: edef <edef@edef.eu>
Date: Tue, 30 Jul 2024 03:14:37 +0000
Subject: [PATCH] tests/erase: parenthesize braced initializer
memcpy is a macro on Darwin, and thus requires braced initializer lists
to be parenthesized.
---
tests/erase_func_algo.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tests/erase_func_algo.c b/tests/erase_func_algo.c
index 576923f8..b13ee70c 100644
--- a/tests/erase_func_algo.c
+++ b/tests/erase_func_algo.c
@@ -1233,13 +1233,13 @@ static void erase_unwritable_regions_skipflag_on_test_success(void **state)
// This test needs special block erase to emulate protected regions.
memcpy(g_test_erase_injector,
- (erasefunc_t *const[]){
+ ((erasefunc_t *const[]){
block_erase_chip_with_protected_region_1,
block_erase_chip_with_protected_region_2,
block_erase_chip_with_protected_region_3,
block_erase_chip_with_protected_region_4,
block_erase_chip_with_protected_region_5,
- },
+ }),
sizeof(g_test_erase_injector)
);
@@ -1322,13 +1322,13 @@ static void write_unwritable_regions_skipflag_on_test_success(void **state) {
// This test needs special block erase to emulate protected regions.
memcpy(g_test_erase_injector,
- (erasefunc_t *const[]){
+ ((erasefunc_t *const[]){
block_erase_chip_with_protected_region_1,
block_erase_chip_with_protected_region_2,
block_erase_chip_with_protected_region_3,
block_erase_chip_with_protected_region_4,
block_erase_chip_with_protected_region_5,
- },
+ }),
sizeof(g_test_erase_injector)
);
--
2.45.2
+11 -8
View File
@@ -24,14 +24,17 @@ stdenv.mkDerivation rec {
hash = "sha256-rX7htJI5xvtPj1XjZwb81zFDXbGkvS+rPYDx9yUIzO4=";
};
patches = [
# Release notes for 1.4.0 state that Promontory chipsets are unsupported, and that attempting to read flash on those systems may crash the system.
# The patch that removes this (broken) support only made it into the 1.3.0 release, seemingly by mistake, and the relevant code has been essentially untouched since.
# We cherry-pick the upstream patch from 1.3.0, though amended to reference the relevant bug in the error message, rather than requesting the user email upstream.
# https://ticket.coreboot.org/issues/370
# https://review.coreboot.org/c/flashrom/+/68824
./0001-sb600spi.c-Drop-Promontory-support.patch
];
patches =
[
# Release notes for 1.4.0 state that Promontory chipsets are unsupported, and that attempting to read flash on those systems may crash the system.
# The patch that removes this (broken) support only made it into the 1.3.0 release, seemingly by mistake, and the relevant code has been essentially untouched since.
# We cherry-pick the upstream patch from 1.3.0, though amended to reference the relevant bug in the error message, rather than requesting the user email upstream.
# https://ticket.coreboot.org/issues/370
# https://review.coreboot.org/c/flashrom/+/68824
./0001-sb600spi.c-Drop-Promontory-support.patch
]
# Darwin's memcpy is a macro, and requires braced initializer lists to be parenthesized
++ lib.optional stdenv.isDarwin ./0002-tests-erase-parenthesize-braced-initializer.patch;
nativeBuildInputs = [
meson