summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHauke Mehrtens2025-12-09 01:06:26 +0000
committerHauke Mehrtens2025-12-09 01:06:26 +0000
commitd11b77db5eca3e20c5c238c55d80059229a188b3 (patch)
tree9ed7609ecf17e963e16c3eea5993f7c4fc9b153a
parent344bb7f9162b76a864cec1ebd069651a9c2483cf (diff)
downloadopenwrt-d11b77db5eca3e20c5c238c55d80059229a188b3.tar.gz
apk: Fix host compilation with C89
This fixes the following build error: ``` ../src/apk.c: In function 'parse_options': ../src/apk.c:584:4: error: a label can only be part of a statement and a declaration is not a statement 584 | char *arg = opt_parse_arg(&st); | ^~~~ ``` Upstream MR: https://gitlab.alpinelinux.org/alpine/apk-tools/-/merge_requests/376 Fixes: b91ebdabbb09 ("apk: bump to 3.0.1") Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
-rw-r--r--package/system/apk/patches/0020-apk-fix-compile-when-using-C89.patch56
1 files changed, 56 insertions, 0 deletions
diff --git a/package/system/apk/patches/0020-apk-fix-compile-when-using-C89.patch b/package/system/apk/patches/0020-apk-fix-compile-when-using-C89.patch
new file mode 100644
index 0000000000..8cd30542dd
--- /dev/null
+++ b/package/system/apk/patches/0020-apk-fix-compile-when-using-C89.patch
@@ -0,0 +1,56 @@
+From 54385e6dc02ada9ec827b6b79b9359951197fee5 Mon Sep 17 00:00:00 2001
+From: Paul Donald <newtwen+gitlab@gmail.com>
+Date: Tue, 9 Dec 2025 00:31:27 +0100
+Subject: [PATCH] apk: fix compile when using C89
+
+The older standard is more strict, and gives rise to errors:
+
+../src/apk.c: In function 'parse_options':
+../src/apk.c:584:4: error: a label can only be part of a statement and a declaration is not a statement
+ 584 | char *arg = opt_parse_arg(&st);
+ | ^~~~
+
+So move the *arg declaration to function start.
+
+../src/app_mkpkg.c: In function 'mkpkg_setup_compat':
+../src/app_mkpkg.c:423:2: error: label at end of compound statement
+ 423 | default:
+ | ^~~~~~~
+
+add break;
+
+Signed-off-by: Paul Donald <newtwen+gitlab@gmail.com>
+---
+ src/apk.c | 3 ++-
+ src/app_mkpkg.c | 1 +
+ 2 files changed, 3 insertions(+), 1 deletion(-)
+
+--- a/src/apk.c
++++ b/src/apk.c
+@@ -556,6 +556,7 @@ static int parse_options(int argc, char
+ struct apk_opt_match m;
+ bool applet_arg_pending = false;
+ int r;
++ char *arg;
+
+ applet = applet_from_arg0(argv[0]);
+ if (!applet) {
+@@ -581,7 +582,7 @@ static int parse_options(int argc, char
+ case 0:
+ break;
+ case OPT_MATCH_NON_OPTION:
+- char *arg = opt_parse_arg(&st);
++ arg = opt_parse_arg(&st);
+ if (applet_arg_pending && strcmp(arg, applet->name) == 0)
+ applet_arg_pending = false;
+ else if (arg[0] || !applet || !applet->remove_empty_arguments)
+--- a/src/app_mkpkg.c
++++ b/src/app_mkpkg.c
+@@ -421,6 +421,7 @@ static void mkpkg_setup_compat(struct mk
+ case 0: ctx->compat_rootnode = 1; // fallthrough
+ case 1: ctx->compat_dirnode = 1; // fallthrough
+ default:
++ break;
+ }
+ }
+