diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2022-08-25 17:09:48 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-09-01 17:49:48 (GMT) |
commit | 5cf88fd8b059235b21ee2f72b17bf1f421a9c4e7 (patch) | |
tree | 03de8d4160649a0b4c1dd79164d746206743f25d /builtin/remote.c | |
parent | 776515ef8b381d49caeccfe2e8da98cb666e257a (diff) | |
download | git-5cf88fd8b059235b21ee2f72b17bf1f421a9c4e7.zip git-5cf88fd8b059235b21ee2f72b17bf1f421a9c4e7.tar.gz git-5cf88fd8b059235b21ee2f72b17bf1f421a9c4e7.tar.bz2 |
git-compat-util.h: use "UNUSED", not "UNUSED(var)"
As reported in [1] the "UNUSED(var)" macro introduced in
2174b8c75de (Merge branch 'jk/unused-annotation' into next,
2022-08-24) breaks coccinelle's parsing of our sources in files where
it occurs.
Let's instead partially go with the approach suggested in [2] of
making this not take an argument. As noted in [1] "coccinelle" will
ignore such tokens in argument lists that it doesn't know about, and
it's less of a surprise to syntax highlighters.
This undoes the "help us notice when a parameter marked as unused is
actually use" part of 9b240347543 (git-compat-util: add UNUSED macro,
2022-08-19), a subsequent commit will further tweak the macro to
implement a replacement for that functionality.
1. https://lore.kernel.org/git/220825.86ilmg4mil.gmgdl@evledraar.gmail.com/
2. https://lore.kernel.org/git/220819.868rnk54ju.gmgdl@evledraar.gmail.com/
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/remote.c')
-rw-r--r-- | builtin/remote.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/builtin/remote.c b/builtin/remote.c index 87dda7c..24cd809 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -265,7 +265,7 @@ static const char *abbrev_ref(const char *name, const char *prefix) #define abbrev_branch(name) abbrev_ref((name), "refs/heads/") static int config_read_branches(const char *key, const char *value, - void *UNUSED(data)) + void *data UNUSED) { const char *orig_key = key; char *name; @@ -539,8 +539,8 @@ struct branches_for_remote { }; static int add_branch_for_removal(const char *refname, - const struct object_id *UNUSED(oid), - int UNUSED(flags), void *cb_data) + const struct object_id *oid UNUSED, + int flags UNUSED, void *cb_data) { struct branches_for_remote *branches = cb_data; struct refspec_item refspec; @@ -582,8 +582,8 @@ struct rename_info { }; static int read_remote_branches(const char *refname, - const struct object_id *UNUSED(oid), - int UNUSED(flags), void *cb_data) + const struct object_id *oid UNUSED, + int flags UNUSED, void *cb_data) { struct rename_info *rename = cb_data; struct strbuf buf = STRBUF_INIT; @@ -956,7 +956,7 @@ static void free_remote_ref_states(struct ref_states *states) } static int append_ref_to_tracked_list(const char *refname, - const struct object_id *UNUSED(oid), + const struct object_id *oid UNUSED, int flags, void *cb_data) { struct ref_states *states = cb_data; @@ -1486,7 +1486,7 @@ static int prune(int argc, const char **argv) return result; } -static int get_remote_default(const char *key, const char *UNUSED(value), void *priv) +static int get_remote_default(const char *key, const char *value UNUSED, void *priv) { if (strcmp(key, "remotes.default") == 0) { int *found = priv; |