Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame^] | 1 | From 785c0072c80c2f6e0839478453cf65fdeac15da0 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Mon, 29 Aug 2022 19:53:28 -0700 |
| 4 | Subject: [PATCH] Add missing prototypes to function declarations |
| 5 | |
| 6 | With Clang 15+ compiler -Wstrict-prototypes is triggering warnings which |
| 7 | are turned into errors with -Werror, this fixes the problem by adding |
| 8 | missing prototypes |
| 9 | |
| 10 | Fixes errors like |
| 11 | | log.c:134:24: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] |
| 12 | | static void syslog_init() |
| 13 | | ^ |
| 14 | | void |
| 15 | |
| 16 | Upstream-Status: Submitted [https://lists.samba.org/archive/rsync/2022-August/032858.html] |
| 17 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 18 | --- |
| 19 | checksum.c | 2 +- |
| 20 | exclude.c | 2 +- |
| 21 | hlink.c | 3 +-- |
| 22 | lib/pool_alloc.c | 2 +- |
| 23 | log.c | 2 +- |
| 24 | main.c | 2 +- |
| 25 | syscall.c | 4 ++-- |
| 26 | zlib/crc32.c | 2 +- |
| 27 | zlib/trees.c | 2 +- |
| 28 | zlib/zutil.c | 4 ++-- |
| 29 | 10 files changed, 12 insertions(+), 13 deletions(-) |
| 30 | |
| 31 | diff --git a/checksum.c b/checksum.c |
| 32 | index fb8c0a0..174c28c 100644 |
| 33 | --- a/checksum.c |
| 34 | +++ b/checksum.c |
| 35 | @@ -629,7 +629,7 @@ int sum_end(char *sum) |
| 36 | return csum_len_for_type(cursum_type, 0); |
| 37 | } |
| 38 | |
| 39 | -void init_checksum_choices() |
| 40 | +void init_checksum_choices(void) |
| 41 | { |
| 42 | #ifdef SUPPORT_XXH3 |
| 43 | char buf[32816]; |
| 44 | diff --git a/exclude.c b/exclude.c |
| 45 | index adc82e2..79f5a82 100644 |
| 46 | --- a/exclude.c |
| 47 | +++ b/exclude.c |
| 48 | @@ -358,7 +358,7 @@ void implied_include_partial_string(const char *s_start, const char *s_end) |
| 49 | memcpy(partial_string_buf, s_start, partial_string_len); |
| 50 | } |
| 51 | |
| 52 | -void free_implied_include_partial_string() |
| 53 | +void free_implied_include_partial_string(void) |
| 54 | { |
| 55 | if (partial_string_buf) { |
| 56 | free(partial_string_buf); |
| 57 | diff --git a/hlink.c b/hlink.c |
| 58 | index 66810a3..6511dfb 100644 |
| 59 | --- a/hlink.c |
| 60 | +++ b/hlink.c |
| 61 | @@ -117,8 +117,7 @@ static void match_gnums(int32 *ndx_list, int ndx_count) |
| 62 | struct ht_int32_node *node = NULL; |
| 63 | int32 gnum, gnum_next; |
| 64 | |
| 65 | - qsort(ndx_list, ndx_count, sizeof ndx_list[0], (int (*)()) hlink_compare_gnum); |
| 66 | - |
| 67 | + qsort(ndx_list, ndx_count, sizeof ndx_list[0], (int (*)(const void *, const void *)) hlink_compare_gnum); |
| 68 | for (from = 0; from < ndx_count; from++) { |
| 69 | file = hlink_flist->sorted[ndx_list[from]]; |
| 70 | gnum = F_HL_GNUM(file); |
| 71 | diff --git a/lib/pool_alloc.c b/lib/pool_alloc.c |
| 72 | index a1a7245..4eae062 100644 |
| 73 | --- a/lib/pool_alloc.c |
| 74 | +++ b/lib/pool_alloc.c |
| 75 | @@ -9,7 +9,7 @@ struct alloc_pool |
| 76 | size_t size; /* extent size */ |
| 77 | size_t quantum; /* allocation quantum */ |
| 78 | struct pool_extent *extents; /* top extent is "live" */ |
| 79 | - void (*bomb)(); /* called if malloc fails */ |
| 80 | + void (*bomb)(const char *, const char *, int); /* called if malloc fails */ |
| 81 | int flags; |
| 82 | |
| 83 | /* statistical data */ |
| 84 | diff --git a/log.c b/log.c |
| 85 | index 44344e2..991e359 100644 |
| 86 | --- a/log.c |
| 87 | +++ b/log.c |
| 88 | @@ -131,7 +131,7 @@ static void logit(int priority, const char *buf) |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | -static void syslog_init() |
| 93 | +static void syslog_init(void) |
| 94 | { |
| 95 | int options = LOG_PID; |
| 96 | |
| 97 | diff --git a/main.c b/main.c |
| 98 | index 9ebfbea..affa244 100644 |
| 99 | --- a/main.c |
| 100 | +++ b/main.c |
| 101 | @@ -244,7 +244,7 @@ void read_del_stats(int f) |
| 102 | stats.deleted_files += stats.deleted_specials = read_varint(f); |
| 103 | } |
| 104 | |
| 105 | -static void become_copy_as_user() |
| 106 | +static void become_copy_as_user(void) |
| 107 | { |
| 108 | char *gname; |
| 109 | uid_t uid; |
| 110 | diff --git a/syscall.c b/syscall.c |
| 111 | index d92074a..92ca86d 100644 |
| 112 | --- a/syscall.c |
| 113 | +++ b/syscall.c |
| 114 | @@ -389,9 +389,9 @@ OFF_T do_lseek(int fd, OFF_T offset, int whence) |
| 115 | { |
| 116 | #ifdef HAVE_LSEEK64 |
| 117 | #if !SIZEOF_OFF64_T |
| 118 | - OFF_T lseek64(); |
| 119 | + OFF_T lseek64(int fd, OFF_T offset, int whence); |
| 120 | #else |
| 121 | - off64_t lseek64(); |
| 122 | + off64_t lseek64(int fd, off64_t offset, int whence); |
| 123 | #endif |
| 124 | return lseek64(fd, offset, whence); |
| 125 | #else |
| 126 | diff --git a/zlib/crc32.c b/zlib/crc32.c |
| 127 | index 05733f4..50c6c02 100644 |
| 128 | --- a/zlib/crc32.c |
| 129 | +++ b/zlib/crc32.c |
| 130 | @@ -187,7 +187,7 @@ local void write_table(out, table) |
| 131 | /* ========================================================================= |
| 132 | * This function can be used by asm versions of crc32() |
| 133 | */ |
| 134 | -const z_crc_t FAR * ZEXPORT get_crc_table() |
| 135 | +const z_crc_t FAR * ZEXPORT get_crc_table(void) |
| 136 | { |
| 137 | #ifdef DYNAMIC_CRC_TABLE |
| 138 | if (crc_table_empty) |
| 139 | diff --git a/zlib/trees.c b/zlib/trees.c |
| 140 | index 9c66770..0d9047e 100644 |
| 141 | --- a/zlib/trees.c |
| 142 | +++ b/zlib/trees.c |
| 143 | @@ -231,7 +231,7 @@ local void send_bits(s, value, length) |
| 144 | /* =========================================================================== |
| 145 | * Initialize the various 'constant' tables. |
| 146 | */ |
| 147 | -local void tr_static_init() |
| 148 | +local void tr_static_init(void) |
| 149 | { |
| 150 | #if defined(GEN_TREES_H) || !defined(STDC) |
| 151 | static int static_init_done = 0; |
| 152 | diff --git a/zlib/zutil.c b/zlib/zutil.c |
| 153 | index bbba7b2..61f8dc9 100644 |
| 154 | --- a/zlib/zutil.c |
| 155 | +++ b/zlib/zutil.c |
| 156 | @@ -27,12 +27,12 @@ z_const char * const z_errmsg[10] = { |
| 157 | ""}; |
| 158 | |
| 159 | |
| 160 | -const char * ZEXPORT zlibVersion() |
| 161 | +const char * ZEXPORT zlibVersion(void) |
| 162 | { |
| 163 | return ZLIB_VERSION; |
| 164 | } |
| 165 | |
| 166 | -uLong ZEXPORT zlibCompileFlags() |
| 167 | +uLong ZEXPORT zlibCompileFlags(void) |
| 168 | { |
| 169 | uLong flags; |
| 170 | |
| 171 | -- |
| 172 | 2.37.2 |
| 173 | |