Merge branch 'jk/unused-parameter'

Mark-up unused parameters in the code so that we can eventually
enable -Wunused-parameter by default.

* jk/unused-parameter:
  t/helper: mark unused callback void data parameters
  tag: mark unused parameters in each_tag_name_fn callbacks
  rev-parse: mark unused parameter in for_each_abbrev callback
  replace: mark unused parameter in each_mergetag_fn callback
  replace: mark unused parameter in ref callback
  merge-tree: mark unused parameter in traverse callback
  fsck: mark unused parameters in various fsck callbacks
  revisions: drop unused "opt" parameter in "tweak" callbacks
  count-objects: mark unused parameter in alternates callback
  am: mark unused keep_cr parameters
  http-push: mark unused parameter in xml callback
  http: mark unused parameters in curl callbacks
  do_for_each_ref_helper(): mark unused repository parameter
  test-ref-store: drop unimplemented reflog-expire command
This commit is contained in:
Junio C Hamano 2023-07-25 12:05:24 -07:00
Родитель dd224ce15d 1e9cb3487a
Коммит c5fcd34e1b
22 изменённых файлов: 46 добавлений и 47 удалений

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

@ -786,7 +786,7 @@ static int split_mail_conv(mail_conv_fn fn, struct am_state *state,
* A split_mail_conv() callback that converts an StGit patch to an RFC2822 * A split_mail_conv() callback that converts an StGit patch to an RFC2822
* message suitable for parsing with git-mailinfo. * message suitable for parsing with git-mailinfo.
*/ */
static int stgit_patch_to_mail(FILE *out, FILE *in, int keep_cr) static int stgit_patch_to_mail(FILE *out, FILE *in, int keep_cr UNUSED)
{ {
struct strbuf sb = STRBUF_INIT; struct strbuf sb = STRBUF_INIT;
int subject_printed = 0; int subject_printed = 0;
@ -869,7 +869,7 @@ static int split_mail_stgit_series(struct am_state *state, const char **paths,
* A split_patches_conv() callback that converts a mercurial patch to a RFC2822 * A split_patches_conv() callback that converts a mercurial patch to a RFC2822
* message suitable for parsing with git-mailinfo. * message suitable for parsing with git-mailinfo.
*/ */
static int hg_patch_to_mail(FILE *out, FILE *in, int keep_cr) static int hg_patch_to_mail(FILE *out, FILE *in, int keep_cr UNUSED)
{ {
struct strbuf sb = STRBUF_INIT; struct strbuf sb = STRBUF_INIT;
int rc = 0; int rc = 0;

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

@ -82,7 +82,7 @@ static int count_cruft(const char *basename UNUSED, const char *path,
return 0; return 0;
} }
static int print_alternate(struct object_directory *odb, void *data) static int print_alternate(struct object_directory *odb, void *data UNUSED)
{ {
printf("alternate: "); printf("alternate: ");
quote_c_style(odb->path, NULL, stdout, 0); quote_c_style(odb->path, NULL, stdout, 0);

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

@ -99,7 +99,7 @@ static const char diff_tree_usage[] =
" --root include the initial commit as diff against /dev/null\n" " --root include the initial commit as diff against /dev/null\n"
COMMON_DIFF_OPTIONS_HELP; COMMON_DIFF_OPTIONS_HELP;
static void diff_tree_tweak_rev(struct rev_info *rev, struct setup_revision_opt *opt) static void diff_tree_tweak_rev(struct rev_info *rev)
{ {
if (!rev->diffopt.output_format) { if (!rev->diffopt.output_format) {
if (rev->dense_combined_merges) if (rev->dense_combined_merges)

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

@ -92,11 +92,11 @@ static int objerror(struct object *obj, const char *err)
return -1; return -1;
} }
static int fsck_error_func(struct fsck_options *o, static int fsck_error_func(struct fsck_options *o UNUSED,
const struct object_id *oid, const struct object_id *oid,
enum object_type object_type, enum object_type object_type,
enum fsck_msg_type msg_type, enum fsck_msg_type msg_type,
enum fsck_msg_id msg_id, enum fsck_msg_id msg_id UNUSED,
const char *message) const char *message)
{ {
switch (msg_type) { switch (msg_type) {
@ -121,7 +121,7 @@ static int fsck_error_func(struct fsck_options *o,
static struct object_array pending; static struct object_array pending;
static int mark_object(struct object *obj, enum object_type type, static int mark_object(struct object *obj, enum object_type type,
void *data, struct fsck_options *options) void *data, struct fsck_options *options UNUSED)
{ {
struct object *parent = data; struct object *parent = data;
@ -206,8 +206,8 @@ static int traverse_reachable(void)
return !!result; return !!result;
} }
static int mark_used(struct object *obj, enum object_type object_type, static int mark_used(struct object *obj, int type UNUSED,
void *data, struct fsck_options *options) void *data UNUSED, struct fsck_options *options UNUSED)
{ {
if (!obj) if (!obj)
return 1; return 1;

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

@ -221,7 +221,8 @@ static void cleanup_thread(void)
} }
static int mark_link(struct object *obj, enum object_type type, static int mark_link(struct object *obj, enum object_type type,
void *data, struct fsck_options *options) void *data UNUSED,
struct fsck_options *options UNUSED)
{ {
if (!obj) if (!obj)
return -1; return -1;

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

@ -718,8 +718,7 @@ static int show_tree_object(const struct object_id *oid UNUSED,
return 0; return 0;
} }
static void show_setup_revisions_tweak(struct rev_info *rev, static void show_setup_revisions_tweak(struct rev_info *rev)
struct setup_revision_opt *opt)
{ {
if (rev->first_parent_only) if (rev->first_parent_only)
diff_merges_default_to_first_parent(rev); diff_merges_default_to_first_parent(rev);
@ -862,8 +861,7 @@ int cmd_log_reflog(int argc, const char **argv, const char *prefix)
return cmd_log_deinit(cmd_log_walk(&rev), &rev); return cmd_log_deinit(cmd_log_walk(&rev), &rev);
} }
static void log_setup_revisions_tweak(struct rev_info *rev, static void log_setup_revisions_tweak(struct rev_info *rev)
struct setup_revision_opt *opt)
{ {
if (rev->diffopt.flags.default_follow_renames && if (rev->diffopt.flags.default_follow_renames &&
diff_check_follow_pathspec(&rev->prune_data, 0)) diff_check_follow_pathspec(&rev->prune_data, 0))

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

@ -324,7 +324,9 @@ static void unresolved(const struct traverse_info *info, struct name_entry n[3])
* The successful merge rules are the same as for the three-way merge * The successful merge rules are the same as for the three-way merge
* in git-read-tree. * in git-read-tree.
*/ */
static int threeway_callback(int n, unsigned long mask, unsigned long dirmask, struct name_entry *entry, struct traverse_info *info) static int threeway_callback(int n UNUSED, unsigned long mask,
unsigned long dirmask UNUSED,
struct name_entry *entry, struct traverse_info *info)
{ {
/* Same in both? */ /* Same in both? */
if (same_entry(entry+1, entry+2) || both_empty(entry+1, entry+2)) { if (same_entry(entry+1, entry+2) || both_empty(entry+1, entry+2)) {

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

@ -18,11 +18,11 @@ static int option_strict = 1;
static struct fsck_options fsck_options = FSCK_OPTIONS_STRICT; static struct fsck_options fsck_options = FSCK_OPTIONS_STRICT;
static int mktag_fsck_error_func(struct fsck_options *o, static int mktag_fsck_error_func(struct fsck_options *o UNUSED,
const struct object_id *oid, const struct object_id *oid UNUSED,
enum object_type object_type, enum object_type object_type UNUSED,
enum fsck_msg_type msg_type, enum fsck_msg_type msg_type,
enum fsck_msg_id msg_id, enum fsck_msg_id msg_id UNUSED,
const char *message) const char *message)
{ {
switch (msg_type) { switch (msg_type) {

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

@ -49,7 +49,7 @@ struct show_data {
static int show_reference(struct repository *r, const char *refname, static int show_reference(struct repository *r, const char *refname,
const struct object_id *oid, const struct object_id *oid,
int flag, void *cb_data) int flag UNUSED, void *cb_data)
{ {
struct show_data *data = cb_data; struct show_data *data = cb_data;
@ -409,7 +409,7 @@ struct check_mergetag_data {
const char **argv; const char **argv;
}; };
static int check_one_mergetag(struct commit *commit, static int check_one_mergetag(struct commit *commit UNUSED,
struct commit_extra_header *extra, struct commit_extra_header *extra,
void *data) void *data)
{ {

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

@ -225,7 +225,7 @@ static int anti_reference(const char *refname, const struct object_id *oid,
return 0; return 0;
} }
static int show_abbrev(const struct object_id *oid, void *cb_data) static int show_abbrev(const struct object_id *oid, void *cb_data UNUSED)
{ {
show_rev(NORMAL, oid, NULL); show_rev(NORMAL, oid, NULL);
return 0; return 0;

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

@ -121,7 +121,7 @@ static int for_each_tag_name(const char **argv, each_tag_name_fn fn,
return had_error; return had_error;
} }
static int collect_tags(const char *name, const char *ref, static int collect_tags(const char *name UNUSED, const char *ref,
const struct object_id *oid, void *cb_data) const struct object_id *oid, void *cb_data)
{ {
struct string_list *ref_list = cb_data; struct string_list *ref_list = cb_data;
@ -155,7 +155,7 @@ static int delete_tags(const char **argv)
return result; return result;
} }
static int verify_tag(const char *name, const char *ref, static int verify_tag(const char *name, const char *ref UNUSED,
const struct object_id *oid, void *cb_data) const struct object_id *oid, void *cb_data)
{ {
int flags; int flags;

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

@ -215,7 +215,8 @@ static void write_cached_object(struct object *obj, struct obj_buffer *obj_buf)
* Verify its reachability and validity recursively and write it out. * Verify its reachability and validity recursively and write it out.
*/ */
static int check_object(struct object *obj, enum object_type type, static int check_object(struct object *obj, enum object_type type,
void *data, struct fsck_options *options) void *data UNUSED,
struct fsck_options *options UNUSED)
{ {
struct obj_buffer *obj_buf; struct obj_buffer *obj_buf;

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

@ -1309,9 +1309,9 @@ int fsck_buffer(const struct object_id *oid, enum object_type type,
int fsck_error_function(struct fsck_options *o, int fsck_error_function(struct fsck_options *o,
const struct object_id *oid, const struct object_id *oid,
enum object_type object_type, enum object_type object_type UNUSED,
enum fsck_msg_type msg_type, enum fsck_msg_type msg_type,
enum fsck_msg_id msg_id, enum fsck_msg_id msg_id UNUSED,
const char *message) const char *message)
{ {
if (msg_type == FSCK_WARN) { if (msg_type == FSCK_WARN) {

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

@ -783,7 +783,7 @@ static void handle_new_lock_ctx(struct xml_ctx *ctx, int tag_closed)
static void one_remote_ref(const char *refname); static void one_remote_ref(const char *refname);
static void static void
xml_start_tag(void *userData, const char *name, const char **atts) xml_start_tag(void *userData, const char *name, const char **atts UNUSED)
{ {
struct xml_ctx *ctx = (struct xml_ctx *)userData; struct xml_ctx *ctx = (struct xml_ctx *)userData;
const char *c = strchr(name, ':'); const char *c = strchr(name, ':');

9
http.c
Просмотреть файл

@ -196,7 +196,7 @@ static inline int is_hdr_continuation(const char *ptr, const size_t size)
return size && (*ptr == ' ' || *ptr == '\t'); return size && (*ptr == ' ' || *ptr == '\t');
} }
static size_t fwrite_wwwauth(char *ptr, size_t eltsize, size_t nmemb, void *p) static size_t fwrite_wwwauth(char *ptr, size_t eltsize, size_t nmemb, void *p UNUSED)
{ {
size_t size = eltsize * nmemb; size_t size = eltsize * nmemb;
struct strvec *values = &http_auth.wwwauth_headers; struct strvec *values = &http_auth.wwwauth_headers;
@ -295,7 +295,8 @@ exit:
return size; return size;
} }
size_t fwrite_null(char *ptr, size_t eltsize, size_t nmemb, void *strbuf) size_t fwrite_null(char *ptr UNUSED, size_t eltsize UNUSED, size_t nmemb,
void *data UNUSED)
{ {
return nmemb; return nmemb;
} }
@ -821,7 +822,9 @@ static void curl_dump_info(char *data, size_t size)
strbuf_release(&buf); strbuf_release(&buf);
} }
static int curl_trace(CURL *handle, curl_infotype type, char *data, size_t size, void *userp) static int curl_trace(CURL *handle UNUSED, curl_infotype type,
char *data, size_t size,
void *userp UNUSED)
{ {
const char *text; const char *text;
enum { NO_FILTER = 0, DO_FILTER = 1 }; enum { NO_FILTER = 0, DO_FILTER = 1 };

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

@ -2306,11 +2306,11 @@ int repo_has_object_file(struct repository *r,
* report the minimal fsck error here, and rely on the caller to * report the minimal fsck error here, and rely on the caller to
* give more context. * give more context.
*/ */
static int hash_format_check_report(struct fsck_options *opts, static int hash_format_check_report(struct fsck_options *opts UNUSED,
const struct object_id *oid, const struct object_id *oid UNUSED,
enum object_type object_type, enum object_type object_type UNUSED,
enum fsck_msg_type msg_type, enum fsck_msg_type msg_type UNUSED,
enum fsck_msg_id msg_id, enum fsck_msg_id msg_id UNUSED,
const char *message) const char *message)
{ {
error(_("object fails fsck: %s"), message); error(_("object fails fsck: %s"), message);

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

@ -1613,7 +1613,7 @@ struct do_for_each_ref_help {
void *cb_data; void *cb_data;
}; };
static int do_for_each_ref_helper(struct repository *r, static int do_for_each_ref_helper(struct repository *r UNUSED,
const char *refname, const char *refname,
const struct object_id *oid, const struct object_id *oid,
int flags, int flags,

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

@ -2970,7 +2970,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
if (!revs->def) if (!revs->def)
revs->def = opt ? opt->def : NULL; revs->def = opt ? opt->def : NULL;
if (opt && opt->tweak) if (opt && opt->tweak)
opt->tweak(revs, opt); opt->tweak(revs);
if (revs->show_merge) if (revs->show_merge)
prepare_show_merge(revs); prepare_show_merge(revs);
if (revs->def && !revs->pending.nr && !revs->rev_input_given) { if (revs->def && !revs->pending.nr && !revs->rev_input_given) {

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

@ -429,7 +429,7 @@ void repo_init_revisions(struct repository *r,
*/ */
struct setup_revision_opt { struct setup_revision_opt {
const char *def; const char *def;
void (*tweak)(struct rev_info *, struct setup_revision_opt *); void (*tweak)(struct rev_info *);
unsigned int assume_dashdash:1, unsigned int assume_dashdash:1,
allow_exclude_promisor_objects:1, allow_exclude_promisor_objects:1,
free_removed_argv_elements:1; free_removed_argv_elements:1;

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

@ -7,7 +7,7 @@
#include "split-index.h" #include "split-index.h"
#include "ewah/ewok.h" #include "ewah/ewok.h"
static void show_bit(size_t pos, void *data) static void show_bit(size_t pos, void *data UNUSED)
{ {
printf(" %d", (int)pos); printf(" %d", (int)pos);
} }

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

@ -4,7 +4,7 @@
#include "setup.h" #include "setup.h"
#include "strbuf.h" #include "strbuf.h"
static int print_oid(const struct object_id *oid, void *data) static int print_oid(const struct object_id *oid, void *data UNUSED)
{ {
puts(oid_to_hex(oid)); puts(oid_to_hex(oid));
return 0; return 0;

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

@ -277,11 +277,6 @@ static int cmd_delete_reflog(struct ref_store *refs, const char **argv)
return refs_delete_reflog(refs, refname); return refs_delete_reflog(refs, refname);
} }
static int cmd_reflog_expire(struct ref_store *refs, const char **argv)
{
die("not supported yet");
}
static int cmd_delete_ref(struct ref_store *refs, const char **argv) static int cmd_delete_ref(struct ref_store *refs, const char **argv)
{ {
const char *msg = notnull(*argv++, "msg"); const char *msg = notnull(*argv++, "msg");
@ -336,7 +331,6 @@ static struct command commands[] = {
{ "reflog-exists", cmd_reflog_exists }, { "reflog-exists", cmd_reflog_exists },
{ "create-reflog", cmd_create_reflog }, { "create-reflog", cmd_create_reflog },
{ "delete-reflog", cmd_delete_reflog }, { "delete-reflog", cmd_delete_reflog },
{ "reflog-expire", cmd_reflog_expire },
/* /*
* backend transaction functions can't be tested separately * backend transaction functions can't be tested separately
*/ */