Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/json-c: fix build with gcc 5
@ 2023-11-08 21:52 Fabrice Fontaine
  2023-11-11 18:58 ` Peter Korsgaard
  0 siblings, 1 reply; 2+ messages in thread
From: Fabrice Fontaine @ 2023-11-08 21:52 UTC (permalink / raw)
  To: buildroot; +Cc: Fabrice Fontaine

Fix the following build failure with gcc 5 raised since bump to version
0.17 in commit 725580a26ecbd554567880e95b8533b2c9baa5f9:

/home/thomas/autobuild/instance-2/output-1/build/json-c-0.17/json_pointer.c: In function 'json_pointer_result_get_recursive':
/home/thomas/autobuild/instance-2/output-1/build/json-c-0.17/json_pointer.c:193:25: error: 'idx' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    res->index_in_parent = idx;
                         ^

Fixes:
 - http://autobuild.buildroot.org/results/523b35a979d59121fe4e18c38171792b06233940

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 .../0001-json_pointer.c-initialize-idx.patch  | 37 +++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 package/json-c/0001-json_pointer.c-initialize-idx.patch

diff --git a/package/json-c/0001-json_pointer.c-initialize-idx.patch b/package/json-c/0001-json_pointer.c-initialize-idx.patch
new file mode 100644
index 0000000000..3dbe0b4067
--- /dev/null
+++ b/package/json-c/0001-json_pointer.c-initialize-idx.patch
@@ -0,0 +1,37 @@
+From 7ff7eab603611c65b3110dcb1b0caf5cc68b07a3 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Date: Wed, 8 Nov 2023 22:42:48 +0100
+Subject: [PATCH] json_pointer.c: initialize idx
+
+Fix the following build failure with gcc 5:
+
+/home/thomas/autobuild/instance-2/output-1/build/json-c-0.17/json_pointer.c: In function 'json_pointer_result_get_recursive':
+/home/thomas/autobuild/instance-2/output-1/build/json-c-0.17/json_pointer.c:193:25: error: 'idx' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+    res->index_in_parent = idx;
+                         ^
+
+Fixes:
+ - http://autobuild.buildroot.org/results/523b35a979d59121fe4e18c38171792b06233940/
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Upstream: https://github.com/json-c/json-c/pull/839
+---
+ json_pointer.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/json_pointer.c b/json_pointer.c
+index 89e9e21..0ac8aaa 100644
+--- a/json_pointer.c
++++ b/json_pointer.c
+@@ -158,7 +158,7 @@ static int json_pointer_result_get_recursive(struct json_object *obj, char *path
+                                              struct json_pointer_get_result *res)
+ {
+ 	struct json_object *parent_obj = obj;
+-	size_t idx;
++	size_t idx = 0;
+ 	char *endp;
+ 	int rc;
+ 
+-- 
+2.42.0
+
-- 
2.42.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-11 18:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-08 21:52 [Buildroot] [PATCH 1/1] package/json-c: fix build with gcc 5 Fabrice Fontaine
2023-11-11 18:58 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox