[packages/json-c] add upstream patch to fix warnings from json-c header in c++ sources; rel 2
atler
atler at pld-linux.org
Wed Aug 12 19:02:26 CEST 2026
commit a775ee50cb1965ec06e96c7c59e0ba191e03d9a3
Author: Jan Palus <atler at pld-linux.org>
Date: Wed Aug 12 19:01:37 2026 +0200
add upstream patch to fix warnings from json-c header in c++ sources; rel 2
cpp-unused-funcs.patch | 46 ++++++++++++++++++++++++++++++++++++++++++++++
json-c.spec | 4 +++-
2 files changed, 49 insertions(+), 1 deletion(-)
---
diff --git a/json-c.spec b/json-c.spec
index 68264d1..0cf7b07 100644
--- a/json-c.spec
+++ b/json-c.spec
@@ -6,13 +6,14 @@ Summary: A JSON implementation in C
Summary(pl.UTF-8): Implementacja JSON w C
Name: json-c
Version: 0.19
-Release: 1
+Release: 2
License: MIT
Group: Libraries
#Source0Download: https://s3.amazonaws.com/json-c_releases/releases/index.html # with AJAX (requires JavaScript)
# XML data with links (relative to https://s3.amazonaws.com/json-c_releases/) in https://s3.amazonaws.com/json-c_releases (no "/" at the end!)
Source0: https://s3.amazonaws.com/json-c_releases/releases/%{name}-%{version}.tar.gz
# Source0-md5: 5678f1373ba51e0041b574c0411c696b
+Patch0: cpp-unused-funcs.patch
URL: https://github.com/json-c/json-c/wiki
BuildRequires: cmake >= 3.9
BuildRequires: rpmbuild(macros) >= 1.605
@@ -56,6 +57,7 @@ Statyczna biblioteka json-c.
%prep
%setup -q
+%patch -P0 -p1
%build
install -d build
diff --git a/cpp-unused-funcs.patch b/cpp-unused-funcs.patch
new file mode 100644
index 0000000..480de0d
--- /dev/null
+++ b/cpp-unused-funcs.patch
@@ -0,0 +1,46 @@
+From aab792578b4f081af6ed7b993475bcb2dbca8912 Mon Sep 17 00:00:00 2001
+From: Eric Hawicz <erh+git at 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.
+
+---
+ 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
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/json-c.git/commitdiff/a775ee50cb1965ec06e96c7c59e0ba191e03d9a3
More information about the pld-cvs-commit
mailing list