Merge branch 'jk/unused-post-2.39-part2'

More work towards -Wunused.

* jk/unused-post-2.39-part2: (21 commits)
  help: mark unused parameter in git_unknown_cmd_config()
  run_processes_parallel: mark unused callback parameters
  userformat_want_item(): mark unused parameter
  for_each_commit_graft(): mark unused callback parameter
  rewrite_parents(): mark unused callback parameter
  fetch-pack: mark unused parameter in callback function
  notes: mark unused callback parameters
  prio-queue: mark unused parameters in comparison functions
  for_each_object: mark unused callback parameters
  list-objects: mark unused callback parameters
  mark unused parameters in signal handlers
  run-command: mark error routine parameters as unused
  mark "pointless" data pointers in callbacks
  ref-filter: mark unused callback parameters
  http-backend: mark unused parameters in virtual functions
  http-backend: mark argc/argv unused
  object-name: mark unused parameters in disambiguate callbacks
  serve: mark unused parameters in virtual functions
  serve: use repository pointer to get config
  ls-refs: drop config caching
  ...
This commit is contained in:
Junio C Hamano 2023-03-17 14:03:09 -07:00
commit d0732a8120
43 changed files with 211 additions and 176 deletions

View File

@ -563,7 +563,7 @@ static int batch_object_cb(const struct object_id *oid, void *vdata)
}
static int collect_loose_object(const struct object_id *oid,
const char *path,
const char *path UNUSED,
void *data)
{
oid_array_append(data, oid);
@ -571,8 +571,8 @@ static int collect_loose_object(const struct object_id *oid,
}
static int collect_packed_object(const struct object_id *oid,
struct packed_git *pack,
uint32_t pos,
struct packed_git *pack UNUSED,
uint32_t pos UNUSED,
void *data)
{
oid_array_append(data, oid);
@ -595,7 +595,7 @@ static int batch_unordered_object(const struct object_id *oid,
}
static int batch_unordered_loose(const struct object_id *oid,
const char *path,
const char *path UNUSED,
void *data)
{
return batch_unordered_object(oid, NULL, 0, data);

View File

@ -57,7 +57,8 @@ static void loose_garbage(const char *path)
report_garbage(PACKDIR_FILE_GARBAGE, path);
}
static int count_loose(const struct object_id *oid, const char *path, void *data)
static int count_loose(const struct object_id *oid, const char *path,
void *data UNUSED)
{
struct stat st;
@ -72,7 +73,8 @@ static int count_loose(const struct object_id *oid, const char *path, void *data
return 0;
}
static int count_cruft(const char *basename, const char *path, void *data)
static int count_cruft(const char *basename UNUSED, const char *path,
void *data UNUSED)
{
loose_garbage(path);
return 0;

View File

@ -437,7 +437,7 @@ static void set_checkpoint_signal(void)
#else
static void checkpoint_signal(int signo)
static void checkpoint_signal(int signo UNUSED)
{
checkpoint_requested = 1;
}

View File

@ -1891,7 +1891,8 @@ struct parallel_fetch_state {
int next, result;
};
static int fetch_next_remote(struct child_process *cp, struct strbuf *out,
static int fetch_next_remote(struct child_process *cp,
struct strbuf *out UNUSED,
void *cb, void **task_cb)
{
struct parallel_fetch_state *state = cb;
@ -1913,7 +1914,8 @@ static int fetch_next_remote(struct child_process *cp, struct strbuf *out,
return 1;
}
static int fetch_failed_to_start(struct strbuf *out, void *cb, void *task_cb)
static int fetch_failed_to_start(struct strbuf *out UNUSED,
void *cb, void *task_cb)
{
struct parallel_fetch_state *state = cb;
const char *remote = task_cb;

View File

@ -234,17 +234,17 @@ static void mark_unreachable_referents(const struct object_id *oid)
}
static int mark_loose_unreachable_referents(const struct object_id *oid,
const char *path,
void *data)
const char *path UNUSED,
void *data UNUSED)
{
mark_unreachable_referents(oid);
return 0;
}
static int mark_packed_unreachable_referents(const struct object_id *oid,
struct packed_git *pack,
uint32_t pos,
void *data)
struct packed_git *pack UNUSED,
uint32_t pos UNUSED,
void *data UNUSED)
{
mark_unreachable_referents(oid);
return 0;
@ -662,14 +662,15 @@ static int fsck_loose(const struct object_id *oid, const char *path, void *data)
return 0; /* keep checking other objects, even if we saw an error */
}
static int fsck_cruft(const char *basename, const char *path, void *data)
static int fsck_cruft(const char *basename, const char *path,
void *data UNUSED)
{
if (!starts_with(basename, "tmp_obj_"))
fprintf_ln(stderr, _("bad sha1 file: %s"), path);
return 0;
}
static int fsck_subdir(unsigned int nr, const char *path, void *data)
static int fsck_subdir(unsigned int nr, const char *path UNUSED, void *data)
{
struct for_each_loose_cb *cb_data = data;
struct progress *progress = cb_data->progress;
@ -838,17 +839,17 @@ static void mark_object_for_connectivity(const struct object_id *oid)
}
static int mark_loose_for_connectivity(const struct object_id *oid,
const char *path,
void *data)
const char *path UNUSED,
void *data UNUSED)
{
mark_object_for_connectivity(oid);
return 0;
}
static int mark_packed_for_connectivity(const struct object_id *oid,
struct packed_git *pack,
uint32_t pos,
void *data)
struct packed_git *pack UNUSED,
uint32_t pos UNUSED,
void *data UNUSED)
{
mark_object_for_connectivity(oid);
return 0;

View File

@ -977,8 +977,8 @@ struct write_loose_object_data {
static int loose_object_auto_limit = 100;
static int loose_object_count(const struct object_id *oid,
const char *path,
static int loose_object_count(const struct object_id *oid UNUSED,
const char *path UNUSED,
void *data)
{
int *count = (int*)data;
@ -1004,15 +1004,15 @@ static int loose_object_auto_condition(void)
NULL, NULL, &count);
}
static int bail_on_loose(const struct object_id *oid,
const char *path,
void *data)
static int bail_on_loose(const struct object_id *oid UNUSED,
const char *path UNUSED,
void *data UNUSED)
{
return 1;
}
static int write_loose_object_to_stdin(const struct object_id *oid,
const char *path,
const char *path UNUSED,
void *data)
{
struct write_loose_object_data *d = (struct write_loose_object_data *)data;

View File

@ -438,7 +438,7 @@ static void log_show_early(struct rev_info *revs, struct commit_list *list)
setitimer(ITIMER_REAL, &early_output_timer, NULL);
}
static void early_output(int signal)
static void early_output(int signal UNUSED)
{
show_early_output = log_show_early;
}

View File

@ -114,8 +114,9 @@ static void free_note_data(struct note_data *d)
}
static int list_each_note(const struct object_id *object_oid,
const struct object_id *note_oid, char *note_path,
void *cb_data)
const struct object_id *note_oid,
char *note_path UNUSED,
void *cb_data UNUSED)
{
printf("%s %s\n", oid_to_hex(note_oid), oid_to_hex(object_oid));
return 0;

View File

@ -1592,7 +1592,7 @@ static int add_object_entry(const struct object_id *oid, enum object_type type,
static int add_object_entry_from_bitmap(const struct object_id *oid,
enum object_type type,
int flags, uint32_t name_hash,
int flags UNUSED, uint32_t name_hash,
struct packed_git *pack, off_t offset)
{
display_progress(progress_state, ++nr_seen);
@ -3262,13 +3262,14 @@ static int add_object_entry_from_pack(const struct object_id *oid,
return 0;
}
static void show_commit_pack_hint(struct commit *commit, void *_data)
static void show_commit_pack_hint(struct commit *commit UNUSED,
void *data UNUSED)
{
/* nothing to do; commits don't have a namehash */
}
static void show_object_pack_hint(struct object *object, const char *name,
void *_data)
void *data UNUSED)
{
struct object_entry *oe = packlist_find(&to_pack, &object->oid);
if (!oe)
@ -3466,7 +3467,7 @@ static void add_cruft_object_entry(const struct object_id *oid, enum object_type
return;
}
static void show_cruft_object(struct object *obj, const char *name, void *data)
static void show_cruft_object(struct object *obj, const char *name, void *data UNUSED)
{
/*
* if we did not record it earlier, it's at least as old as our
@ -3486,7 +3487,7 @@ static void show_cruft_commit(struct commit *commit, void *data)
show_cruft_object((struct object*)commit, NULL, data);
}
static int cruft_include_check_obj(struct object *obj, void *data)
static int cruft_include_check_obj(struct object *obj, void *data UNUSED)
{
return !has_object_kept_pack(&obj->oid, IN_CORE_KEEP_PACKS);
}
@ -3665,7 +3666,7 @@ static void read_object_list_from_stdin(void)
}
}
static void show_commit(struct commit *commit, void *data)
static void show_commit(struct commit *commit, void *data UNUSED)
{
add_object_entry(&commit->object.oid, OBJ_COMMIT, NULL, 0);
@ -3676,7 +3677,8 @@ static void show_commit(struct commit *commit, void *data)
propagate_island_marks(commit);
}
static void show_object(struct object *obj, const char *name, void *data)
static void show_object(struct object *obj, const char *name,
void *data UNUSED)
{
add_preferred_base_object(name);
add_object_entry(&obj->oid, obj->type, name, 0);
@ -3763,7 +3765,7 @@ static void show_edge(struct commit *commit)
static int add_object_in_unpacked_pack(const struct object_id *oid,
struct packed_git *pack,
uint32_t pos,
void *_data)
void *data UNUSED)
{
if (cruft) {
off_t offset;
@ -3797,7 +3799,7 @@ static void add_objects_in_unpacked_packs(void)
}
static int add_loose_object(const struct object_id *oid, const char *path,
void *data)
void *data UNUSED)
{
enum object_type type = oid_object_info(the_repository, oid, NULL);
@ -3948,13 +3950,13 @@ static int get_object_list_from_bitmap(struct rev_info *revs)
}
static void record_recent_object(struct object *obj,
const char *name,
void *data)
const char *name UNUSED,
void *data UNUSED)
{
oid_array_append(&recent_objects, &obj->oid);
}
static void record_recent_commit(struct commit *commit, void *data)
static void record_recent_commit(struct commit *commit, void *data UNUSED)
{
oid_array_append(&recent_objects, &commit->object.oid);
}

View File

@ -100,7 +100,8 @@ static int prune_object(const struct object_id *oid, const char *fullpath,
return 0;
}
static int prune_cruft(const char *basename, const char *path, void *data)
static int prune_cruft(const char *basename, const char *path,
void *data UNUSED)
{
if (starts_with(basename, "tmp_obj_"))
prune_tmp_file(path);
@ -109,7 +110,8 @@ static int prune_cruft(const char *basename, const char *path, void *data)
return 0;
}
static int prune_subdir(unsigned int nr, const char *path, void *data)
static int prune_subdir(unsigned int nr UNUSED, const char *path,
void *data UNUSED)
{
if (!show_only)
rmdir(path);

View File

@ -183,8 +183,9 @@ static void prepare_pack_objects(struct child_process *cmd,
* Write oid to the given struct child_process's stdin, starting it first if
* necessary.
*/
static int write_oid(const struct object_id *oid, struct packed_git *pack,
uint32_t pos, void *data)
static int write_oid(const struct object_id *oid,
struct packed_git *pack UNUSED,
uint32_t pos UNUSED, void *data)
{
struct child_process *cmd = data;

View File

@ -258,7 +258,8 @@ static inline void finish_object__ma(struct object *obj)
}
}
static int finish_object(struct object *obj, const char *name, void *cb_data)
static int finish_object(struct object *obj, const char *name UNUSED,
void *cb_data)
{
struct rev_list_info *info = cb_data;
if (oid_object_info_extended(the_repository, &obj->oid, NULL, 0) < 0) {
@ -363,11 +364,11 @@ static int show_bisect_vars(struct rev_list_info *info, int reaches, int all)
static int show_object_fast(
const struct object_id *oid,
enum object_type type,
int exclude,
uint32_t name_hash,
struct packed_git *found_pack,
off_t found_offset)
enum object_type type UNUSED,
int exclude UNUSED,
uint32_t name_hash UNUSED,
struct packed_git *found_pack UNUSED,
off_t found_offset UNUSED)
{
fprintf(stdout, "%s\n", oid_to_hex(oid));
return 1;

View File

@ -2134,9 +2134,9 @@ static int update_clone_get_next_task(struct child_process *child,
return 0;
}
static int update_clone_start_failure(struct strbuf *err,
static int update_clone_start_failure(struct strbuf *err UNUSED,
void *suc_cb,
void *idx_task_cb)
void *idx_task_cb UNUSED)
{
struct submodule_update_clone *suc = suc_cb;

View File

@ -884,7 +884,7 @@ int bundle_uri_command(struct repository *r,
* Read all "bundle.*" config lines to the client as key=value
* packet lines.
*/
git_config(config_to_packet_line, &writer);
repo_config(r, config_to_packet_line, &writer);
packet_writer_flush(&writer);

View File

@ -802,7 +802,8 @@ int compare_commits_by_author_date(const void *a_, const void *b_,
return 0;
}
int compare_commits_by_gen_then_commit_date(const void *a_, const void *b_, void *unused)
int compare_commits_by_gen_then_commit_date(const void *a_, const void *b_,
void *unused UNUSED)
{
const struct commit *a = a_, *b = b_;
const timestamp_t generation_a = commit_graph_generation(a),
@ -822,7 +823,8 @@ int compare_commits_by_gen_then_commit_date(const void *a_, const void *b_, void
return 0;
}
int compare_commits_by_commit_date(const void *a_, const void *b_, void *unused)
int compare_commits_by_commit_date(const void *a_, const void *b_,
void *unused UNUSED)
{
const struct commit *a = a_, *b = b_;
/* newer commits with larger date first */

View File

@ -929,7 +929,7 @@ static void handle(int incoming, struct sockaddr *addr, socklen_t addrlen)
add_child(&cld, addr, addrlen);
}
static void child_handler(int signo)
static void child_handler(int signo UNUSED)
{
/*
* Otherwise empty handler because systemcalls will get interrupted

View File

@ -44,7 +44,8 @@ int option_parse_diagnose(const struct option *opt, const char *arg, int unset)
return error(_("invalid --%s value '%s'"), opt->long_name, arg);
}
static void dir_file_stats_objects(const char *full_path, size_t full_path_len,
static void dir_file_stats_objects(const char *full_path,
size_t full_path_len UNUSED,
const char *file_name, void *data)
{
struct strbuf *buf = data;

View File

@ -724,7 +724,7 @@ static void filter_refs(struct fetch_pack_args *args,
*refs = newlist;
}
static void mark_alternate_complete(struct fetch_negotiator *unused,
static void mark_alternate_complete(struct fetch_negotiator *negotiator UNUSED,
struct object *obj)
{
mark_complete(&obj->oid);

3
help.c
View File

@ -542,7 +542,8 @@ static struct cmdnames aliases;
#define AUTOCORRECT_NEVER (-2)
#define AUTOCORRECT_IMMEDIATELY (-1)
static int git_unknown_cmd_config(const char *var, const char *value, void *cb)
static int git_unknown_cmd_config(const char *var, const char *value,
void *cb UNUSED)
{
const char *p;

12
hook.c
View File

@ -46,9 +46,9 @@ int hook_exists(const char *name)
}
static int pick_next_hook(struct child_process *cp,
struct strbuf *out,
struct strbuf *out UNUSED,
void *pp_cb,
void **pp_task_cb)
void **pp_task_cb UNUSED)
{
struct hook_cb_data *hook_cb = pp_cb;
const char *hook_path = hook_cb->hook_path;
@ -80,9 +80,9 @@ static int pick_next_hook(struct child_process *cp,
return 1;
}
static int notify_start_failure(struct strbuf *out,
static int notify_start_failure(struct strbuf *out UNUSED,
void *pp_cb,
void *pp_task_cp)
void *pp_task_cp UNUSED)
{
struct hook_cb_data *hook_cb = pp_cb;
@ -92,9 +92,9 @@ static int notify_start_failure(struct strbuf *out,
}
static int notify_hook_finished(int result,
struct strbuf *out,
struct strbuf *out UNUSED,
void *pp_cb,
void *pp_task_cb)
void *pp_task_cb UNUSED)
{
struct hook_cb_data *hook_cb = pp_cb;
struct run_hooks_opt *opt = hook_cb->options;

View File

@ -526,7 +526,7 @@ static int show_text_ref(const char *name, const struct object_id *oid,
return 0;
}
static void get_info_refs(struct strbuf *hdr, char *arg)
static void get_info_refs(struct strbuf *hdr, char *arg UNUSED)
{
const char *service_name = get_parameter("service");
struct strbuf buf = STRBUF_INIT;
@ -580,7 +580,7 @@ static int show_head_ref(const char *refname, const struct object_id *oid,
return 0;
}
static void get_head(struct strbuf *hdr, char *arg)
static void get_head(struct strbuf *hdr, char *arg UNUSED)
{
struct strbuf buf = STRBUF_INIT;
@ -590,7 +590,7 @@ static void get_head(struct strbuf *hdr, char *arg)
strbuf_release(&buf);
}
static void get_info_packs(struct strbuf *hdr, char *arg)
static void get_info_packs(struct strbuf *hdr, char *arg UNUSED)
{
size_t objdirlen = strlen(get_object_directory());
struct strbuf buf = STRBUF_INIT;
@ -738,7 +738,7 @@ static int bad_request(struct strbuf *hdr, const struct service_cmd *c)
return 0;
}
int cmd_main(int argc, const char **argv)
int cmd_main(int argc UNUSED, const char **argv UNUSED)
{
char *method = getenv("REQUEST_METHOD");
const char *proto_header;

View File

@ -1283,7 +1283,8 @@ int line_log_process_ranges_arbitrary_commit(struct rev_info *rev, struct commit
return changed;
}
static enum rewrite_result line_log_rewrite_one(struct rev_info *rev, struct commit **pp)
static enum rewrite_result line_log_rewrite_one(struct rev_info *rev UNUSED,
struct commit **pp)
{
for (;;) {
struct commit *p = *pp;

View File

@ -198,7 +198,8 @@ static int add_ref_decoration(const char *refname, const struct object_id *oid,
return 0;
}
static int add_graft_decoration(const struct commit_graft *graft, void *cb_data)
static int add_graft_decoration(const struct commit_graft *graft,
void *cb_data UNUSED)
{
struct commit *commit = lookup_commit(the_repository, &graft->oid);
if (!commit)

View File

@ -9,38 +9,32 @@
#include "config.h"
#include "string-list.h"
static int config_read;
static int advertise_unborn;
static int allow_unborn;
static void ensure_config_read(void)
static enum {
UNBORN_IGNORE = 0,
UNBORN_ALLOW,
UNBORN_ADVERTISE /* implies ALLOW */
} unborn_config(struct repository *r)
{
const char *str = NULL;
if (config_read)
return;
if (repo_config_get_string_tmp(the_repository, "lsrefs.unborn", &str)) {
if (repo_config_get_string_tmp(r, "lsrefs.unborn", &str)) {
/*
* If there is no such config, advertise and allow it by
* default.
*/
advertise_unborn = 1;
allow_unborn = 1;
return UNBORN_ADVERTISE;
} else {
if (!strcmp(str, "advertise")) {
advertise_unborn = 1;
allow_unborn = 1;
return UNBORN_ADVERTISE;
} else if (!strcmp(str, "allow")) {
allow_unborn = 1;
return UNBORN_ALLOW;
} else if (!strcmp(str, "ignore")) {
/* do nothing */
return UNBORN_IGNORE;
} else {
die(_("invalid value for '%s': '%s'"),
"lsrefs.unborn", str);
}
}
config_read = 1;
}
/*
@ -160,7 +154,6 @@ int ls_refs(struct repository *r, struct packet_reader *request)
strbuf_init(&data.buf, 0);
string_list_init_dup(&data.hidden_refs);
ensure_config_read();
git_config(ls_refs_config, &data);
while (packet_reader_read(request) == PACKET_READ_NORMAL) {
@ -176,7 +169,7 @@ int ls_refs(struct repository *r, struct packet_reader *request)
strvec_push(&data.prefixes, out);
}
else if (!strcmp("unborn", arg))
data.unborn = allow_unborn;
data.unborn = !!unborn_config(r);
else
die(_("unexpected line: '%s'"), arg);
}
@ -207,11 +200,8 @@ int ls_refs(struct repository *r, struct packet_reader *request)
int ls_refs_advertise(struct repository *r, struct strbuf *value)
{
if (value) {
ensure_config_read();
if (advertise_unborn)
if (value && unborn_config(r) == UNBORN_ADVERTISE)
strbuf_addstr(value, "unborn");
}
return 1;
}

2
midx.c
View File

@ -1609,7 +1609,7 @@ struct clear_midx_data {
const char *ext;
};
static void clear_midx_file_ext(const char *full_path, size_t full_path_len,
static void clear_midx_file_ext(const char *full_path, size_t full_path_len UNUSED,
const char *file_name, void *_data)
{
struct clear_midx_data *data = _data;

View File

@ -51,7 +51,7 @@ struct data {
int non_common_revs;
};
static int compare(const void *a_, const void *b_, void *unused)
static int compare(const void *a_, const void *b_, void *data UNUSED)
{
const struct entry *a = a_;
const struct entry *b = b_;

View File

@ -753,7 +753,7 @@ static int write_each_non_note_until(const char *note_path,
return 0;
}
static int write_each_note(const struct object_id *object_oid,
static int write_each_note(const struct object_id *object_oid UNUSED,
const struct object_id *note_oid, char *note_path,
void *cb_data)
{
@ -781,7 +781,8 @@ struct note_delete_list {
};
static int prune_notes_helper(const struct object_id *object_oid,
const struct object_id *note_oid, char *note_path,
const struct object_id *note_oid UNUSED,
char *note_path UNUSED,
void *cb_data)
{
struct note_delete_list **l = (struct note_delete_list **) cb_data;
@ -849,8 +850,8 @@ int combine_notes_overwrite(struct object_id *cur_oid,
return 0;
}
int combine_notes_ignore(struct object_id *cur_oid,
const struct object_id *new_oid)
int combine_notes_ignore(struct object_id *cur_oid UNUSED,
const struct object_id *new_oid UNUSED)
{
return 0;
}

View File

@ -2646,7 +2646,8 @@ int for_each_loose_object(each_loose_object_fn cb, void *data,
return 0;
}
static int append_loose_object(const struct object_id *oid, const char *path,
static int append_loose_object(const struct object_id *oid,
const char *path UNUSED,
void *data)
{
oidtree_insert(data, oid);

View File

@ -224,7 +224,7 @@ static int finish_object_disambiguation(struct disambiguate_state *ds,
static int disambiguate_commit_only(struct repository *r,
const struct object_id *oid,
void *cb_data_unused)
void *cb_data UNUSED)
{
int kind = oid_object_info(r, oid, NULL);
return kind == OBJ_COMMIT;
@ -232,7 +232,7 @@ static int disambiguate_commit_only(struct repository *r,
static int disambiguate_committish_only(struct repository *r,
const struct object_id *oid,
void *cb_data_unused)
void *cb_data UNUSED)
{
struct object *obj;
int kind;
@ -252,7 +252,7 @@ static int disambiguate_committish_only(struct repository *r,
static int disambiguate_tree_only(struct repository *r,
const struct object_id *oid,
void *cb_data_unused)
void *cb_data UNUSED)
{
int kind = oid_object_info(r, oid, NULL);
return kind == OBJ_TREE;
@ -260,7 +260,7 @@ static int disambiguate_tree_only(struct repository *r,
static int disambiguate_treeish_only(struct repository *r,
const struct object_id *oid,
void *cb_data_unused)
void *cb_data UNUSED)
{
struct object *obj;
int kind;
@ -280,7 +280,7 @@ static int disambiguate_treeish_only(struct repository *r,
static int disambiguate_blob_only(struct repository *r,
const struct object_id *oid,
void *cb_data_unused)
void *cb_data UNUSED)
{
int kind = oid_object_info(r, oid, NULL);
return kind == OBJ_BLOB;
@ -474,7 +474,7 @@ static int collect_ambiguous(const struct object_id *oid, void *data)
return 0;
}
static int repo_collect_ambiguous(struct repository *r,
static int repo_collect_ambiguous(struct repository *r UNUSED,
const struct object_id *oid,
void *data)
{
@ -666,7 +666,7 @@ static int extend_abbrev_len(const struct object_id *oid, void *cb_data)
return 0;
}
static int repo_extend_abbrev_len(struct repository *r,
static int repo_extend_abbrev_len(struct repository *r UNUSED,
const struct object_id *oid,
void *cb_data)
{

View File

@ -953,7 +953,8 @@ static void show_object(struct object *object, const char *name, void *data_)
bitmap_set(data->base, bitmap_pos);
}
static void show_commit(struct commit *commit, void *data)
static void show_commit(struct commit *commit UNUSED,
void *data UNUSED)
{
}
@ -1942,7 +1943,8 @@ static void test_bitmap_type(struct bitmap_test_data *tdata,
type_name(bitmap_type));
}
static void test_show_object(struct object *object, const char *name,
static void test_show_object(struct object *object,
const char *name UNUSED,
void *data)
{
struct bitmap_test_data *tdata = data;

View File

@ -2206,8 +2206,8 @@ int for_each_packed_object(each_packed_object_fn cb, void *data,
}
static int add_promisor_object(const struct object_id *oid,
struct packed_git *pack,
uint32_t pos,
struct packed_git *pack UNUSED,
uint32_t pos UNUSED,
void *set_)
{
struct oidset *set = set_;

3
path.c
View File

@ -348,7 +348,8 @@ static void init_common_trie(void)
* Helper function for update_common_dir: returns 1 if the dir
* prefix is common.
*/
static int check_common(const char *unmatched, void *value, void *baton)
static int check_common(const char *unmatched, void *value,
void *baton UNUSED)
{
struct common_dir *dir = value;

View File

@ -1859,7 +1859,8 @@ static size_t format_commit_item(struct strbuf *sb, /* in UTF-8 */
return consumed + 1;
}
static size_t userformat_want_item(struct strbuf *sb, const char *placeholder,
static size_t userformat_want_item(struct strbuf *sb UNUSED,
const char *placeholder,
void *context)
{
struct userformat_want *w = context;

View File

@ -59,7 +59,7 @@ void progress_test_force_update(void)
}
static void progress_interval(int signum)
static void progress_interval(int signum UNUSED)
{
progress_update = 1;
}

View File

@ -49,7 +49,9 @@ static int add_one_ref(const char *path, const struct object_id *oid,
* The traversal will have already marked us as SEEN, so we
* only need to handle any progress reporting here.
*/
static void mark_object(struct object *obj, const char *name, void *data)
static void mark_object(struct object *obj UNUSED,
const char *name UNUSED,
void *data)
{
update_progress(data);
}
@ -153,7 +155,8 @@ static int add_recent_loose(const struct object_id *oid,
}
static int add_recent_packed(const struct object_id *oid,
struct packed_git *p, uint32_t pos,
struct packed_git *p,
uint32_t pos,
void *data)
{
struct object *obj;
@ -203,10 +206,10 @@ int add_unseen_recent_objects_to_traversal(struct rev_info *revs,
static int mark_object_seen(const struct object_id *oid,
enum object_type type,
int exclude,
uint32_t name_hash,
struct packed_git *found_pack,
off_t found_offset)
int exclude UNUSED,
uint32_t name_hash UNUSED,
struct packed_git *found_pack UNUSED,
off_t found_offset UNUSED)
{
struct object *obj = lookup_object_by_type(the_repository, oid, type);
if (!obj)

View File

@ -282,7 +282,8 @@ static int refname_atom_parser_internal(struct refname_atom *atom, const char *a
return 0;
}
static int remote_ref_atom_parser(struct ref_format *format, struct used_atom *atom,
static int remote_ref_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{
struct string_list params = STRING_LIST_INIT_DUP;
@ -329,7 +330,8 @@ static int remote_ref_atom_parser(struct ref_format *format, struct used_atom *a
return 0;
}
static int objecttype_atom_parser(struct ref_format *format, struct used_atom *atom,
static int objecttype_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{
if (arg)
@ -341,7 +343,8 @@ static int objecttype_atom_parser(struct ref_format *format, struct used_atom *a
return 0;
}
static int objectsize_atom_parser(struct ref_format *format, struct used_atom *atom,
static int objectsize_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{
if (!arg) {
@ -361,7 +364,8 @@ static int objectsize_atom_parser(struct ref_format *format, struct used_atom *a
return 0;
}
static int deltabase_atom_parser(struct ref_format *format, struct used_atom *atom,
static int deltabase_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{
if (arg)
@ -373,7 +377,8 @@ static int deltabase_atom_parser(struct ref_format *format, struct used_atom *at
return 0;
}
static int body_atom_parser(struct ref_format *format, struct used_atom *atom,
static int body_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{
if (arg)
@ -382,7 +387,8 @@ static int body_atom_parser(struct ref_format *format, struct used_atom *atom,
return 0;
}
static int subject_atom_parser(struct ref_format *format, struct used_atom *atom,
static int subject_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{
if (!arg)
@ -394,7 +400,8 @@ static int subject_atom_parser(struct ref_format *format, struct used_atom *atom
return 0;
}
static int trailers_atom_parser(struct ref_format *format, struct used_atom *atom,
static int trailers_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{
atom->u.contents.trailer_opts.no_divider = 1;
@ -448,7 +455,8 @@ static int contents_atom_parser(struct ref_format *format, struct used_atom *ato
return 0;
}
static int raw_atom_parser(struct ref_format *format, struct used_atom *atom,
static int raw_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{
if (!arg)
@ -460,7 +468,8 @@ static int raw_atom_parser(struct ref_format *format, struct used_atom *atom,
return 0;
}
static int oid_atom_parser(struct ref_format *format, struct used_atom *atom,
static int oid_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{
if (!arg)
@ -479,7 +488,8 @@ static int oid_atom_parser(struct ref_format *format, struct used_atom *atom,
return 0;
}
static int person_email_atom_parser(struct ref_format *format, struct used_atom *atom,
static int person_email_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{
if (!arg)
@ -493,7 +503,8 @@ static int person_email_atom_parser(struct ref_format *format, struct used_atom
return 0;
}
static int refname_atom_parser(struct ref_format *format, struct used_atom *atom,
static int refname_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{
return refname_atom_parser_internal(&atom->u.refname, arg, atom->name, err);
@ -510,7 +521,8 @@ static align_type parse_align_position(const char *s)
return -1;
}
static int align_atom_parser(struct ref_format *format, struct used_atom *atom,
static int align_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{
struct align *align = &atom->u.align;
@ -562,7 +574,8 @@ static int align_atom_parser(struct ref_format *format, struct used_atom *atom,
return 0;
}
static int if_atom_parser(struct ref_format *format, struct used_atom *atom,
static int if_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{
if (!arg) {
@ -577,7 +590,8 @@ static int if_atom_parser(struct ref_format *format, struct used_atom *atom,
return 0;
}
static int rest_atom_parser(struct ref_format *format, struct used_atom *atom,
static int rest_atom_parser(struct ref_format *format,
struct used_atom *atom UNUSED,
const char *arg, struct strbuf *err)
{
if (arg)
@ -586,7 +600,8 @@ static int rest_atom_parser(struct ref_format *format, struct used_atom *atom,
return 0;
}
static int head_atom_parser(struct ref_format *format, struct used_atom *atom,
static int head_atom_parser(struct ref_format *format UNUSED,
struct used_atom *atom,
const char *arg, struct strbuf *err)
{
if (arg)
@ -791,7 +806,7 @@ static void quote_formatting(struct strbuf *s, const char *str, ssize_t len, int
}
static int append_atom(struct atom_value *v, struct ref_formatting_state *state,
struct strbuf *unused_err)
struct strbuf *err UNUSED)
{
/*
* Quote formatting is only done when the stack has a single
@ -841,7 +856,7 @@ static void end_align_handler(struct ref_formatting_stack **stack)
}
static int align_atom_handler(struct atom_value *atomv, struct ref_formatting_state *state,
struct strbuf *unused_err)
struct strbuf *err UNUSED)
{
struct ref_formatting_stack *new_stack;
@ -888,7 +903,7 @@ static void if_then_else_handler(struct ref_formatting_stack **stack)
}
static int if_atom_handler(struct atom_value *atomv, struct ref_formatting_state *state,
struct strbuf *unused_err)
struct strbuf *err UNUSED)
{
struct ref_formatting_stack *new_stack;
struct if_then_else *if_then_else = xcalloc(1,
@ -915,7 +930,8 @@ static int is_empty(struct strbuf *buf)
return cur == end;
}
static int then_atom_handler(struct atom_value *atomv, struct ref_formatting_state *state,
static int then_atom_handler(struct atom_value *atomv UNUSED,
struct ref_formatting_state *state,
struct strbuf *err)
{
struct ref_formatting_stack *cur = state->stack;
@ -952,7 +968,8 @@ static int then_atom_handler(struct atom_value *atomv, struct ref_formatting_sta
return 0;
}
static int else_atom_handler(struct atom_value *atomv, struct ref_formatting_state *state,
static int else_atom_handler(struct atom_value *atomv UNUSED,
struct ref_formatting_state *state,
struct strbuf *err)
{
struct ref_formatting_stack *prev = state->stack;
@ -973,7 +990,8 @@ static int else_atom_handler(struct atom_value *atomv, struct ref_formatting_sta
return 0;
}
static int end_atom_handler(struct atom_value *atomv, struct ref_formatting_state *state,
static int end_atom_handler(struct atom_value *atomv UNUSED,
struct ref_formatting_state *state,
struct strbuf *err)
{
struct ref_formatting_stack *current = state->stack;
@ -1822,7 +1840,7 @@ static void lazy_init_worktree_map(void)
populate_worktree_map(&(ref_to_worktree_map.map), ref_to_worktree_map.worktrees);
}
static char *get_worktree_path(const struct used_atom *atom, const struct ref_array_item *ref)
static char *get_worktree_path(const struct ref_array_item *ref)
{
struct hashmap_entry entry, *e;
struct ref_to_worktree_entry *lookup_result;
@ -1881,7 +1899,7 @@ static int populate_value(struct ref_array_item *ref, struct strbuf *err)
refname = get_refname(atom, ref);
else if (atom_type == ATOM_WORKTREEPATH) {
if (ref->kind == FILTER_REFS_BRANCHES)
v->s = get_worktree_path(atom, ref);
v->s = get_worktree_path(ref);
else
v->s = xstrdup("");
continue;

View File

@ -3442,8 +3442,8 @@ void reset_revision_walk(void)
}
static int mark_uninteresting(const struct object_id *oid,
struct packed_git *pack,
uint32_t pos,
struct packed_git *pack UNUSED,
uint32_t pos UNUSED,
void *cb)
{
struct rev_info *revs = cb;
@ -4161,7 +4161,7 @@ static struct commit *get_revision_1(struct rev_info *revs)
* Return true for entries that have not yet been shown. (This is an
* object_array_each_func_t.)
*/
static int entry_unshown(struct object_array_entry *entry, void *cb_data_unused)
static int entry_unshown(struct object_array_entry *entry, void *cb_data UNUSED)
{
return !(entry->item->flags & SHOWN);
}

View File

@ -341,19 +341,19 @@ static void child_close_pair(int fd[2])
child_close(fd[1]);
}
static void child_error_fn(const char *err, va_list params)
static void child_error_fn(const char *err UNUSED, va_list params UNUSED)
{
const char msg[] = "error() should not be called in child\n";
xwrite(2, msg, sizeof(msg) - 1);
}
static void child_warn_fn(const char *err, va_list params)
static void child_warn_fn(const char *err UNUSED, va_list params UNUSED)
{
const char msg[] = "warn() should not be called in child\n";
xwrite(2, msg, sizeof(msg) - 1);
}
static void NORETURN child_die_fn(const char *err, va_list params)
static void NORETURN child_die_fn(const char *err UNUSED, va_list params UNUSED)
{
const char msg[] = "die() should not be called in child\n";
xwrite(2, msg, sizeof(msg) - 1);

12
serve.c
View File

@ -13,13 +13,13 @@
static int advertise_sid = -1;
static int client_hash_algo = GIT_HASH_SHA1;
static int always_advertise(struct repository *r,
struct strbuf *value)
static int always_advertise(struct repository *r UNUSED,
struct strbuf *value UNUSED)
{
return 1;
}
static int agent_advertise(struct repository *r,
static int agent_advertise(struct repository *r UNUSED,
struct strbuf *value)
{
if (value)
@ -35,7 +35,7 @@ static int object_format_advertise(struct repository *r,
return 1;
}
static void object_format_receive(struct repository *r,
static void object_format_receive(struct repository *r UNUSED,
const char *algo_name)
{
if (!algo_name)
@ -49,7 +49,7 @@ static void object_format_receive(struct repository *r,
static int session_id_advertise(struct repository *r, struct strbuf *value)
{
if (advertise_sid == -1 &&
git_config_get_bool("transfer.advertisesid", &advertise_sid))
repo_config_get_bool(r, "transfer.advertisesid", &advertise_sid))
advertise_sid = 0;
if (!advertise_sid)
return 0;
@ -58,7 +58,7 @@ static int session_id_advertise(struct repository *r, struct strbuf *value)
return 1;
}
static void session_id_receive(struct repository *r,
static void session_id_receive(struct repository *r UNUSED,
const char *client_sid)
{
if (!client_sid)

View File

@ -1740,7 +1740,7 @@ static int get_next_submodule(struct child_process *cp, struct strbuf *err,
return 0;
}
static int fetch_start_failure(struct strbuf *err,
static int fetch_start_failure(struct strbuf *err UNUSED,
void *cb, void *task_cb)
{
struct submodule_parallel_fetch *spf = cb;
@ -1761,7 +1761,7 @@ static int commit_missing_in_sub(const struct object_id *oid, void *data)
return type != OBJ_COMMIT;
}
static int fetch_finish(int retvalue, struct strbuf *err,
static int fetch_finish(int retvalue, struct strbuf *err UNUSED,
void *cb, void *task_cb)
{
struct submodule_parallel_fetch *spf = cb;

View File

@ -1,7 +1,7 @@
#include "test-tool.h"
#include "prio-queue.h"
static int intcmp(const void *va, const void *vb, void *data)
static int intcmp(const void *va, const void *vb, void *data UNUSED)
{
const int *a = va, *b = vb;
return *a - *b;

View File

@ -22,7 +22,7 @@ static int number_callbacks;
static int parallel_next(struct child_process *cp,
struct strbuf *err,
void *cb,
void **task_cb)
void **task_cb UNUSED)
{
struct child_process *d = cb;
if (number_callbacks >= 4)
@ -38,10 +38,10 @@ static int parallel_next(struct child_process *cp,
return 1;
}
static int no_job(struct child_process *cp,
static int no_job(struct child_process *cp UNUSED,
struct strbuf *err,
void *cb,
void **task_cb)
void *cb UNUSED,
void **task_cb UNUSED)
{
if (err)
strbuf_addstr(err, "no further jobs available\n");
@ -50,10 +50,10 @@ static int no_job(struct child_process *cp,
return 0;
}
static int task_finished(int result,
static int task_finished(int result UNUSED,
struct strbuf *err,
void *pp_cb,
void *pp_task_cb)
void *pp_cb UNUSED,
void *pp_task_cb UNUSED)
{
if (err)
strbuf_addstr(err, "asking for a quick stop\n");

View File

@ -1700,7 +1700,7 @@ enum fetch_state {
FETCH_DONE,
};
int upload_pack_v2(struct repository *r, struct packet_reader *request)
int upload_pack_v2(struct repository *r UNUSED, struct packet_reader *request)
{
enum fetch_state state = FETCH_PROCESS_ARGS;
struct upload_pack_data data;
@ -1776,26 +1776,26 @@ int upload_pack_advertise(struct repository *r,
strbuf_addstr(value, "shallow wait-for-done");
if (!repo_config_get_bool(the_repository,
if (!repo_config_get_bool(r,
"uploadpack.allowfilter",
&allow_filter_value) &&
allow_filter_value)
strbuf_addstr(value, " filter");
if (!repo_config_get_bool(the_repository,
if (!repo_config_get_bool(r,
"uploadpack.allowrefinwant",
&allow_ref_in_want) &&
allow_ref_in_want)
strbuf_addstr(value, " ref-in-want");
if (git_env_bool("GIT_TEST_SIDEBAND_ALL", 0) ||
(!repo_config_get_bool(the_repository,
(!repo_config_get_bool(r,
"uploadpack.allowsidebandall",
&allow_sideband_all_value) &&
allow_sideband_all_value))
strbuf_addstr(value, " sideband-all");
if (!repo_config_get_string(the_repository,
if (!repo_config_get_string(r,
"uploadpack.blobpackfileuri",
&str) &&
str) {