1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-06 14:36:18 +02:00

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
commit c5fcd34e1b
22 changed files with 46 additions and 47 deletions

View File

@ -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
* 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;
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
* 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;
int rc = 0;

View File

@ -82,7 +82,7 @@ static int count_cruft(const char *basename UNUSED, const char *path,
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: ");
quote_c_style(odb->path, NULL, stdout, 0);

View File

@ -99,7 +99,7 @@ static const char diff_tree_usage[] =
" --root include the initial commit as diff against /dev/null\n"
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->dense_combined_merges)

View File

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

View File

@ -221,7 +221,8 @@ static void cleanup_thread(void)
}
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)
return -1;

View File

@ -718,8 +718,7 @@ static int show_tree_object(const struct object_id *oid UNUSED,
return 0;
}
static void show_setup_revisions_tweak(struct rev_info *rev,
struct setup_revision_opt *opt)
static void show_setup_revisions_tweak(struct rev_info *rev)
{
if (rev->first_parent_only)
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);
}
static void log_setup_revisions_tweak(struct rev_info *rev,
struct setup_revision_opt *opt)
static void log_setup_revisions_tweak(struct rev_info *rev)
{
if (rev->diffopt.flags.default_follow_renames &&
diff_check_follow_pathspec(&rev->prune_data, 0))

View File

@ -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
* 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? */
if (same_entry(entry+1, entry+2) || both_empty(entry+1, entry+2)) {

View File

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

View File

@ -49,7 +49,7 @@ struct show_data {
static int show_reference(struct repository *r, const char *refname,
const struct object_id *oid,
int flag, void *cb_data)
int flag UNUSED, void *cb_data)
{
struct show_data *data = cb_data;
@ -409,7 +409,7 @@ struct check_mergetag_data {
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,
void *data)
{

View File

@ -225,7 +225,7 @@ static int anti_reference(const char *refname, const struct object_id *oid,
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);
return 0;

View File

@ -121,7 +121,7 @@ static int for_each_tag_name(const char **argv, each_tag_name_fn fn,
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)
{
struct string_list *ref_list = cb_data;
@ -155,7 +155,7 @@ static int delete_tags(const char **argv)
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)
{
int flags;

View File

@ -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.
*/
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;

4
fsck.c
View File

@ -1309,9 +1309,9 @@ int fsck_buffer(const struct object_id *oid, enum object_type type,
int fsck_error_function(struct fsck_options *o,
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_id msg_id,
enum fsck_msg_id msg_id UNUSED,
const char *message)
{
if (msg_type == FSCK_WARN) {

View File

@ -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
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;
const char *c = strchr(name, ':');

9
http.c
View File

@ -196,7 +196,7 @@ static inline int is_hdr_continuation(const char *ptr, const size_t size)
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;
struct strvec *values = &http_auth.wwwauth_headers;
@ -295,7 +295,8 @@ static size_t fwrite_wwwauth(char *ptr, size_t eltsize, size_t nmemb, void *p)
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;
}
@ -821,7 +822,9 @@ static void curl_dump_info(char *data, size_t size)
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;
enum { NO_FILTER = 0, DO_FILTER = 1 };

View File

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

2
refs.c
View File

@ -1613,7 +1613,7 @@ struct do_for_each_ref_help {
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 struct object_id *oid,
int flags,

View File

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

View File

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

View File

@ -7,7 +7,7 @@
#include "split-index.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);
}

View File

@ -4,7 +4,7 @@
#include "setup.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));
return 0;

View File

@ -277,11 +277,6 @@ static int cmd_delete_reflog(struct ref_store *refs, const char **argv)
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)
{
const char *msg = notnull(*argv++, "msg");
@ -336,7 +331,6 @@ static struct command commands[] = {
{ "reflog-exists", cmd_reflog_exists },
{ "create-reflog", cmd_create_reflog },
{ "delete-reflog", cmd_delete_reflog },
{ "reflog-expire", cmd_reflog_expire },
/*
* backend transaction functions can't be tested separately
*/