diff: mark unused parameters in callbacks
The diff code provides a format_callback interface, but not every callback needs each parameter (e.g., the "opt" and "data" parameters are frequently left unused). Likewise for the output_prefix callback, the low-level change/add_remove interfaces, the callbacks used by xdi_diff(), etc. Mark unused arguments in the callback implementations to quiet -Wunused-parameter. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
8157ed4046
commit
61bdc7c5d8
@ -724,7 +724,7 @@ static int run_update(struct add_i_state *s, const struct pathspec *ps,
|
||||
}
|
||||
|
||||
static void revert_from_diff(struct diff_queue_struct *q,
|
||||
struct diff_options *opt, void *data)
|
||||
struct diff_options *opt, void *data UNUSED)
|
||||
{
|
||||
int i, add_flags = ADD_CACHE_OK_TO_ADD | ADD_CACHE_OK_TO_REPLACE;
|
||||
|
||||
|
@ -88,7 +88,7 @@ static int fix_unmerged_status(struct diff_filepair *p,
|
||||
}
|
||||
|
||||
static void update_callback(struct diff_queue_struct *q,
|
||||
struct diff_options *opt, void *cbdata)
|
||||
struct diff_options *opt UNUSED, void *cbdata)
|
||||
{
|
||||
int i;
|
||||
struct update_callback_data *data = cbdata;
|
||||
|
@ -409,7 +409,7 @@ static const char *anonymize_oid(const char *oid_hex)
|
||||
}
|
||||
|
||||
static void show_filemodify(struct diff_queue_struct *q,
|
||||
struct diff_options *options, void *data)
|
||||
struct diff_options *options UNUSED, void *data)
|
||||
{
|
||||
int i;
|
||||
struct string_list *changed = data;
|
||||
|
@ -98,7 +98,7 @@ static void *origin(struct merge_list *entry, unsigned long *size)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int show_outf(void *priv_, mmbuffer_t *mb, int nbuf)
|
||||
static int show_outf(void *priv UNUSED, mmbuffer_t *mb, int nbuf)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < nbuf; i++)
|
||||
|
@ -776,7 +776,7 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
|
||||
}
|
||||
|
||||
static void count_diff_files(struct diff_queue_struct *q,
|
||||
struct diff_options *opt, void *data)
|
||||
struct diff_options *opt UNUSED, void *data)
|
||||
{
|
||||
int *count = data;
|
||||
|
||||
|
@ -14,7 +14,7 @@ static const char * const rerere_usage[] = {
|
||||
NULL,
|
||||
};
|
||||
|
||||
static int outf(void *dummy, mmbuffer_t *ptr, int nbuf)
|
||||
static int outf(void *dummy UNUSED, mmbuffer_t *ptr, int nbuf)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < nbuf; i++)
|
||||
|
@ -133,7 +133,8 @@ static void print_new_head_line(struct commit *commit)
|
||||
}
|
||||
|
||||
static void update_index_from_diff(struct diff_queue_struct *q,
|
||||
struct diff_options *opt, void *data)
|
||||
struct diff_options *opt UNUSED,
|
||||
void *data)
|
||||
{
|
||||
int i;
|
||||
int intent_to_add = *(int *)data;
|
||||
|
@ -1043,7 +1043,7 @@ static void prepare_submodule_summary(struct summary_cb *info,
|
||||
}
|
||||
|
||||
static void submodule_summary_callback(struct diff_queue_struct *q,
|
||||
struct diff_options *options,
|
||||
struct diff_options *options UNUSED,
|
||||
void *data)
|
||||
{
|
||||
int i;
|
||||
|
@ -372,7 +372,7 @@ struct combine_diff_state {
|
||||
static void consume_hunk(void *state_,
|
||||
long ob, long on,
|
||||
long nb, long nn,
|
||||
const char *funcline, long funclen)
|
||||
const char *func UNUSED, long funclen UNUSED)
|
||||
{
|
||||
struct combine_diff_state *state = state_;
|
||||
|
||||
|
@ -673,7 +673,7 @@ int index_differs_from(struct repository *r,
|
||||
return (has_changes != 0);
|
||||
}
|
||||
|
||||
static struct strbuf *idiff_prefix_cb(struct diff_options *opt, void *data)
|
||||
static struct strbuf *idiff_prefix_cb(struct diff_options *opt UNUSED, void *data)
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
7
diff.c
7
diff.c
@ -1954,7 +1954,7 @@ static int color_words_output_graph_prefix(struct diff_words_data *diff_words)
|
||||
static void fn_out_diff_words_aux(void *priv,
|
||||
long minus_first, long minus_len,
|
||||
long plus_first, long plus_len,
|
||||
const char *func, long funclen)
|
||||
const char *func UNUSED, long funclen UNUSED)
|
||||
{
|
||||
struct diff_words_data *diff_words = priv;
|
||||
struct diff_words_style *style = diff_words->style;
|
||||
@ -3184,8 +3184,9 @@ static int is_conflict_marker(const char *line, int marker_size, unsigned long l
|
||||
}
|
||||
|
||||
static void checkdiff_consume_hunk(void *priv,
|
||||
long ob, long on, long nb, long nn,
|
||||
const char *func, long funclen)
|
||||
long ob UNUSED, long on UNUSED,
|
||||
long nb, long nn UNUSED,
|
||||
const char *func UNUSED, long funclen UNUSED)
|
||||
|
||||
{
|
||||
struct checkdiff_t *data = priv;
|
||||
|
12
range-diff.c
12
range-diff.c
@ -269,14 +269,18 @@ static void find_exact_matches(struct string_list *a, struct string_list *b)
|
||||
hashmap_clear(&map);
|
||||
}
|
||||
|
||||
static int diffsize_consume(void *data, char *line, unsigned long len)
|
||||
static int diffsize_consume(void *data,
|
||||
char *line UNUSED,
|
||||
unsigned long len UNUSED)
|
||||
{
|
||||
(*(int *)data)++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void diffsize_hunk(void *data, long ob, long on, long nb, long nn,
|
||||
const char *funcline, long funclen)
|
||||
static void diffsize_hunk(void *data,
|
||||
long ob UNUSED, long on UNUSED,
|
||||
long nb UNUSED, long nn UNUSED,
|
||||
const char *func UNUSED, long funclen UNUSED)
|
||||
{
|
||||
diffsize_consume(data, NULL, 0);
|
||||
}
|
||||
@ -461,7 +465,7 @@ static void patch_diff(const char *a, const char *b,
|
||||
diff_flush(diffopt);
|
||||
}
|
||||
|
||||
static struct strbuf *output_prefix_cb(struct diff_options *opt, void *data)
|
||||
static struct strbuf *output_prefix_cb(struct diff_options *opt UNUSED, void *data)
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
25
revision.c
25
revision.c
@ -600,10 +600,12 @@ static struct commit *one_relevant_parent(const struct rev_info *revs,
|
||||
static int tree_difference = REV_TREE_SAME;
|
||||
|
||||
static void file_add_remove(struct diff_options *options,
|
||||
int addremove, unsigned mode,
|
||||
const struct object_id *oid,
|
||||
int oid_valid,
|
||||
const char *fullpath, unsigned dirty_submodule)
|
||||
int addremove,
|
||||
unsigned mode UNUSED,
|
||||
const struct object_id *oid UNUSED,
|
||||
int oid_valid UNUSED,
|
||||
const char *fullpath UNUSED,
|
||||
unsigned dirty_submodule UNUSED)
|
||||
{
|
||||
int diff = addremove == '+' ? REV_TREE_NEW : REV_TREE_OLD;
|
||||
struct rev_info *revs = options->change_fn_data;
|
||||
@ -614,12 +616,15 @@ static void file_add_remove(struct diff_options *options,
|
||||
}
|
||||
|
||||
static void file_change(struct diff_options *options,
|
||||
unsigned old_mode, unsigned new_mode,
|
||||
const struct object_id *old_oid,
|
||||
const struct object_id *new_oid,
|
||||
int old_oid_valid, int new_oid_valid,
|
||||
const char *fullpath,
|
||||
unsigned old_dirty_submodule, unsigned new_dirty_submodule)
|
||||
unsigned old_mode UNUSED,
|
||||
unsigned new_mode UNUSED,
|
||||
const struct object_id *old_oid UNUSED,
|
||||
const struct object_id *new_oid UNUSED,
|
||||
int old_oid_valid UNUSED,
|
||||
int new_oid_valid UNUSED,
|
||||
const char *fullpath UNUSED,
|
||||
unsigned old_dirty_submodule UNUSED,
|
||||
unsigned new_dirty_submodule UNUSED)
|
||||
{
|
||||
tree_difference = REV_TREE_DIFFERENT;
|
||||
options->flags.has_changes = 1;
|
||||
|
@ -832,7 +832,7 @@ static void changed_submodule_data_clear(struct changed_submodule_data *cs_data)
|
||||
}
|
||||
|
||||
static void collect_changed_submodules_cb(struct diff_queue_struct *q,
|
||||
struct diff_options *options,
|
||||
struct diff_options *options UNUSED,
|
||||
void *data)
|
||||
{
|
||||
struct collect_changed_submodules_cb_data *me = data;
|
||||
|
@ -438,7 +438,7 @@ static char short_submodule_status(struct wt_status_change_data *d)
|
||||
}
|
||||
|
||||
static void wt_status_collect_changed_cb(struct diff_queue_struct *q,
|
||||
struct diff_options *options,
|
||||
struct diff_options *options UNUSED,
|
||||
void *data)
|
||||
{
|
||||
struct wt_status *s = data;
|
||||
@ -525,7 +525,7 @@ static int unmerged_mask(struct index_state *istate, const char *path)
|
||||
}
|
||||
|
||||
static void wt_status_collect_updated_cb(struct diff_queue_struct *q,
|
||||
struct diff_options *options,
|
||||
struct diff_options *options UNUSED,
|
||||
void *data)
|
||||
{
|
||||
struct wt_status *s = data;
|
||||
|
Loading…
Reference in New Issue
Block a user