Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Adam Duskett <adam.duskett@amarulasolutions.com>
To: openembedded-core@lists.openembedded.org
Cc: Adam Duskett <adam.duskett@amarulasolutions.com>
Subject: [PATCH v9 1/5] json-c: add patch to fix compiling with a C++ compiler
Date: Mon,  7 Sep 2026 15:56:00 +0200	[thread overview]
Message-ID: <20260907135607.4132821-1-adam.duskett@amarulasolutions.com> (raw)

Backported from upstream commit aab792578b4f081af6ed7b993475bcb2dbca8912

Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
---
 ...rs-when-building-with-a-cpp-compiler.patch | 50 +++++++++++++++++++
 meta/recipes-devtools/json-c/json-c_0.19.bb   |  1 +
 2 files changed, 51 insertions(+)
 create mode 100644 meta/recipes-devtools/json-c/json-c/0001-fix-defined-but-not-used-errors-when-building-with-a-cpp-compiler.patch

diff --git a/meta/recipes-devtools/json-c/json-c/0001-fix-defined-but-not-used-errors-when-building-with-a-cpp-compiler.patch b/meta/recipes-devtools/json-c/json-c/0001-fix-defined-but-not-used-errors-when-building-with-a-cpp-compiler.patch
new file mode 100644
index 0000000000..08e086f8a6
--- /dev/null
+++ b/meta/recipes-devtools/json-c/json-c/0001-fix-defined-but-not-used-errors-when-building-with-a-cpp-compiler.patch
@@ -0,0 +1,50 @@
+From aab792578b4f081af6ed7b993475bcb2dbca8912 Mon Sep 17 00:00:00 2001
+From: Eric Hawicz <erh+git@nimenees.com>
+Date: Sat, 11 Jul 2026 09:28:49 -0400
+Subject: [PATCH] Issue #941: fix "defined but not used" errors when building
+ with a c++ compiler.
+
+ 
+Upstream-Status: Backport [https://github.com/json-c/json-c/commit/aab792578b4f081af6ed7b993475bcb2dbca8912]
+Signed-off-by: Eric Hawicz <erh+git@nimenees.com>
+Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
+---
+ json_object.h | 4 ++--
+ linkhash.h    | 2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/json_object.h b/json_object.h
+index 7edb63d4f8..2cd94906e7 100644
+--- a/json_object.h
++++ b/json_object.h
+@@ -488,7 +488,7 @@ JSON_EXPORT void json_object_object_del(struct json_object *obj, const char *key
+  * @param val the local name for the json_object* object variable defined in
+  *            the body
+  */
+-#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
++#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && (defined(__cplusplus) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L))
+ 
+ #define json_object_object_foreach(obj, key, val)                                \
+ 	char *key = NULL;                                                        \
+@@ -520,7 +520,7 @@ JSON_EXPORT void json_object_object_del(struct json_object *obj, const char *key
+ 	                 : 0);                                                 \
+ 	     entry##key = entry_next##key)
+ 
+-#endif /* defined(__GNUC__) && !defined(__STRICT_ANSI__) && (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) */
++#endif
+ 
+ /** Iterate through all keys and values of an object (ANSI C Safe)
+  * @param obj the json_object instance
+diff --git a/linkhash.h b/linkhash.h
+index 5ad17cf2d2..48fb7c0b0a 100644
+--- a/linkhash.h
++++ b/linkhash.h
+@@ -345,7 +345,7 @@ int lh_table_resize(struct lh_table *t, int new_size);
+ /**
+  * @deprecated Don't use this outside of linkhash.h:
+  */
+-#if !defined (__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
++#if !defined(__cplusplus) && (!defined (__STDC_VERSION__) || (__STDC_VERSION__ < 199901L))
+ /* C89 compilers like VS2010 can't handle inline funcs, so skip it there,
+    note: this also applies to -std=c89 in GCC! */
+ #define _LH_INLINE
diff --git a/meta/recipes-devtools/json-c/json-c_0.19.bb b/meta/recipes-devtools/json-c/json-c_0.19.bb
index e42d4f6f56..9271d56326 100644
--- a/meta/recipes-devtools/json-c/json-c_0.19.bb
+++ b/meta/recipes-devtools/json-c/json-c_0.19.bb
@@ -7,6 +7,7 @@ LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://COPYING;md5=de54b60fbbc35123ba193fea8ee216f2"
 
 SRC_URI = "https://s3.amazonaws.com/json-c_releases/releases/${BP}.tar.gz \
+           file://0001-fix-defined-but-not-used-errors-when-building-with-a-cpp-compiler.patch \
            file://run-ptest \
            "
 SRC_URI[sha256sum] = "37ad0249902e301bd9052bf712e511fcc6acff4ecaad4b5900aad9ce564e26de"
-- 
2.55.0



             reply	other threads:[~2026-09-07 13:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-07 13:56 Adam Duskett [this message]
2026-09-07 13:56 ` [PATCH v9 2/5] libtoml11: new recipe Adam Duskett
2026-09-07 16:10   ` [OE-core] " Khem Raj
2026-09-07 13:56 ` [PATCH v9 3/5] libsolv: explicitly enable comps for rpm packageconfig Adam Duskett
2026-09-07 13:56 ` [PATCH v9 4/5] dnf: Upgrade to 5.4.4.0 Adam Duskett
2026-09-08  4:42   ` [OE-core] " Mathieu Dubois-Briand
2026-09-07 13:56 ` [PATCH v9 5/5] libdnf: remove recipe Adam Duskett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260907135607.4132821-1-adam.duskett@amarulasolutions.com \
    --to=adam.duskett@amarulasolutions.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox