libjson-c: import patch to fix compilation on macos
[openwrt/staging/ldir.git] / package / libs / libjson-c / patches / 010-fix-build-with-clang-15.patch
1 From 6eca65617aacd19f4928acd5766b8dd20eda0b34 Mon Sep 17 00:00:00 2001
2 From: Khem Raj <raj.khem@gmail.com>
3 Date: Sat, 13 Aug 2022 20:37:03 -0700
4 Subject: [PATCH] Fix build with clang-15+
5
6 Fixes
7 json_util.c:63:35: error: a function declaration without a prototype is deprecated in all versions of C [-We
8 rror,-Wstrict-prototypes]
9 const char *json_util_get_last_err()
10 ^
11 void
12
13 Signed-off-by: Khem Raj <raj.khem@gmail.com>
14 ---
15 json_util.c | 2 +-
16 tests/test1.c | 6 +++---
17 tests/test4.c | 2 +-
18 tests/test_cast.c | 2 +-
19 tests/test_charcase.c | 2 +-
20 tests/test_parse.c | 8 ++++----
21 tests/test_printbuf.c | 4 ++--
22 tests/test_util_file.c | 6 +++---
23 8 files changed, 16 insertions(+), 16 deletions(-)
24
25 --- a/json_util.c
26 +++ b/json_util.c
27 @@ -60,7 +60,7 @@ static int _json_object_to_fd(int fd, st
28
29 static char _last_err[256] = "";
30
31 -const char *json_util_get_last_err()
32 +const char *json_util_get_last_err(void)
33 {
34 if (_last_err[0] == '\0')
35 return NULL;
36 --- a/tests/test1.c
37 +++ b/tests/test1.c
38 @@ -58,7 +58,7 @@ static const char *to_json_string(json_o
39 #endif
40
41 json_object *make_array(void);
42 -json_object *make_array()
43 +json_object *make_array(void)
44 {
45 json_object *my_array;
46
47 @@ -74,7 +74,7 @@ json_object *make_array()
48 }
49
50 void test_array_del_idx(void);
51 -void test_array_del_idx()
52 +void test_array_del_idx(void)
53 {
54 int rc;
55 size_t ii;
56 @@ -140,7 +140,7 @@ void test_array_del_idx()
57 }
58
59 void test_array_list_expand_internal(void);
60 -void test_array_list_expand_internal()
61 +void test_array_list_expand_internal(void)
62 {
63 int rc;
64 size_t ii;
65 --- a/tests/test4.c
66 +++ b/tests/test4.c
67 @@ -28,7 +28,7 @@ void print_hex(const char *s)
68 }
69
70 static void test_lot_of_adds(void);
71 -static void test_lot_of_adds()
72 +static void test_lot_of_adds(void)
73 {
74 int ii;
75 char key[50];
76 --- a/tests/test_cast.c
77 +++ b/tests/test_cast.c
78 @@ -94,7 +94,7 @@ static void getit(struct json_object *ne
79 printf("new_obj.%s json_object_get_double()=%f\n", field, json_object_get_double(o));
80 }
81
82 -static void checktype_header()
83 +static void checktype_header(void)
84 {
85 printf("json_object_is_type: %s,%s,%s,%s,%s,%s,%s\n", json_type_to_name(json_type_null),
86 json_type_to_name(json_type_boolean), json_type_to_name(json_type_double),
87 --- a/tests/test_charcase.c
88 +++ b/tests/test_charcase.c
89 @@ -19,7 +19,7 @@ int main(int argc, char **argv)
90 }
91
92 /* make sure only lowercase forms are parsed in strict mode */
93 -static void test_case_parse()
94 +static void test_case_parse(void)
95 {
96 struct json_tokener *tok;
97 json_object *new_obj;
98 --- a/tests/test_parse.c
99 +++ b/tests/test_parse.c
100 @@ -92,7 +92,7 @@ static void single_basic_parse(const cha
101 if (getenv("TEST_PARSE_CHUNKSIZE") != NULL)
102 single_incremental_parse(test_string, clear_serializer);
103 }
104 -static void test_basic_parse()
105 +static void test_basic_parse(void)
106 {
107 single_basic_parse("\"\003\"", 0);
108 single_basic_parse("/* hello */\"foo\"", 0);
109 @@ -195,7 +195,7 @@ static void test_basic_parse()
110 single_basic_parse("[18446744073709551616]", 1);
111 }
112
113 -static void test_utf8_parse()
114 +static void test_utf8_parse(void)
115 {
116 // json_tokener_parse doesn't support checking for byte order marks.
117 // It's the responsibility of the caller to detect and skip a BOM.
118 @@ -222,7 +222,7 @@ static int clear_serializer(json_object
119 return JSON_C_VISIT_RETURN_CONTINUE;
120 }
121
122 -static void test_verbose_parse()
123 +static void test_verbose_parse(void)
124 {
125 json_object *new_obj;
126 enum json_tokener_error error = json_tokener_success;
127 @@ -562,7 +562,7 @@ struct incremental_step
128 {NULL, -1, -1, json_tokener_success, 0},
129 };
130
131 -static void test_incremental_parse()
132 +static void test_incremental_parse(void)
133 {
134 json_object *new_obj;
135 enum json_tokener_error jerr;
136 --- a/tests/test_printbuf.c
137 +++ b/tests/test_printbuf.c
138 @@ -16,7 +16,7 @@ static void test_printbuf_memset_length(
139 #define __func__ __FUNCTION__
140 #endif
141
142 -static void test_basic_printbuf_memset()
143 +static void test_basic_printbuf_memset(void)
144 {
145 struct printbuf *pb;
146
147 @@ -29,7 +29,7 @@ static void test_basic_printbuf_memset()
148 printf("%s: end test\n", __func__);
149 }
150
151 -static void test_printbuf_memset_length()
152 +static void test_printbuf_memset_length(void)
153 {
154 struct printbuf *pb;
155
156 --- a/tests/test_util_file.c
157 +++ b/tests/test_util_file.c
158 @@ -35,7 +35,7 @@ static void test_read_fd_equal(const cha
159 #define PATH_MAX 256
160 #endif
161
162 -static void test_write_to_file()
163 +static void test_write_to_file(void)
164 {
165 json_object *jso;
166
167 @@ -231,7 +231,7 @@ static void test_read_valid_nested_with_
168 close(d);
169 }
170
171 -static void test_read_nonexistant()
172 +static void test_read_nonexistant(void)
173 {
174 const char *filename = "./not_present.json";
175
176 @@ -249,7 +249,7 @@ static void test_read_nonexistant()
177 }
178 }
179
180 -static void test_read_closed()
181 +static void test_read_closed(void)
182 {
183 // Test reading from a closed fd
184 int d = open("/dev/null", O_RDONLY, 0);