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
This commit is contained in:
Junio C Hamano 2022-09-14 12:56:38 -07:00
Родитель e188ec3a73 776515ef8b
Коммит a6b42ec0c6
92 изменённых файлов: 337 добавлений и 234 удалений

Просмотреть файл

@ -430,7 +430,7 @@ struct pathname_entry {
struct file_item *item;
};
static int pathname_entry_cmp(const void *unused_cmp_data,
static int pathname_entry_cmp(const void *UNUSED(cmp_data),
const struct hashmap_entry *he1,
const struct hashmap_entry *he2,
const void *name)

Просмотреть файл

@ -366,7 +366,8 @@ static struct archiver *find_tar_filter(const char *name, size_t len)
return NULL;
}
static int tar_filter_config(const char *var, const char *value, void *data)
static int tar_filter_config(const char *var, const char *value,
void *UNUSED(data))
{
struct archiver *ar;
const char *name;
@ -420,7 +421,7 @@ static int git_tar_config(const char *var, const char *value, void *cb)
return tar_filter_config(var, value, cb);
}
static int write_tar_archive(const struct archiver *ar,
static int write_tar_archive(const struct archiver *UNUSED(ar),
struct archiver_args *args)
{
int err = 0;

Просмотреть файл

@ -612,12 +612,13 @@ static void dos_time(timestamp_t *timestamp, int *dos_date, int *dos_time)
*dos_time = tm.tm_sec / 2 + tm.tm_min * 32 + tm.tm_hour * 2048;
}
static int archive_zip_config(const char *var, const char *value, void *data)
static int archive_zip_config(const char *var, const char *value,
void *UNUSED(data))
{
return userdiff_config(var, value);
}
static int write_zip_archive(const struct archiver *ar,
static int write_zip_archive(const struct archiver *UNUSED(ar),
struct archiver_args *args)
{
int err;

Просмотреть файл

@ -382,7 +382,8 @@ struct path_exists_context {
struct archiver_args *args;
};
static int reject_entry(const struct object_id *oid, struct strbuf *base,
static int reject_entry(const struct object_id *UNUSED(oid),
struct strbuf *base,
const char *filename, unsigned mode,
void *context)
{

4
attr.c
Просмотреть файл

@ -61,10 +61,10 @@ struct attr_hash_entry {
};
/* attr_hashmap comparison function */
static int attr_hash_entry_cmp(const void *unused_cmp_data,
static int attr_hash_entry_cmp(const void *UNUSED(cmp_data),
const struct hashmap_entry *eptr,
const struct hashmap_entry *entry_or_key,
const void *unused_keydata)
const void *UNUSED(keydata))
{
const struct attr_hash_entry *a, *b;

Просмотреть файл

@ -441,7 +441,7 @@ void find_bisection(struct commit_list **commit_list, int *reaches,
}
static int register_ref(const char *refname, const struct object_id *oid,
int flags, void *cb_data)
int UNUSED(flags), void *UNUSED(cb_data))
{
struct strbuf good_prefix = STRBUF_INIT;
strbuf_addstr(&good_prefix, term_good);
@ -1160,8 +1160,9 @@ int estimate_bisect_steps(int all)
return (e < 3 * x) ? n : n - 1;
}
static int mark_for_removal(const char *refname, const struct object_id *oid,
int flag, void *cb_data)
static int mark_for_removal(const char *refname,
const struct object_id *UNUSED(oid),
int UNUSED(flag), void *cb_data)
{
struct string_list *refs = cb_data;
char *ref = xstrfmt("refs/bisect%s", refname);

Просмотреть файл

@ -163,10 +163,10 @@ void init_bloom_filters(void)
init_bloom_filter_slab(&bloom_filters);
}
static int pathmap_cmp(const void *hashmap_cmp_fn_data,
static int pathmap_cmp(const void *UNUSED(hashmap_cmp_fn_data),
const struct hashmap_entry *eptr,
const struct hashmap_entry *entry_or_key,
const void *keydata)
const void *UNUSED(keydata))
{
const struct pathmap_hash_entry *e1, *e2;

Просмотреть файл

@ -2301,7 +2301,7 @@ static int parse_opt_show_current_patch(const struct option *opt, const char *ar
return 0;
}
static int git_am_config(const char *k, const char *v, void *cb)
static int git_am_config(const char *k, const char *v, void *UNUSED(cb))
{
int status;

Просмотреть файл

@ -329,8 +329,9 @@ static int check_and_set_terms(struct bisect_terms *terms, const char *cmd)
return 0;
}
static int inc_nr(const char *refname, const struct object_id *oid,
int flag, void *cb_data)
static int inc_nr(const char *UNUSED(refname),
const struct object_id *UNUSED(oid),
int UNUSED(flag), void *cb_data)
{
unsigned int *nr = (unsigned int *)cb_data;
(*nr)++;
@ -518,7 +519,7 @@ finish:
}
static int add_bisect_ref(const char *refname, const struct object_id *oid,
int flags, void *cb)
int UNUSED(flags), void *cb)
{
struct add_bisect_ref_data *data = cb;
@ -1134,8 +1135,9 @@ static int bisect_visualize(struct bisect_terms *terms, const char **argv, int a
return res;
}
static int get_first_good(const char *refname, const struct object_id *oid,
int flag, void *cb_data)
static int get_first_good(const char *UNUSED(refname),
const struct object_id *oid,
int UNUSED(flag), void *cb_data)
{
oidcpy(cb_data, oid);
return 1;

Просмотреть файл

@ -125,7 +125,7 @@ static int post_checkout_hook(struct commit *old_commit, struct commit *new_comm
}
static int update_some(const struct object_id *oid, struct strbuf *base,
const char *pathname, unsigned mode, void *context)
const char *pathname, unsigned mode, void *UNUSED(context))
{
int len;
struct cache_entry *ce;
@ -990,7 +990,7 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
static int add_pending_uninteresting_ref(const char *refname,
const struct object_id *oid,
int flags, void *cb_data)
int UNUSED(flags), void *cb_data)
{
add_pending_oid(cb_data, refname, oid, UNINTERESTING);
return 0;

Просмотреть файл

@ -179,7 +179,7 @@ static int write_option_max_new_filters(const struct option *opt,
}
static int git_commit_graph_write_config(const char *var, const char *value,
void *cb)
void *UNUSED(cb))
{
if (!strcmp(var, "commitgraph.maxnewfilters"))
write_opts.max_new_filters = git_config_int(var, value);

Просмотреть файл

@ -207,7 +207,8 @@ static void show_config_scope(struct strbuf *buf)
strbuf_addch(buf, term);
}
static int show_all_config(const char *key_, const char *value_, void *cb)
static int show_all_config(const char *key_, const char *value_,
void *UNUSED(cb))
{
if (show_origin || show_scope) {
struct strbuf buf = STRBUF_INIT;
@ -458,7 +459,8 @@ static const char *get_color_slot;
static const char *get_colorbool_slot;
static char parsed_color[COLOR_MAXLEN];
static int git_get_color_config(const char *var, const char *value, void *cb)
static int git_get_color_config(const char *var, const char *value,
void *UNUSED(cb))
{
if (!strcmp(var, get_color_slot)) {
if (!value)
@ -490,7 +492,7 @@ static int get_colorbool_found;
static int get_diff_color_found;
static int get_color_ui_found;
static int git_get_colorbool_config(const char *var, const char *value,
void *cb)
void *UNUSED(data))
{
if (!strcmp(var, get_colorbool_slot))
get_colorbool_found = git_config_colorbool(var, value);

Просмотреть файл

@ -63,7 +63,7 @@ static const char *prio_names[] = {
N_("head"), N_("lightweight"), N_("annotated"),
};
static int commit_name_neq(const void *unused_cmp_data,
static int commit_name_neq(const void *UNUSED(cmp_data),
const struct hashmap_entry *eptr,
const struct hashmap_entry *entry_or_key,
const void *peeled)
@ -140,7 +140,8 @@ static void add_to_known_names(const char *path,
}
}
static int get_name(const char *path, const struct object_id *oid, int flag, void *cb_data)
static int get_name(const char *path, const struct object_id *oid,
int UNUSED(flag), void *UNUSED(cb_data))
{
int is_tag = 0;
struct object_id peeled;

Просмотреть файл

@ -125,10 +125,10 @@ struct working_tree_entry {
char path[FLEX_ARRAY];
};
static int working_tree_entry_cmp(const void *unused_cmp_data,
static int working_tree_entry_cmp(const void *UNUSED(cmp_data),
const struct hashmap_entry *eptr,
const struct hashmap_entry *entry_or_key,
const void *unused_keydata)
const void *UNUSED(keydata))
{
const struct working_tree_entry *a, *b;
@ -148,10 +148,10 @@ struct pair_entry {
const char path[FLEX_ARRAY];
};
static int pair_cmp(const void *unused_cmp_data,
static int pair_cmp(const void *UNUSED(cmp_data),
const struct hashmap_entry *eptr,
const struct hashmap_entry *entry_or_key,
const void *unused_keydata)
const void *UNUSED(keydata))
{
const struct pair_entry *a, *b;
@ -184,7 +184,7 @@ struct path_entry {
char path[FLEX_ARRAY];
};
static int path_entry_cmp(const void *unused_cmp_data,
static int path_entry_cmp(const void *UNUSED(cmp_data),
const struct hashmap_entry *eptr,
const struct hashmap_entry *entry_or_key,
const void *key)

Просмотреть файл

@ -119,7 +119,7 @@ struct anonymized_entry_key {
size_t orig_len;
};
static int anonymized_entry_cmp(const void *unused_cmp_data,
static int anonymized_entry_cmp(const void *UNUSED(cmp_data),
const struct hashmap_entry *eptr,
const struct hashmap_entry *entry_or_key,
const void *keydata)

Просмотреть файл

@ -46,7 +46,7 @@ struct object_entry {
depth : DEPTH_BITS;
};
static int object_entry_hashcmp(const void *map_data,
static int object_entry_hashcmp(const void *UNUSED(map_data),
const struct hashmap_entry *eptr,
const struct hashmap_entry *entry_or_key,
const void *keydata)

Просмотреть файл

@ -301,7 +301,7 @@ struct refname_hash_entry {
char refname[FLEX_ARRAY];
};
static int refname_hash_entry_cmp(const void *hashmap_cmp_fn_data,
static int refname_hash_entry_cmp(const void *UNUSED(hashmap_cmp_fn_data),
const struct hashmap_entry *eptr,
const struct hashmap_entry *entry_or_key,
const void *keydata)
@ -329,7 +329,7 @@ static struct refname_hash_entry *refname_hash_add(struct hashmap *map,
static int add_one_refname(const char *refname,
const struct object_id *oid,
int flag, void *cbdata)
int UNUSED(flag), void *cbdata)
{
struct hashmap *refname_map = cbdata;
@ -1464,8 +1464,9 @@ static void set_option(struct transport *transport, const char *name, const char
}
static int add_oid(const char *refname, const struct object_id *oid, int flags,
void *cb_data)
static int add_oid(const char *UNUSED(refname),
const struct object_id *oid,
int UNUSED(flags), void *cb_data)
{
struct oid_array *oids = cb_data;

Просмотреть файл

@ -488,8 +488,9 @@ static void fsck_handle_reflog_oid(const char *refname, struct object_id *oid,
}
static int fsck_handle_reflog_ent(struct object_id *ooid, struct object_id *noid,
const char *email, timestamp_t timestamp, int tz,
const char *message, void *cb_data)
const char *UNUSED(email),
timestamp_t timestamp, int UNUSED(tz),
const char *UNUSED(message), void *cb_data)
{
const char *refname = cb_data;
@ -502,8 +503,9 @@ static int fsck_handle_reflog_ent(struct object_id *ooid, struct object_id *noid
return 0;
}
static int fsck_handle_reflog(const char *logname, const struct object_id *oid,
int flag, void *cb_data)
static int fsck_handle_reflog(const char *logname,
const struct object_id *UNUSED(oid),
int UNUSED(flag), void *cb_data)
{
struct strbuf refname = STRBUF_INIT;
@ -514,7 +516,7 @@ static int fsck_handle_reflog(const char *logname, const struct object_id *oid,
}
static int fsck_handle_ref(const char *refname, const struct object_id *oid,
int flag, void *cb_data)
int UNUSED(flag), void *UNUSED(cb_data))
{
struct object *obj;

Просмотреть файл

@ -782,8 +782,9 @@ struct cg_auto_data {
int limit;
};
static int dfs_on_ref(const char *refname,
const struct object_id *oid, int flags,
static int dfs_on_ref(const char *UNUSED(refname),
const struct object_id *oid,
int UNUSED(flags),
void *cb_data)
{
struct cg_auto_data *data = (struct cg_auto_data *)cb_data;

Просмотреть файл

@ -698,9 +698,10 @@ static int show_tag_object(const struct object_id *oid, struct rev_info *rev)
return 0;
}
static int show_tree_object(const struct object_id *oid,
struct strbuf *base,
const char *pathname, unsigned mode, void *context)
static int show_tree_object(const struct object_id *UNUSED(oid),
struct strbuf *UNUSED(base),
const char *pathname, unsigned mode,
void *context)
{
FILE *file = context;
fprintf(file, "%s%s\n", pathname, S_ISDIR(mode) ? "/" : "");

Просмотреть файл

@ -142,7 +142,7 @@ static int show_recursive(const char *base, size_t baselen, const char *pathname
}
static int show_tree_fmt(const struct object_id *oid, struct strbuf *base,
const char *pathname, unsigned mode, void *context)
const char *pathname, unsigned mode, void *UNUSED(context))
{
size_t baselen;
int recurse = 0;
@ -213,7 +213,7 @@ static void show_tree_common_default_long(struct strbuf *base,
static int show_tree_default(const struct object_id *oid, struct strbuf *base,
const char *pathname, unsigned mode,
void *context)
void *UNUSED(context))
{
int early;
int recurse;
@ -230,7 +230,8 @@ static int show_tree_default(const struct object_id *oid, struct strbuf *base,
}
static int show_tree_long(const struct object_id *oid, struct strbuf *base,
const char *pathname, unsigned mode, void *context)
const char *pathname, unsigned mode,
void *UNUSED(context))
{
int early;
int recurse;
@ -259,7 +260,8 @@ static int show_tree_long(const struct object_id *oid, struct strbuf *base,
}
static int show_tree_name_only(const struct object_id *oid, struct strbuf *base,
const char *pathname, unsigned mode, void *context)
const char *pathname, unsigned mode,
void *UNUSED(context))
{
int early;
int recurse;
@ -279,7 +281,8 @@ static int show_tree_name_only(const struct object_id *oid, struct strbuf *base,
}
static int show_tree_object(const struct object_id *oid, struct strbuf *base,
const char *pathname, unsigned mode, void *context)
const char *pathname, unsigned mode,
void *UNUSED(context))
{
int early;
int recurse;

Просмотреть файл

@ -78,7 +78,7 @@ static struct option *add_common_options(struct option *prev)
}
static int git_multi_pack_index_write_config(const char *var, const char *value,
void *cb)
void *UNUSED(cb))
{
if (!strcmp(var, "pack.writebitmaphashcache")) {
if (git_config_bool(var, value))

Просмотреть файл

@ -344,7 +344,8 @@ static int cmp_by_tag_and_age(const void *a_, const void *b_)
return a->taggerdate != b->taggerdate;
}
static int name_ref(const char *path, const struct object_id *oid, int flags, void *cb_data)
static int name_ref(const char *path, const struct object_id *oid,
int UNUSED(flags), void *cb_data)
{
struct object *o = parse_object(the_repository, oid);
struct name_ref_data *data = cb_data;

Просмотреть файл

@ -759,8 +759,8 @@ static enum write_one_status write_one(struct hashfile *f,
return WRITE_ONE_WRITTEN;
}
static int mark_tagged(const char *path, const struct object_id *oid, int flag,
void *cb_data)
static int mark_tagged(const char *UNUSED(path), const struct object_id *oid,
int UNUSED(flag), void *UNUSED(cb_data))
{
struct object_id peeled;
struct object_entry *entry = packlist_find(&to_pack, oid);
@ -3035,7 +3035,8 @@ static void add_tag_chain(const struct object_id *oid)
}
}
static int add_ref_tag(const char *tag, const struct object_id *oid, int flag, void *cb_data)
static int add_ref_tag(const char *UNUSED(tag), const struct object_id *oid,
int UNUSED(flag), void *UNUSED(cb_data))
{
struct object_id peeled;
@ -3958,8 +3959,9 @@ static void record_recent_commit(struct commit *commit, void *data)
}
static int mark_bitmap_preferred_tip(const char *refname,
const struct object_id *oid, int flags,
void *_data)
const struct object_id *oid,
int UNUSED(flags),
void *UNUSED(data))
{
struct object_id peeled;
struct object *object;

Просмотреть файл

@ -291,7 +291,7 @@ static void show_ref(const char *path, const struct object_id *oid)
}
static int show_ref_cb(const char *path_full, const struct object_id *oid,
int flag, void *data)
int UNUSED(flag), void *data)
{
struct oidset *seen = data;
const char *path = strip_namespace(path_full);
@ -465,7 +465,7 @@ static void rp_error(const char *err, ...)
va_end(params);
}
static int copy_to_sideband(int in, int out, void *arg)
static int copy_to_sideband(int in, int UNUSED(out), void *UNUSED(arg))
{
char data[128];
int keepalive_active = 0;

Просмотреть файл

@ -56,7 +56,8 @@ struct worktree_reflogs {
struct string_list reflogs;
};
static int collect_reflog(const char *ref, const struct object_id *oid, int unused, void *cb_data)
static int collect_reflog(const char *ref, const struct object_id *UNUSED(oid),
int UNUSED(flags), void *cb_data)
{
struct worktree_reflogs *cb = cb_data;
struct worktree *worktree = cb->worktree;

Просмотреть файл

@ -264,7 +264,8 @@ static const char *abbrev_ref(const char *name, const char *prefix)
}
#define abbrev_branch(name) abbrev_ref((name), "refs/heads/")
static int config_read_branches(const char *key, const char *value, void *cb)
static int config_read_branches(const char *key, const char *value,
void *UNUSED(data))
{
const char *orig_key = key;
char *name;
@ -538,7 +539,8 @@ struct branches_for_remote {
};
static int add_branch_for_removal(const char *refname,
const struct object_id *oid, int flags, void *cb_data)
const struct object_id *UNUSED(oid),
int UNUSED(flags), void *cb_data)
{
struct branches_for_remote *branches = cb_data;
struct refspec_item refspec;
@ -580,7 +582,8 @@ struct rename_info {
};
static int read_remote_branches(const char *refname,
const struct object_id *oid, int flags, void *cb_data)
const struct object_id *UNUSED(oid),
int UNUSED(flags), void *cb_data)
{
struct rename_info *rename = cb_data;
struct strbuf buf = STRBUF_INIT;
@ -955,7 +958,8 @@ static void free_remote_ref_states(struct ref_states *states)
}
static int append_ref_to_tracked_list(const char *refname,
const struct object_id *oid, int flags, void *cb_data)
const struct object_id *UNUSED(oid),
int flags, void *cb_data)
{
struct ref_states *states = cb_data;
struct refspec_item refspec;
@ -1485,7 +1489,7 @@ static int prune(int argc, const char **argv, const char *prefix)
return result;
}
static int get_remote_default(const char *key, const char *value, void *priv)
static int get_remote_default(const char *key, const char *UNUSED(value), void *priv)
{
if (strcmp(key, "remotes.default") == 0) {
int *found = priv;

Просмотреть файл

@ -514,9 +514,9 @@ struct midx_snapshot_ref_data {
int preferred;
};
static int midx_snapshot_ref_one(const char *refname,
static int midx_snapshot_ref_one(const char *UNUSED(refname),
const struct object_id *oid,
int flag, void *_data)
int UNUSED(flag), void *_data)
{
struct midx_snapshot_ref_data *data = _data;
struct object_id peeled;

Просмотреть файл

@ -195,7 +195,8 @@ static int show_default(void)
return 0;
}
static int show_reference(const char *refname, const struct object_id *oid, int flag, void *cb_data)
static int show_reference(const char *refname, const struct object_id *oid,
int UNUSED(flag), void *UNUSED(cb_data))
{
if (ref_excluded(ref_excludes, refname))
return 0;
@ -203,7 +204,8 @@ static int show_reference(const char *refname, const struct object_id *oid, int
return 0;
}
static int anti_reference(const char *refname, const struct object_id *oid, int flag, void *cb_data)
static int anti_reference(const char *refname, const struct object_id *oid,
int UNUSED(flag), void *UNUSED(cb_data))
{
show_rev(REVERSED, oid, refname);
return 0;

Просмотреть файл

@ -404,7 +404,7 @@ static int append_ref(const char *refname, const struct object_id *oid,
}
static int append_head_ref(const char *refname, const struct object_id *oid,
int flag, void *cb_data)
int UNUSED(flag), void *UNUSED(cb_data))
{
struct object_id tmp;
int ofs = 11;
@ -419,7 +419,7 @@ static int append_head_ref(const char *refname, const struct object_id *oid,
}
static int append_remote_ref(const char *refname, const struct object_id *oid,
int flag, void *cb_data)
int UNUSED(flag), void *UNUSED(cb_data))
{
struct object_id tmp;
int ofs = 13;
@ -434,7 +434,7 @@ static int append_remote_ref(const char *refname, const struct object_id *oid,
}
static int append_tag_ref(const char *refname, const struct object_id *oid,
int flag, void *cb_data)
int UNUSED(flag), void *UNUSED(cb_data))
{
if (!starts_with(refname, "refs/tags/"))
return 0;

Просмотреть файл

@ -47,7 +47,7 @@ static void show_one(const char *refname, const struct object_id *oid)
}
static int show_ref(const char *refname, const struct object_id *oid,
int flag, void *cbdata)
int UNUSED(flag), void *UNUSED(cbdata))
{
if (show_head && !strcmp(refname, "HEAD"))
goto match;
@ -77,8 +77,9 @@ match:
return 0;
}
static int add_existing(const char *refname, const struct object_id *oid,
int flag, void *cbdata)
static int add_existing(const char *refname,
const struct object_id *UNUSED(oid),
int UNUSED(flag), void *cbdata)
{
struct string_list *list = (struct string_list *)cbdata;
string_list_insert(list, refname);

Просмотреть файл

@ -638,9 +638,12 @@ cleanup:
return ret;
}
static int reject_reflog_ent(struct object_id *ooid, struct object_id *noid,
const char *email, timestamp_t timestamp, int tz,
const char *message, void *cb_data)
static int reject_reflog_ent(struct object_id *UNUSED(ooid),
struct object_id *UNUSED(noid),
const char *UNUSED(email),
timestamp_t UNUSED(timestamp),
int UNUSED(tz), const char *UNUSED(message),
void *UNUSED(cb_data))
{
return 1;
}

Просмотреть файл

@ -573,8 +573,9 @@ static void print_status(unsigned int flags, char state, const char *path,
printf("\n");
}
static int handle_submodule_head_ref(const char *refname,
const struct object_id *oid, int flags,
static int handle_submodule_head_ref(const char *UNUSED(refname),
const struct object_id *oid,
int UNUSED(flags),
void *cb_data)
{
struct object_id *output = cb_data;

Просмотреть файл

@ -415,7 +415,7 @@ int want_color_fd(int fd, int var)
return var;
}
int git_color_config(const char *var, const char *value, void *cb)
int git_color_config(const char *var, const char *value, void *UNUSED(cb))
{
if (!strcmp(var, "color.ui")) {
git_use_color_default = git_config_colorbool(var, value);

Просмотреть файл

@ -1639,9 +1639,9 @@ struct refs_cb_data {
struct progress *progress;
};
static int add_ref_to_set(const char *refname,
static int add_ref_to_set(const char *UNUSED(refname),
const struct object_id *oid,
int flags, void *cb_data)
int UNUSED(flags), void *cb_data)
{
struct object_id peeled;
struct refs_cb_data *data = (struct refs_cb_data *)cb_data;

Просмотреть файл

@ -951,8 +951,9 @@ static void add_one_commit(struct object_id *oid, struct rev_collect *revs)
}
static int collect_one_reflog_ent(struct object_id *ooid, struct object_id *noid,
const char *ident, timestamp_t timestamp,
int tz, const char *message, void *cbdata)
const char *UNUSED(ident),
timestamp_t UNUSED(timestamp), int UNUSED(tz),
const char *UNUSED(message), void *cbdata)
{
struct rev_collect *revs = cbdata;

Просмотреть файл

@ -477,7 +477,7 @@ struct escape_sequence_entry {
char sequence[FLEX_ARRAY];
};
static int sequence_entry_cmp(const void *hashmap_cmp_fn_data,
static int sequence_entry_cmp(const void *UNUSED(hashmap_cmp_fn_data),
const struct escape_sequence_entry *e1,
const struct escape_sequence_entry *e2,
const void *keydata)

Просмотреть файл

@ -362,7 +362,8 @@ static void populate_remote_urls(struct config_include_data *inc)
current_parsing_scope = store_scope;
}
static int forbid_remote_url(const char *var, const char *value, void *data)
static int forbid_remote_url(const char *var, const char *UNUSED(value),
void *UNUSED(data))
{
const char *remote_name;
size_t remote_name_len;
@ -2337,10 +2338,10 @@ static int configset_add_value(struct config_set *cs, const char *key, const cha
return 0;
}
static int config_set_element_cmp(const void *unused_cmp_data,
static int config_set_element_cmp(const void *UNUSED(cmp_data),
const struct hashmap_entry *eptr,
const struct hashmap_entry *entry_or_key,
const void *unused_keydata)
const void *UNUSED(keydata))
{
const struct config_set_element *e1, *e2;

Просмотреть файл

@ -619,7 +619,7 @@ struct filter_params {
const char *path;
};
static int filter_buffer_or_fd(int in, int out, void *data)
static int filter_buffer_or_fd(int UNUSED(in), int out, void *data)
{
/*
* Spawn cmd and feed the buffer contents through its stdin.
@ -1008,7 +1008,7 @@ static int apply_filter(const char *path, const char *src, size_t len,
return 0;
}
static int read_convert_config(const char *var, const char *value, void *cb)
static int read_convert_config(const char *var, const char *value, void *UNUSED(cb))
{
const char *key, *name;
size_t namelen;

Просмотреть файл

@ -316,7 +316,7 @@ static regex_t *island_regexes;
static unsigned int island_regexes_alloc, island_regexes_nr;
static const char *core_island_name;
static int island_config_callback(const char *k, const char *v, void *cb)
static int island_config_callback(const char *k, const char *v, void *UNUSED(cb))
{
if (!strcmp(k, "pack.island")) {
struct strbuf re = STRBUF_INIT;
@ -365,7 +365,7 @@ static void add_ref_to_island(const char *island_name, const struct object_id *o
}
static int find_island_for_ref(const char *refname, const struct object_id *oid,
int flags, void *data)
int UNUSED(flags), void *UNUSED(data))
{
/*
* We should advertise 'ARRAY_SIZE(matches) - 2' as the max,

5
diff.c
Просмотреть файл

@ -264,7 +264,8 @@ void init_diff_ui_defaults(void)
diff_detect_rename_default = DIFF_DETECT_RENAME;
}
int git_diff_heuristic_config(const char *var, const char *value, void *cb)
int git_diff_heuristic_config(const char *var, const char *value,
void *UNUSED(cb))
{
if (!strcmp(var, "diff.indentheuristic"))
diff_indent_heuristic = git_config_bool(var, value);
@ -916,7 +917,7 @@ struct interned_diff_symbol {
static int interned_diff_symbol_cmp(const void *hashmap_cmp_fn_data,
const struct hashmap_entry *eptr,
const struct hashmap_entry *entry_or_key,
const void *keydata)
const void *UNUSED(keydata))
{
const struct diff_options *diffopt = hashmap_cmp_fn_data;
const struct emitted_diff_symbol *a, *b;

4
dir.c
Просмотреть файл

@ -655,10 +655,10 @@ void parse_path_pattern(const char **pattern,
*patternlen = len;
}
int pl_hashmap_cmp(const void *unused_cmp_data,
int pl_hashmap_cmp(const void *UNUSED(cmp_data),
const struct hashmap_entry *a,
const struct hashmap_entry *b,
const void *key)
const void *UNUSED(key))
{
const struct pattern_entry *ee1 =
container_of(a, struct pattern_entry, ent);

Просмотреть файл

@ -334,10 +334,10 @@ static void set_git_dir_1(const char *path)
setup_git_env(path);
}
static void update_relative_gitdir(const char *name,
static void update_relative_gitdir(const char *UNUSED(name),
const char *old_cwd,
const char *new_cwd,
void *data)
void *UNUSED(data))
{
char *path = reparent_relative_path(old_cwd, new_cwd, get_git_dir());
struct tmp_objdir *tmp_objdir = tmp_objdir_unapply_primary_odb();

Просмотреть файл

@ -176,8 +176,10 @@ static int rev_list_insert_ref(struct fetch_negotiator *negotiator,
return 0;
}
static int rev_list_insert_ref_oid(const char *refname, const struct object_id *oid,
int flag, void *cb_data)
static int rev_list_insert_ref_oid(const char *UNUSED(refname),
const struct object_id *oid,
int UNUSED(flag),
void *cb_data)
{
return rev_list_insert_ref(cb_data, oid);
}
@ -600,8 +602,10 @@ static int mark_complete(const struct object_id *oid)
return 0;
}
static int mark_complete_oid(const char *refname, const struct object_id *oid,
int flag, void *cb_data)
static int mark_complete_oid(const char *UNUSED(refname),
const struct object_id *oid,
int UNUSED(flag),
void *UNUSED(cb_data))
{
return mark_complete(oid);
}
@ -839,7 +843,7 @@ static int everything_local(struct fetch_pack_args *args,
return retval;
}
static int sideband_demux(int in, int out, void *data)
static int sideband_demux(int UNUSED(in), int out, void *data)
{
int *xd = data;
int ret;

Просмотреть файл

@ -189,6 +189,12 @@ struct strbuf;
#define _NETBSD_SOURCE 1
#define _SGI_SOURCE 1
#if defined(__GNUC__)
#define UNUSED(var) UNUSED_##var __attribute__((unused))
#else
#define UNUSED(var) UNUSED_##var
#endif
#if defined(WIN32) && !defined(__CYGWIN__) /* Both MinGW and MSVC */
# if !defined(_WIN32_WINNT)
# define _WIN32_WINNT 0x0600
@ -398,7 +404,9 @@ typedef uintmax_t timestamp_t;
#endif
#ifndef platform_core_config
static inline int noop_core_config(const char *var, const char *value, void *cb)
static inline int noop_core_config(const char *UNUSED(var),
const char *UNUSED(value),
void *UNUSED(cb))
{
return 0;
}
@ -491,7 +499,8 @@ static inline void extract_id_from_env(const char *env, uid_t *id)
}
}
static inline int is_path_owned_by_current_uid(const char *path, struct strbuf *report)
static inline int is_path_owned_by_current_uid(const char *path,
struct strbuf *UNUSED(report))
{
struct stat st;
uid_t euid;

Просмотреть файл

@ -699,7 +699,7 @@ void set_signing_key(const char *key)
configured_signing_key = xstrdup(key);
}
int git_gpg_config(const char *var, const char *value, void *cb)
int git_gpg_config(const char *var, const char *value, void *UNUSED(cb))
{
struct gpg_format *fmt = NULL;
char *fmtname = NULL;

Просмотреть файл

@ -142,10 +142,10 @@ static inline struct hashmap_entry **find_entry_ptr(const struct hashmap *map,
return e;
}
static int always_equal(const void *unused_cmp_data,
const struct hashmap_entry *unused1,
const struct hashmap_entry *unused2,
const void *unused_keydata)
static int always_equal(const void *UNUSED(cmp_data),
const struct hashmap_entry *UNUSED(entry1),
const struct hashmap_entry *UNUSED(entry2),
const void *UNUSED(keydata))
{
return 0;
}
@ -313,7 +313,7 @@ struct pool_entry {
unsigned char data[FLEX_ARRAY];
};
static int pool_entry_cmp(const void *unused_cmp_data,
static int pool_entry_cmp(const void *UNUSED(cmp_data),
const struct hashmap_entry *eptr,
const struct hashmap_entry *entry_or_key,
const void *keydata)

5
help.c
Просмотреть файл

@ -781,8 +781,9 @@ struct similar_ref_cb {
struct string_list *similar_refs;
};
static int append_similar_ref(const char *refname, const struct object_id *oid,
int flags, void *cb_data)
static int append_similar_ref(const char *refname,
const struct object_id *UNUSED(oid),
int UNUSED(flags), void *cb_data)
{
struct similar_ref_cb *cb = (struct similar_ref_cb *)(cb_data);
char *branch = strrchr(refname, '/') + 1;

Просмотреть файл

@ -505,7 +505,7 @@ static void run_service(const char **argv, int buffer_input)
}
static int show_text_ref(const char *name, const struct object_id *oid,
int flag, void *cb_data)
int UNUSED(flag), void *cb_data)
{
const char *name_nons = strip_namespace(name);
struct strbuf *buf = cb_data;

Просмотреть файл

@ -668,7 +668,7 @@ static int set_ident(const char *var, const char *value)
return 0;
}
int git_ident_config(const char *var, const char *value, void *data)
int git_ident_config(const char *var, const char *value, void *UNUSED(data))
{
if (!strcmp(var, "user.useconfigonly")) {
ident_use_config_only = git_config_bool(var, value);

Просмотреть файл

@ -249,7 +249,8 @@ static enum ll_merge_result ll_ext_merge(const struct ll_merge_driver *fn,
static struct ll_merge_driver *ll_user_merge, **ll_user_merge_tail;
static const char *default_ll_merge;
static int read_merge_config(const char *var, const char *value, void *cb)
static int read_merge_config(const char *var, const char *value,
void *UNUSED(cb))
{
struct ll_merge_driver *fn;
const char *key, *name;

Просмотреть файл

@ -135,7 +135,8 @@ static int ref_filter_match(const char *refname,
}
static int add_ref_decoration(const char *refname, const struct object_id *oid,
int flags, void *cb_data)
int UNUSED(flags),
void *cb_data)
{
int i;
struct object *obj;

Просмотреть файл

@ -136,7 +136,8 @@ static void send_possibly_unborn_head(struct ls_refs_data *data)
strbuf_release(&namespaced);
}
static int ls_refs_config(const char *var, const char *value, void *data)
static int ls_refs_config(const char *var, const char *value,
void *UNUSED(data))
{
/*
* We only serve fetches over v2 for now, so respect only "uploadpack"

Просмотреть файл

@ -45,7 +45,7 @@ struct path_hashmap_entry {
char path[FLEX_ARRAY];
};
static int path_hashmap_cmp(const void *cmp_data,
static int path_hashmap_cmp(const void *UNUSED(cmp_data),
const struct hashmap_entry *eptr,
const struct hashmap_entry *entry_or_key,
const void *keydata)
@ -89,10 +89,10 @@ static struct dir_rename_entry *dir_rename_find_entry(struct hashmap *hashmap,
return hashmap_get_entry(hashmap, &key, ent, NULL);
}
static int dir_rename_cmp(const void *unused_cmp_data,
static int dir_rename_cmp(const void *UNUSED(cmp_data),
const struct hashmap_entry *eptr,
const struct hashmap_entry *entry_or_key,
const void *unused_keydata)
const void *UNUSED(keydata))
{
const struct dir_rename_entry *e1, *e2;
@ -134,10 +134,10 @@ static struct collision_entry *collision_find_entry(struct hashmap *hashmap,
return hashmap_get_entry(hashmap, &key, ent, NULL);
}
static int collision_cmp(const void *unused_cmp_data,
static int collision_cmp(const void *UNUSED(cmp_data),
const struct hashmap_entry *eptr,
const struct hashmap_entry *entry_or_key,
const void *unused_keydata)
const void *UNUSED(keydata))
{
const struct collision_entry *e1, *e2;
@ -456,7 +456,7 @@ static void unpack_trees_finish(struct merge_options *opt)
clear_unpack_trees_porcelain(&opt->priv->unpack_opts);
}
static int save_files_dirs(const struct object_id *oid,
static int save_files_dirs(const struct object_id *UNUSED(oid),
struct strbuf *base, const char *path,
unsigned int mode, void *context)
{

Просмотреть файл

@ -18,7 +18,7 @@ struct dir_entry {
char name[FLEX_ARRAY];
};
static int dir_entry_cmp(const void *unused_cmp_data,
static int dir_entry_cmp(const void *UNUSED(cmp_data),
const struct hashmap_entry *eptr,
const struct hashmap_entry *entry_or_key,
const void *keydata)
@ -120,7 +120,7 @@ static void hash_index_entry(struct index_state *istate, struct cache_entry *ce)
add_dir_entry(istate, ce);
}
static int cache_entry_cmp(const void *unused_cmp_data,
static int cache_entry_cmp(const void *UNUSED(cmp_data),
const struct hashmap_entry *eptr,
const struct hashmap_entry *entry_or_key,
const void *remove)

Просмотреть файл

@ -36,7 +36,8 @@ static void rev_list_push(struct negotiation_state *ns,
}
static int clear_marks(const char *refname, const struct object_id *oid,
int flag, void *cb_data)
int UNUSED(flag),
void *UNUSED(cb_data))
{
struct object *o = deref_tag(the_repository, parse_object(the_repository, oid), refname, 0);

Просмотреть файл

@ -72,7 +72,8 @@ static struct entry *rev_list_push(struct data *data, struct commit *commit, int
}
static int clear_marks(const char *refname, const struct object_id *oid,
int flag, void *cb_data)
int UNUSED(flag),
void *UNUSED(cb_data))
{
struct object *o = deref_tag(the_repository, parse_object(the_repository, oid), refname, 0);

Просмотреть файл

@ -924,8 +924,9 @@ out:
return ret;
}
static int string_list_add_one_ref(const char *refname, const struct object_id *oid,
int flag, void *cb)
static int string_list_add_one_ref(const char *refname,
const struct object_id *UNUSED(oid),
int UNUSED(flag), void *cb)
{
struct string_list *refs = cb;
if (!unsorted_string_list_has_string(refs, refname))

Просмотреть файл

@ -1306,7 +1306,8 @@ struct handle_one_ref_cb {
};
static int handle_one_ref(const char *path, const struct object_id *oid,
int flag, void *cb_data)
int UNUSED(flag),
void *cb_data)
{
struct handle_one_ref_cb *cb = cb_data;
struct commit_list **list = cb->list;
@ -1384,8 +1385,11 @@ struct grab_nth_branch_switch_cbdata {
struct strbuf *sb;
};
static int grab_nth_branch_switch(struct object_id *ooid, struct object_id *noid,
const char *email, timestamp_t timestamp, int tz,
static int grab_nth_branch_switch(struct object_id *UNUSED(ooid),
struct object_id *UNUSED(noid),
const char *UNUSED(email),
timestamp_t UNUSED(timestamp),
int UNUSED(tz),
const char *message, void *cb_data)
{
struct grab_nth_branch_switch_cbdata *cb = cb_data;

Просмотреть файл

@ -141,7 +141,7 @@ struct packed_git {
struct multi_pack_index;
static inline int pack_map_entry_cmp(const void *unused_cmp_data,
static inline int pack_map_entry_cmp(const void *UNUSED(cmp_data),
const struct hashmap_entry *entry,
const struct hashmap_entry *entry2,
const void *keydata)

Просмотреть файл

@ -1,7 +1,7 @@
#include "cache.h"
#include "oidmap.h"
static int oidmap_neq(const void *hashmap_cmp_fn_data,
static int oidmap_neq(const void *UNUSED(hashmap_cmp_fn_data),
const struct hashmap_entry *e1,
const struct hashmap_entry *e2,
const void *keydata)

Просмотреть файл

@ -1392,7 +1392,7 @@ static int delta_base_cache_key_eq(const struct delta_base_cache_key *a,
return a->p == b->p && a->base_offset == b->base_offset;
}
static int delta_base_cache_hash_cmp(const void *unused_cmp_data,
static int delta_base_cache_hash_cmp(const void *UNUSED(cmp_data),
const struct hashmap_entry *va,
const struct hashmap_entry *vb,
const void *vkey)

Просмотреть файл

@ -38,7 +38,8 @@ static void wait_for_pager_signal(int signo)
raise(signo);
}
static int core_pager_config(const char *var, const char *value, void *data)
static int core_pager_config(const char *var, const char *value,
void *UNUSED(data))
{
if (!strcmp(var, "core.pager"))
return git_config_string(&pager_program, var, value);

Просмотреть файл

@ -38,7 +38,7 @@ int commit_patch_id(struct commit *commit, struct diff_options *options,
static int patch_id_neq(const void *cmpfn_data,
const struct hashmap_entry *eptr,
const struct hashmap_entry *entry_or_key,
const void *unused_keydata)
const void *UNUSED(keydata))
{
/* NEEDSWORK: const correctness? */
struct diff_options *opt = (void *)cmpfn_data;

Просмотреть файл

@ -43,7 +43,8 @@ static void save_user_format(struct rev_info *rev, const char *cp, int is_tforma
rev->commit_format = CMIT_FMT_USERFORMAT;
}
static int git_pretty_formats_config(const char *var, const char *value, void *cb)
static int git_pretty_formats_config(const char *var, const char *value,
void *UNUSED(cb))
{
struct cmt_fmt_map *commit_format = NULL;
const char *name;

Просмотреть файл

@ -224,8 +224,10 @@ cleanup:
return ret;
}
static int patch_util_cmp(const void *dummy, const struct patch_util *a,
const struct patch_util *b, const char *keydata)
static int patch_util_cmp(const void *UNUSED(cmp_data),
const struct patch_util *a,
const struct patch_util *b,
const char *keydata)
{
return strcmp(a->diff, keydata ? keydata : b->diff);
}

Просмотреть файл

@ -89,7 +89,7 @@ struct ref_to_worktree_entry {
struct worktree *wt; /* key is wt->head_ref */
};
static int ref_to_worktree_map_cmpfnc(const void *unused_lookupdata,
static int ref_to_worktree_map_cmpfnc(const void *UNUSED(lookupdata),
const struct hashmap_entry *eptr,
const struct hashmap_entry *kptr,
const void *keydata_aka_refname)

Просмотреть файл

@ -240,8 +240,9 @@ static int unreachable(struct expire_reflog_policy_cb *cb, struct commit *commit
* Return true iff the specified reflog entry should be expired.
*/
int should_expire_reflog_ent(struct object_id *ooid, struct object_id *noid,
const char *email, timestamp_t timestamp, int tz,
const char *message, void *cb_data)
const char *UNUSED(email),
timestamp_t timestamp, int UNUSED(tz),
const char *UNUSED(message), void *cb_data)
{
struct expire_reflog_policy_cb *cb = cb_data;
struct commit *old_commit, *new_commit;
@ -294,7 +295,8 @@ int should_expire_reflog_ent_verbose(struct object_id *ooid,
return expire;
}
static int push_tip_to_list(const char *refname, const struct object_id *oid,
static int push_tip_to_list(const char *UNUSED(refname),
const struct object_id *oid,
int flags, void *cb_data)
{
struct commit_list **list = cb_data;
@ -378,9 +380,11 @@ void reflog_expiry_cleanup(void *cb_data)
}
}
int count_reflog_ent(struct object_id *ooid, struct object_id *noid,
const char *email, timestamp_t timestamp, int tz,
const char *message, void *cb_data)
int count_reflog_ent(struct object_id *UNUSED(ooid),
struct object_id *UNUSED(noid),
const char *UNUSED(email),
timestamp_t timestamp, int UNUSED(tz),
const char *UNUSED(message), void *cb_data)
{
struct cmd_reflog_expire_cb *cb = cb_data;
if (!cb->expire_total || timestamp < cb->expire_total)

23
refs.c
Просмотреть файл

@ -441,7 +441,8 @@ struct warn_if_dangling_data {
const char *msg_fmt;
};
static int warn_if_dangling_symref(const char *refname, const struct object_id *oid,
static int warn_if_dangling_symref(const char *refname,
const struct object_id *UNUSED(oid),
int flags, void *cb_data)
{
struct warn_if_dangling_data *d = cb_data;
@ -981,8 +982,9 @@ static void set_read_ref_cutoffs(struct read_ref_at_cb *cb,
}
static int read_ref_at_ent(struct object_id *ooid, struct object_id *noid,
const char *email, timestamp_t timestamp, int tz,
const char *message, void *cb_data)
const char *UNUSED(email),
timestamp_t timestamp, int tz,
const char *message, void *cb_data)
{
struct read_ref_at_cb *cb = cb_data;
int reached_count;
@ -1022,9 +1024,11 @@ static int read_ref_at_ent(struct object_id *ooid, struct object_id *noid,
return cb->found_it;
}
static int read_ref_at_ent_newest(struct object_id *ooid, struct object_id *noid,
const char *email, timestamp_t timestamp,
int tz, const char *message, void *cb_data)
static int read_ref_at_ent_newest(struct object_id *UNUSED(ooid),
struct object_id *noid,
const char *UNUSED(email),
timestamp_t timestamp, int tz,
const char *message, void *cb_data)
{
struct read_ref_at_cb *cb = cb_data;
@ -1035,8 +1039,9 @@ static int read_ref_at_ent_newest(struct object_id *ooid, struct object_id *noid
}
static int read_ref_at_ent_oldest(struct object_id *ooid, struct object_id *noid,
const char *email, timestamp_t timestamp,
int tz, const char *message, void *cb_data)
const char *UNUSED(email),
timestamp_t timestamp, int tz,
const char *message, void *cb_data)
{
struct read_ref_at_cb *cb = cb_data;
@ -1899,7 +1904,7 @@ struct ref_store_hash_entry
char name[FLEX_ARRAY];
};
static int ref_store_hash_cmp(const void *unused_cmp_data,
static int ref_store_hash_cmp(const void *UNUSED(cmp_data),
const struct hashmap_entry *eptr,
const struct hashmap_entry *entry_or_key,
const void *keydata)

Просмотреть файл

@ -2202,8 +2202,8 @@ static int files_reflog_iterator_advance(struct ref_iterator *ref_iterator)
return ok;
}
static int files_reflog_iterator_peel(struct ref_iterator *ref_iterator,
struct object_id *peeled)
static int files_reflog_iterator_peel(struct ref_iterator *UNUSED(ref_iterator),
struct object_id *UNUSED(peeled))
{
BUG("ref_iterator_peel() called for reflog_iterator");
}
@ -2257,7 +2257,7 @@ static struct ref_iterator *reflog_iterator_begin(struct ref_store *ref_store,
static enum iterator_selection reflog_iterator_select(
struct ref_iterator *iter_worktree,
struct ref_iterator *iter_common,
void *cb_data)
void *UNUSED(cb_data))
{
if (iter_worktree) {
/*
@ -2985,7 +2985,7 @@ cleanup:
static int files_transaction_abort(struct ref_store *ref_store,
struct ref_transaction *transaction,
struct strbuf *err)
struct strbuf *UNUSED(err))
{
struct files_ref_store *refs =
files_downcast(ref_store, 0, "ref_transaction_abort");
@ -2995,7 +2995,9 @@ static int files_transaction_abort(struct ref_store *ref_store,
}
static int ref_present(const char *refname,
const struct object_id *oid, int flags, void *cb_data)
const struct object_id *UNUSED(oid),
int UNUSED(flags),
void *cb_data)
{
struct string_list *affected_refnames = cb_data;
@ -3259,7 +3261,7 @@ static int files_reflog_expire(struct ref_store *ref_store,
return -1;
}
static int files_init_db(struct ref_store *ref_store, struct strbuf *err)
static int files_init_db(struct ref_store *ref_store, struct strbuf *UNUSED(err))
{
struct files_ref_store *refs =
files_downcast(ref_store, REF_STORE_WRITE, "init_db");

Просмотреть файл

@ -51,8 +51,8 @@ static int empty_ref_iterator_advance(struct ref_iterator *ref_iterator)
return ref_iterator_abort(ref_iterator);
}
static int empty_ref_iterator_peel(struct ref_iterator *ref_iterator,
struct object_id *peeled)
static int empty_ref_iterator_peel(struct ref_iterator *UNUSED(ref_iterator),
struct object_id *UNUSED(peeled))
{
BUG("peel called for empty iterator");
}
@ -238,7 +238,7 @@ struct ref_iterator *merge_ref_iterator_begin(
*/
static enum iterator_selection overlay_iterator_select(
struct ref_iterator *front, struct ref_iterator *back,
void *cb_data)
void *UNUSED(cb_data))
{
int cmp;

Просмотреть файл

@ -726,7 +726,7 @@ static struct snapshot *get_snapshot(struct packed_ref_store *refs)
}
static int packed_read_raw_ref(struct ref_store *ref_store, const char *refname,
struct object_id *oid, struct strbuf *referent,
struct object_id *oid, struct strbuf *UNUSED(referent),
unsigned int *type, int *failure_errno)
{
struct packed_ref_store *refs =
@ -1078,7 +1078,8 @@ int packed_refs_is_locked(struct ref_store *ref_store)
static const char PACKED_REFS_HEADER[] =
"# pack-refs with: peeled fully-peeled sorted \n";
static int packed_init_db(struct ref_store *ref_store, struct strbuf *err)
static int packed_init_db(struct ref_store *UNUSED(ref_store),
struct strbuf *UNUSED(err))
{
/* Nothing to do. */
return 0;
@ -1473,7 +1474,7 @@ failure:
static int packed_transaction_abort(struct ref_store *ref_store,
struct ref_transaction *transaction,
struct strbuf *err)
struct strbuf *UNUSED(err))
{
struct packed_ref_store *refs = packed_downcast(
ref_store,
@ -1512,7 +1513,7 @@ cleanup:
return ret;
}
static int packed_initial_transaction_commit(struct ref_store *ref_store,
static int packed_initial_transaction_commit(struct ref_store *UNUSED(ref_store),
struct ref_transaction *transaction,
struct strbuf *err)
{
@ -1568,7 +1569,8 @@ static int packed_delete_refs(struct ref_store *ref_store, const char *msg,
return ret;
}
static int packed_pack_refs(struct ref_store *ref_store, unsigned int flags)
static int packed_pack_refs(struct ref_store *UNUSED(ref_store),
unsigned int UNUSED(flags))
{
/*
* Packed refs are already packed. It might be that loose refs
@ -1578,7 +1580,7 @@ static int packed_pack_refs(struct ref_store *ref_store, unsigned int flags)
return 0;
}
static struct ref_iterator *packed_reflog_iterator_begin(struct ref_store *ref_store)
static struct ref_iterator *packed_reflog_iterator_begin(struct ref_store *UNUSED(ref_store))
{
return empty_ref_iterator_begin();
}

Просмотреть файл

@ -86,7 +86,7 @@ struct remotes_hash_key {
int len;
};
static int remotes_hash_cmp(const void *unused_cmp_data,
static int remotes_hash_cmp(const void *UNUSED(cmp_data),
const struct hashmap_entry *eptr,
const struct hashmap_entry *entry_or_key,
const void *keydata)
@ -170,7 +170,7 @@ struct branches_hash_key {
int len;
};
static int branches_hash_cmp(const void *unused_cmp_data,
static int branches_hash_cmp(const void *UNUSED(cmp_data),
const struct hashmap_entry *eptr,
const struct hashmap_entry *entry_or_key,
const void *keydata)
@ -2320,7 +2320,8 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb,
}
static int one_local_ref(const char *refname, const struct object_id *oid,
int flag, void *cb_data)
int UNUSED(flag),
void *cb_data)
{
struct ref ***local_tail = cb_data;
struct ref *ref;
@ -2576,19 +2577,22 @@ struct check_and_collect_until_cb_data {
};
/* Get the timestamp of the latest entry. */
static int peek_reflog(struct object_id *o_oid, struct object_id *n_oid,
const char *ident, timestamp_t timestamp,
int tz, const char *message, void *cb_data)
static int peek_reflog(struct object_id *UNUSED(o_oid),
struct object_id *UNUSED(n_oid),
const char *UNUSED(ident),
timestamp_t timestamp, int UNUSED(tz),
const char *UNUSED(message), void *cb_data)
{
timestamp_t *ts = cb_data;
*ts = timestamp;
return 1;
}
static int check_and_collect_until(struct object_id *o_oid,
static int check_and_collect_until(struct object_id *UNUSED(o_oid),
struct object_id *n_oid,
const char *ident, timestamp_t timestamp,
int tz, const char *message, void *cb_data)
const char *UNUSED(ident),
timestamp_t timestamp, int UNUSED(tz),
const char *UNUSED(message), void *cb_data)
{
struct commit *commit;
struct check_and_collect_until_cb_data *cb = cb_data;

Просмотреть файл

@ -9,7 +9,8 @@
static int register_replace_ref(struct repository *r,
const char *refname,
const struct object_id *oid,
int flag, void *cb_data)
int UNUSED(flag),
void *UNUSED(cb_data))
{
/* Get sha1 from refname */
const char *slash = strrchr(refname, '/');

Просмотреть файл

@ -119,10 +119,10 @@ struct path_and_oids_entry {
struct oidset trees;
};
static int path_and_oids_cmp(const void *hashmap_cmp_fn_data,
static int path_and_oids_cmp(const void *UNUSED(hashmap_cmp_fn_data),
const struct hashmap_entry *eptr,
const struct hashmap_entry *entry_or_key,
const void *keydata)
const void *UNUSED(keydata))
{
const struct path_and_oids_entry *e1, *e2;
@ -1546,7 +1546,8 @@ int ref_excluded(struct string_list *ref_excludes, const char *path)
}
static int handle_one_ref(const char *path, const struct object_id *oid,
int flag, void *cb_data)
int UNUSED(flag),
void *cb_data)
{
struct all_refs_cb *cb = cb_data;
struct object *object;
@ -1621,8 +1622,11 @@ static void handle_one_reflog_commit(struct object_id *oid, void *cb_data)
}
static int handle_one_reflog_ent(struct object_id *ooid, struct object_id *noid,
const char *email, timestamp_t timestamp, int tz,
const char *message, void *cb_data)
const char *UNUSED(email),
timestamp_t UNUSED(timestamp),
int UNUSED(tz),
const char *UNUSED(message),
void *cb_data)
{
handle_one_reflog_commit(ooid, cb_data);
handle_one_reflog_commit(noid, cb_data);
@ -1630,8 +1634,8 @@ static int handle_one_reflog_ent(struct object_id *ooid, struct object_id *noid,
}
static int handle_one_reflog(const char *refname_in_wt,
const struct object_id *oid,
int flag, void *cb_data)
const struct object_id *UNUSED(oid),
int UNUSED(flag), void *cb_data)
{
struct all_refs_cb *cb = cb_data;
struct strbuf refname = STRBUF_INIT;

Просмотреть файл

@ -266,7 +266,7 @@ static int receive_status(struct packet_reader *reader, struct ref *refs)
return ret;
}
static int sideband_demux(int in, int out, void *data)
static int sideband_demux(int UNUSED(in), int out, void *data)
{
int *fd = data, ret;
if (async_with_fork())

Просмотреть файл

@ -5254,7 +5254,8 @@ struct labels_entry {
char label[FLEX_ARRAY];
};
static int labels_cmp(const void *fndata, const struct hashmap_entry *eptr,
static int labels_cmp(const void *UNUSED(fndata),
const struct hashmap_entry *eptr,
const struct hashmap_entry *entry_or_key, const void *key)
{
const struct labels_entry *a, *b;
@ -6131,7 +6132,7 @@ struct subject2item_entry {
char subject[FLEX_ARRAY];
};
static int subject2item_cmp(const void *fndata,
static int subject2item_cmp(const void *UNUSED(fndata),
const struct hashmap_entry *eptr,
const struct hashmap_entry *entry_or_key,
const void *key)

Просмотреть файл

@ -147,7 +147,8 @@ out:
}
static int add_info_ref(const char *path, const struct object_id *oid,
int flag, void *cb_data)
int UNUSED(flag),
void *cb_data)
{
struct update_info_ctx *uic = cb_data;
struct object *o = parse_object(the_repository, oid);

Просмотреть файл

@ -604,8 +604,10 @@ static void paint_down(struct paint_info *info, const struct object_id *oid,
free(tmp);
}
static int mark_uninteresting(const char *refname, const struct object_id *oid,
int flags, void *cb_data)
static int mark_uninteresting(const char *UNUSED(refname),
const struct object_id *oid,
int UNUSED(flags),
void *UNUSED(cb_data))
{
struct commit *commit = lookup_commit_reference_gently(the_repository,
oid, 1);
@ -715,8 +717,10 @@ struct commit_array {
int nr, alloc;
};
static int add_ref(const char *refname, const struct object_id *oid,
int flags, void *cb_data)
static int add_ref(const char *UNUSED(refname),
const struct object_id *oid,
int UNUSED(flags),
void *cb_data)
{
struct commit_array *ca = cb_data;
ALLOC_GROW(ca->commits, ca->nr + 1, ca->alloc);

Просмотреть файл

@ -328,9 +328,9 @@ static int close_istream_pack_non_delta(struct git_istream *st)
}
static int open_istream_pack_non_delta(struct git_istream *st,
struct repository *r,
const struct object_id *oid,
enum object_type *type)
struct repository *UNUSED(r),
const struct object_id *UNUSED(oid),
enum object_type *UNUSED(type))
{
struct pack_window *window;
enum object_type in_pack_type;

Просмотреть файл

@ -2,10 +2,10 @@
#include "strmap.h"
#include "mem-pool.h"
int cmp_strmap_entry(const void *hashmap_cmp_fn_data,
int cmp_strmap_entry(const void *UNUSED(hashmap_cmp_fn_data),
const struct hashmap_entry *entry1,
const struct hashmap_entry *entry2,
const void *keydata)
const void *UNUSED(keydata))
{
const struct strmap_entry *e1, *e2;

Просмотреть файл

@ -5,10 +5,10 @@
#include "sigchain.h"
#include "pkt-line.h"
int cmd2process_cmp(const void *unused_cmp_data,
int cmd2process_cmp(const void *UNUSED(cmp_data),
const struct hashmap_entry *eptr,
const struct hashmap_entry *entry_or_key,
const void *unused_keydata)
const void *UNUSED(keydata))
{
const struct subprocess_entry *e1, *e2;

Просмотреть файл

@ -38,10 +38,10 @@ enum lookup_type {
lookup_path
};
static int config_path_cmp(const void *unused_cmp_data,
static int config_path_cmp(const void *UNUSED(cmp_data),
const struct hashmap_entry *eptr,
const struct hashmap_entry *entry_or_key,
const void *unused_keydata)
const void *UNUSED(keydata))
{
const struct submodule_entry *a, *b;
@ -52,10 +52,10 @@ static int config_path_cmp(const void *unused_cmp_data,
!oideq(&a->config->gitmodules_oid, &b->config->gitmodules_oid);
}
static int config_name_cmp(const void *unused_cmp_data,
static int config_name_cmp(const void *UNUSED(cmp_data),
const struct hashmap_entry *eptr,
const struct hashmap_entry *entry_or_key,
const void *unused_keydata)
const void *UNUSED(keydata))
{
const struct submodule_entry *a, *b;

Просмотреть файл

@ -213,7 +213,8 @@ void set_diffopt_flags_from_submodule_config(struct diff_options *diffopt,
}
/* Cheap function that only determines if we're interested in submodules at all */
int git_default_submodule_config(const char *var, const char *value, void *cb)
int git_default_submodule_config(const char *var, const char *value,
void *UNUSED(cb))
{
if (!strcmp(var, "submodule.recurse")) {
int v = git_config_bool(var, value) ?
@ -938,8 +939,9 @@ static void free_submodules_data(struct string_list *submodules)
string_list_clear(submodules, 1);
}
static int has_remote(const char *refname, const struct object_id *oid,
int flags, void *cb_data)
static int has_remote(const char *UNUSED(refname),
const struct object_id *UNUSED(oid),
int UNUSED(flags), void *UNUSED(cb_data))
{
return 1;
}
@ -1241,8 +1243,9 @@ int push_unpushed_submodules(struct repository *r,
return ret;
}
static int append_oid_to_array(const char *ref, const struct object_id *oid,
int flags, void *data)
static int append_oid_to_array(const char *UNUSED(ref),
const struct object_id *oid,
int UNUSED(flags), void *data)
{
struct oid_array *array = data;
oid_array_append(array, oid);

Просмотреть файл

@ -37,7 +37,7 @@
*
*/
static int iterate_cb(const char *var, const char *value, void *data)
static int iterate_cb(const char *var, const char *value, void *UNUSED(data))
{
static int nr;

Просмотреть файл

@ -161,7 +161,7 @@ static int cmd_rename_ref(struct ref_store *refs, const char **argv)
}
static int each_ref(const char *refname, const struct object_id *oid,
int flags, void *cb_data)
int flags, void *UNUSED(cb_data))
{
printf("%s %s 0x%x\n", oid_to_hex(oid), refname, flags);
return 0;
@ -207,7 +207,7 @@ static int cmd_for_each_reflog(struct ref_store *refs, const char **argv)
static int each_reflog(struct object_id *old_oid, struct object_id *new_oid,
const char *committer, timestamp_t timestamp,
int tz, const char *msg, void *cb_data)
int tz, const char *msg, void *UNUSED(cb_data))
{
printf("%s %s %s %" PRItime " %+05d%s%s", oid_to_hex(old_oid),
oid_to_hex(new_oid), committer, timestamp, tz,

Просмотреть файл

@ -12,7 +12,7 @@ static int driver_cb(struct userdiff_driver *driver,
return 0;
}
static int cmd__userdiff_config(const char *var, const char *value, void *cb)
static int cmd__userdiff_config(const char *var, const char *value, void *UNUSED(cb))
{
if (userdiff_config(var, value) < 0)
return -1;

Просмотреть файл

@ -478,7 +478,8 @@ static struct {
{ "ifmissing", TRAILER_IF_MISSING }
};
static int git_trailer_default_config(const char *conf_key, const char *value, void *cb)
static int git_trailer_default_config(const char *conf_key, const char *value,
void *UNUSED(cb))
{
const char *trailer_item, *variable_name;
@ -509,7 +510,8 @@ static int git_trailer_default_config(const char *conf_key, const char *value, v
return 0;
}
static int git_trailer_config(const char *conf_key, const char *value, void *cb)
static int git_trailer_config(const char *conf_key, const char *value,
void *UNUSED(cb))
{
const char *trailer_item, *variable_name;
struct arg_item *item;

Просмотреть файл

@ -142,7 +142,7 @@ static void get_refs_from_bundle_inner(struct transport *transport)
static struct ref *get_refs_from_bundle(struct transport *transport,
int for_push,
struct transport_ls_refs_options *transport_options)
struct transport_ls_refs_options *UNUSED(transport_options))
{
struct bundle_transport_data *data = transport->data;
struct ref *result = NULL;

Просмотреть файл

@ -1170,7 +1170,7 @@ static int mark_our_ref(const char *refname, const char *refname_full,
}
static int check_ref(const char *refname_full, const struct object_id *oid,
int flag, void *cb_data)
int UNUSED(flag), void *UNUSED(cb_data))
{
const char *refname = strip_namespace(refname_full);
@ -1194,7 +1194,7 @@ static void format_session_id(struct strbuf *buf, struct upload_pack_data *d) {
}
static int send_ref(const char *refname, const struct object_id *oid,
int flag, void *cb_data)
int UNUSED(flag), void *cb_data)
{
static const char *capabilities = "multi_ack thin-pack side-band"
" side-band-64k ofs-delta shallow deepen-since deepen-not"
@ -1236,7 +1236,8 @@ static int send_ref(const char *refname, const struct object_id *oid,
return 0;
}
static int find_symref(const char *refname, const struct object_id *oid,
static int find_symref(const char *refname,
const struct object_id *UNUSED(oid),
int flag, void *cb_data)
{
const char *symref_target;

Просмотреть файл

@ -215,8 +215,10 @@ static int interpret_target(struct walker *walker, char *target, struct object_i
return -1;
}
static int mark_complete(const char *path, const struct object_id *oid,
int flag, void *cb_data)
static int mark_complete(const char *UNUSED(path),
const struct object_id *oid,
int UNUSED(flag),
void *UNUSED(cb_data))
{
struct commit *commit = lookup_commit_reference_gently(the_repository,
oid, 1);

Просмотреть файл

@ -947,9 +947,11 @@ static void wt_longstatus_print_changed(struct wt_status *s)
wt_longstatus_print_trailer(s);
}
static int stash_count_refs(struct object_id *ooid, struct object_id *noid,
const char *email, timestamp_t timestamp, int tz,
const char *message, void *cb_data)
static int stash_count_refs(struct object_id *UNUSED(ooid),
struct object_id *UNUSED(noid),
const char *UNUSED(email),
timestamp_t UNUSED(timestamp), int UNUSED(tz),
const char *UNUSED(message), void *cb_data)
{
int *c = cb_data;
(*c)++;
@ -1612,8 +1614,10 @@ struct grab_1st_switch_cbdata {
struct object_id noid;
};
static int grab_1st_switch(struct object_id *ooid, struct object_id *noid,
const char *email, timestamp_t timestamp, int tz,
static int grab_1st_switch(struct object_id *UNUSED(ooid),
struct object_id *noid,
const char *UNUSED(email),
timestamp_t UNUSED(timestamp), int UNUSED(tz),
const char *message, void *cb_data)
{
struct grab_1st_switch_cbdata *cb = cb_data;