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>maint
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,
|
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;
|
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,
|
static void update_callback(struct diff_queue_struct *q,
|
||||||
struct diff_options *opt, void *cbdata)
|
struct diff_options *opt UNUSED, void *cbdata)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct update_callback_data *data = cbdata;
|
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,
|
static void show_filemodify(struct diff_queue_struct *q,
|
||||||
struct diff_options *options, void *data)
|
struct diff_options *options UNUSED, void *data)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct string_list *changed = data;
|
struct string_list *changed = data;
|
||||||
|
|
|
@ -98,7 +98,7 @@ static void *origin(struct merge_list *entry, unsigned long *size)
|
||||||
return NULL;
|
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;
|
int i;
|
||||||
for (i = 0; i < nbuf; 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,
|
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;
|
int *count = data;
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ static const char * const rerere_usage[] = {
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int outf(void *dummy, mmbuffer_t *ptr, int nbuf)
|
static int outf(void *dummy UNUSED, mmbuffer_t *ptr, int nbuf)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < nbuf; 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,
|
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 i;
|
||||||
int intent_to_add = *(int *)data;
|
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,
|
static void submodule_summary_callback(struct diff_queue_struct *q,
|
||||||
struct diff_options *options,
|
struct diff_options *options UNUSED,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -372,7 +372,7 @@ struct combine_diff_state {
|
||||||
static void consume_hunk(void *state_,
|
static void consume_hunk(void *state_,
|
||||||
long ob, long on,
|
long ob, long on,
|
||||||
long nb, long nn,
|
long nb, long nn,
|
||||||
const char *funcline, long funclen)
|
const char *func UNUSED, long funclen UNUSED)
|
||||||
{
|
{
|
||||||
struct combine_diff_state *state = state_;
|
struct combine_diff_state *state = state_;
|
||||||
|
|
||||||
|
|
|
@ -673,7 +673,7 @@ int index_differs_from(struct repository *r,
|
||||||
return (has_changes != 0);
|
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;
|
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,
|
static void fn_out_diff_words_aux(void *priv,
|
||||||
long minus_first, long minus_len,
|
long minus_first, long minus_len,
|
||||||
long plus_first, long plus_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_data *diff_words = priv;
|
||||||
struct diff_words_style *style = diff_words->style;
|
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,
|
static void checkdiff_consume_hunk(void *priv,
|
||||||
long ob, long on, long nb, long nn,
|
long ob UNUSED, long on UNUSED,
|
||||||
const char *func, long funclen)
|
long nb, long nn UNUSED,
|
||||||
|
const char *func UNUSED, long funclen UNUSED)
|
||||||
|
|
||||||
{
|
{
|
||||||
struct checkdiff_t *data = priv;
|
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);
|
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)++;
|
(*(int *)data)++;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void diffsize_hunk(void *data, long ob, long on, long nb, long nn,
|
static void diffsize_hunk(void *data,
|
||||||
const char *funcline, long funclen)
|
long ob UNUSED, long on UNUSED,
|
||||||
|
long nb UNUSED, long nn UNUSED,
|
||||||
|
const char *func UNUSED, long funclen UNUSED)
|
||||||
{
|
{
|
||||||
diffsize_consume(data, NULL, 0);
|
diffsize_consume(data, NULL, 0);
|
||||||
}
|
}
|
||||||
|
@ -461,7 +465,7 @@ static void patch_diff(const char *a, const char *b,
|
||||||
diff_flush(diffopt);
|
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;
|
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 int tree_difference = REV_TREE_SAME;
|
||||||
|
|
||||||
static void file_add_remove(struct diff_options *options,
|
static void file_add_remove(struct diff_options *options,
|
||||||
int addremove, unsigned mode,
|
int addremove,
|
||||||
const struct object_id *oid,
|
unsigned mode UNUSED,
|
||||||
int oid_valid,
|
const struct object_id *oid UNUSED,
|
||||||
const char *fullpath, unsigned dirty_submodule)
|
int oid_valid UNUSED,
|
||||||
|
const char *fullpath UNUSED,
|
||||||
|
unsigned dirty_submodule UNUSED)
|
||||||
{
|
{
|
||||||
int diff = addremove == '+' ? REV_TREE_NEW : REV_TREE_OLD;
|
int diff = addremove == '+' ? REV_TREE_NEW : REV_TREE_OLD;
|
||||||
struct rev_info *revs = options->change_fn_data;
|
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,
|
static void file_change(struct diff_options *options,
|
||||||
unsigned old_mode, unsigned new_mode,
|
unsigned old_mode UNUSED,
|
||||||
const struct object_id *old_oid,
|
unsigned new_mode UNUSED,
|
||||||
const struct object_id *new_oid,
|
const struct object_id *old_oid UNUSED,
|
||||||
int old_oid_valid, int new_oid_valid,
|
const struct object_id *new_oid UNUSED,
|
||||||
const char *fullpath,
|
int old_oid_valid UNUSED,
|
||||||
unsigned old_dirty_submodule, unsigned new_dirty_submodule)
|
int new_oid_valid UNUSED,
|
||||||
|
const char *fullpath UNUSED,
|
||||||
|
unsigned old_dirty_submodule UNUSED,
|
||||||
|
unsigned new_dirty_submodule UNUSED)
|
||||||
{
|
{
|
||||||
tree_difference = REV_TREE_DIFFERENT;
|
tree_difference = REV_TREE_DIFFERENT;
|
||||||
options->flags.has_changes = 1;
|
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,
|
static void collect_changed_submodules_cb(struct diff_queue_struct *q,
|
||||||
struct diff_options *options,
|
struct diff_options *options UNUSED,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
struct collect_changed_submodules_cb_data *me = 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,
|
static void wt_status_collect_changed_cb(struct diff_queue_struct *q,
|
||||||
struct diff_options *options,
|
struct diff_options *options UNUSED,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
struct wt_status *s = 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,
|
static void wt_status_collect_updated_cb(struct diff_queue_struct *q,
|
||||||
struct diff_options *options,
|
struct diff_options *options UNUSED,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
struct wt_status *s = data;
|
struct wt_status *s = data;
|
||||||
|
|
Loading…
Reference in New Issue