Skip to content

Commit a6b42ec

Browse files
committed
Merge branch 'jk/unused-annotation'
Annotate function parameters that are not used (but cannot be removed for structural reasons), to prepare us to later compile with -Wunused warning turned on. * jk/unused-annotation: is_path_owned_by_current_uid(): mark "report" parameter as unused run-command: mark unused async callback parameters mark unused read_tree_recursive() callback parameters hashmap: mark unused callback parameters config: mark unused callback parameters streaming: mark unused virtual method parameters transport: mark bundle transport_options as unused refs: mark unused virtual method parameters refs: mark unused reflog callback parameters refs: mark unused each_ref_fn parameters git-compat-util: add UNUSED macro
2 parents e188ec3 + 776515e commit a6b42ec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+337
-234
lines changed

add-interactive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ struct pathname_entry {
430430
struct file_item *item;
431431
};
432432

433-
static int pathname_entry_cmp(const void *unused_cmp_data,
433+
static int pathname_entry_cmp(const void *UNUSED(cmp_data),
434434
const struct hashmap_entry *he1,
435435
const struct hashmap_entry *he2,
436436
const void *name)

archive-tar.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,8 @@ static struct archiver *find_tar_filter(const char *name, size_t len)
366366
return NULL;
367367
}
368368

369-
static int tar_filter_config(const char *var, const char *value, void *data)
369+
static int tar_filter_config(const char *var, const char *value,
370+
void *UNUSED(data))
370371
{
371372
struct archiver *ar;
372373
const char *name;
@@ -420,7 +421,7 @@ static int git_tar_config(const char *var, const char *value, void *cb)
420421
return tar_filter_config(var, value, cb);
421422
}
422423

423-
static int write_tar_archive(const struct archiver *ar,
424+
static int write_tar_archive(const struct archiver *UNUSED(ar),
424425
struct archiver_args *args)
425426
{
426427
int err = 0;

archive-zip.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,12 +612,13 @@ static void dos_time(timestamp_t *timestamp, int *dos_date, int *dos_time)
612612
*dos_time = tm.tm_sec / 2 + tm.tm_min * 32 + tm.tm_hour * 2048;
613613
}
614614

615-
static int archive_zip_config(const char *var, const char *value, void *data)
615+
static int archive_zip_config(const char *var, const char *value,
616+
void *UNUSED(data))
616617
{
617618
return userdiff_config(var, value);
618619
}
619620

620-
static int write_zip_archive(const struct archiver *ar,
621+
static int write_zip_archive(const struct archiver *UNUSED(ar),
621622
struct archiver_args *args)
622623
{
623624
int err;

archive.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,8 @@ struct path_exists_context {
382382
struct archiver_args *args;
383383
};
384384

385-
static int reject_entry(const struct object_id *oid, struct strbuf *base,
385+
static int reject_entry(const struct object_id *UNUSED(oid),
386+
struct strbuf *base,
386387
const char *filename, unsigned mode,
387388
void *context)
388389
{

attr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ struct attr_hash_entry {
6161
};
6262

6363
/* attr_hashmap comparison function */
64-
static int attr_hash_entry_cmp(const void *unused_cmp_data,
64+
static int attr_hash_entry_cmp(const void *UNUSED(cmp_data),
6565
const struct hashmap_entry *eptr,
6666
const struct hashmap_entry *entry_or_key,
67-
const void *unused_keydata)
67+
const void *UNUSED(keydata))
6868
{
6969
const struct attr_hash_entry *a, *b;
7070

bisect.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ void find_bisection(struct commit_list **commit_list, int *reaches,
441441
}
442442

443443
static int register_ref(const char *refname, const struct object_id *oid,
444-
int flags, void *cb_data)
444+
int UNUSED(flags), void *UNUSED(cb_data))
445445
{
446446
struct strbuf good_prefix = STRBUF_INIT;
447447
strbuf_addstr(&good_prefix, term_good);
@@ -1160,8 +1160,9 @@ int estimate_bisect_steps(int all)
11601160
return (e < 3 * x) ? n : n - 1;
11611161
}
11621162

1163-
static int mark_for_removal(const char *refname, const struct object_id *oid,
1164-
int flag, void *cb_data)
1163+
static int mark_for_removal(const char *refname,
1164+
const struct object_id *UNUSED(oid),
1165+
int UNUSED(flag), void *cb_data)
11651166
{
11661167
struct string_list *refs = cb_data;
11671168
char *ref = xstrfmt("refs/bisect%s", refname);

bloom.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,10 @@ void init_bloom_filters(void)
163163
init_bloom_filter_slab(&bloom_filters);
164164
}
165165

166-
static int pathmap_cmp(const void *hashmap_cmp_fn_data,
166+
static int pathmap_cmp(const void *UNUSED(hashmap_cmp_fn_data),
167167
const struct hashmap_entry *eptr,
168168
const struct hashmap_entry *entry_or_key,
169-
const void *keydata)
169+
const void *UNUSED(keydata))
170170
{
171171
const struct pathmap_hash_entry *e1, *e2;
172172

builtin/am.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2301,7 +2301,7 @@ static int parse_opt_show_current_patch(const struct option *opt, const char *ar
23012301
return 0;
23022302
}
23032303

2304-
static int git_am_config(const char *k, const char *v, void *cb)
2304+
static int git_am_config(const char *k, const char *v, void *UNUSED(cb))
23052305
{
23062306
int status;
23072307

builtin/bisect--helper.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,9 @@ static int check_and_set_terms(struct bisect_terms *terms, const char *cmd)
329329
return 0;
330330
}
331331

332-
static int inc_nr(const char *refname, const struct object_id *oid,
333-
int flag, void *cb_data)
332+
static int inc_nr(const char *UNUSED(refname),
333+
const struct object_id *UNUSED(oid),
334+
int UNUSED(flag), void *cb_data)
334335
{
335336
unsigned int *nr = (unsigned int *)cb_data;
336337
(*nr)++;
@@ -518,7 +519,7 @@ static int bisect_append_log_quoted(const char **argv)
518519
}
519520

520521
static int add_bisect_ref(const char *refname, const struct object_id *oid,
521-
int flags, void *cb)
522+
int UNUSED(flags), void *cb)
522523
{
523524
struct add_bisect_ref_data *data = cb;
524525

@@ -1134,8 +1135,9 @@ static int bisect_visualize(struct bisect_terms *terms, const char **argv, int a
11341135
return res;
11351136
}
11361137

1137-
static int get_first_good(const char *refname, const struct object_id *oid,
1138-
int flag, void *cb_data)
1138+
static int get_first_good(const char *UNUSED(refname),
1139+
const struct object_id *oid,
1140+
int UNUSED(flag), void *cb_data)
11391141
{
11401142
oidcpy(cb_data, oid);
11411143
return 1;

builtin/checkout.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ static int post_checkout_hook(struct commit *old_commit, struct commit *new_comm
125125
}
126126

127127
static int update_some(const struct object_id *oid, struct strbuf *base,
128-
const char *pathname, unsigned mode, void *context)
128+
const char *pathname, unsigned mode, void *UNUSED(context))
129129
{
130130
int len;
131131
struct cache_entry *ce;
@@ -990,7 +990,7 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
990990

991991
static int add_pending_uninteresting_ref(const char *refname,
992992
const struct object_id *oid,
993-
int flags, void *cb_data)
993+
int UNUSED(flags), void *cb_data)
994994
{
995995
add_pending_oid(cb_data, refname, oid, UNINTERESTING);
996996
return 0;

0 commit comments

Comments
 (0)