010-fix-build-with-clang-15.patch 4.9 KB

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