Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/refs
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2022-08-25 20:09:48 +0300
committerJunio C Hamano <gitster@pobox.com>2022-09-01 20:49:48 +0300
commit5cf88fd8b059235b21ee2f72b17bf1f421a9c4e7 (patch)
tree03de8d4160649a0b4c1dd79164d746206743f25d /refs
parent776515ef8b381d49caeccfe2e8da98cb666e257a (diff)
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 'refs')
-rw-r--r--refs/files-backend.c14
-rw-r--r--refs/iterator.c6
-rw-r--r--refs/packed-backend.c16
3 files changed, 18 insertions, 18 deletions
diff --git a/refs/files-backend.c b/refs/files-backend.c
index 13bfdb7701..e4009b3c42 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -2202,8 +2202,8 @@ static int files_reflog_iterator_advance(struct ref_iterator *ref_iterator)
return ok;
}
-static int files_reflog_iterator_peel(struct ref_iterator *UNUSED(ref_iterator),
- struct object_id *UNUSED(peeled))
+static int files_reflog_iterator_peel(struct ref_iterator *ref_iterator UNUSED,
+ struct object_id *peeled UNUSED)
{
BUG("ref_iterator_peel() called for reflog_iterator");
}
@@ -2257,7 +2257,7 @@ static struct ref_iterator *reflog_iterator_begin(struct ref_store *ref_store,
static enum iterator_selection reflog_iterator_select(
struct ref_iterator *iter_worktree,
struct ref_iterator *iter_common,
- void *UNUSED(cb_data))
+ void *cb_data UNUSED)
{
if (iter_worktree) {
/*
@@ -2985,7 +2985,7 @@ cleanup:
static int files_transaction_abort(struct ref_store *ref_store,
struct ref_transaction *transaction,
- struct strbuf *UNUSED(err))
+ struct strbuf *err UNUSED)
{
struct files_ref_store *refs =
files_downcast(ref_store, 0, "ref_transaction_abort");
@@ -2995,8 +2995,8 @@ static int files_transaction_abort(struct ref_store *ref_store,
}
static int ref_present(const char *refname,
- const struct object_id *UNUSED(oid),
- int UNUSED(flags),
+ const struct object_id *oid UNUSED,
+ int flags UNUSED,
void *cb_data)
{
struct string_list *affected_refnames = cb_data;
@@ -3261,7 +3261,7 @@ static int files_reflog_expire(struct ref_store *ref_store,
return -1;
}
-static int files_init_db(struct ref_store *ref_store, struct strbuf *UNUSED(err))
+static int files_init_db(struct ref_store *ref_store, struct strbuf *err UNUSED)
{
struct files_ref_store *refs =
files_downcast(ref_store, REF_STORE_WRITE, "init_db");
diff --git a/refs/iterator.c b/refs/iterator.c
index e34921db72..c9fd0bcaf9 100644
--- a/refs/iterator.c
+++ b/refs/iterator.c
@@ -51,8 +51,8 @@ static int empty_ref_iterator_advance(struct ref_iterator *ref_iterator)
return ref_iterator_abort(ref_iterator);
}
-static int empty_ref_iterator_peel(struct ref_iterator *UNUSED(ref_iterator),
- struct object_id *UNUSED(peeled))
+static int empty_ref_iterator_peel(struct ref_iterator *ref_iterator UNUSED,
+ struct object_id *peeled UNUSED)
{
BUG("peel called for empty iterator");
}
@@ -238,7 +238,7 @@ struct ref_iterator *merge_ref_iterator_begin(
*/
static enum iterator_selection overlay_iterator_select(
struct ref_iterator *front, struct ref_iterator *back,
- void *UNUSED(cb_data))
+ void *cb_data UNUSED)
{
int cmp;
diff --git a/refs/packed-backend.c b/refs/packed-backend.c
index a45bb686f0..43cdb97f8b 100644
--- a/refs/packed-backend.c
+++ b/refs/packed-backend.c
@@ -726,7 +726,7 @@ static struct snapshot *get_snapshot(struct packed_ref_store *refs)
}
static int packed_read_raw_ref(struct ref_store *ref_store, const char *refname,
- struct object_id *oid, struct strbuf *UNUSED(referent),
+ struct object_id *oid, struct strbuf *referent UNUSED,
unsigned int *type, int *failure_errno)
{
struct packed_ref_store *refs =
@@ -1078,8 +1078,8 @@ int packed_refs_is_locked(struct ref_store *ref_store)
static const char PACKED_REFS_HEADER[] =
"# pack-refs with: peeled fully-peeled sorted \n";
-static int packed_init_db(struct ref_store *UNUSED(ref_store),
- struct strbuf *UNUSED(err))
+static int packed_init_db(struct ref_store *ref_store UNUSED,
+ struct strbuf *err UNUSED)
{
/* Nothing to do. */
return 0;
@@ -1474,7 +1474,7 @@ failure:
static int packed_transaction_abort(struct ref_store *ref_store,
struct ref_transaction *transaction,
- struct strbuf *UNUSED(err))
+ struct strbuf *err UNUSED)
{
struct packed_ref_store *refs = packed_downcast(
ref_store,
@@ -1513,7 +1513,7 @@ cleanup:
return ret;
}
-static int packed_initial_transaction_commit(struct ref_store *UNUSED(ref_store),
+static int packed_initial_transaction_commit(struct ref_store *ref_store UNUSED,
struct ref_transaction *transaction,
struct strbuf *err)
{
@@ -1569,8 +1569,8 @@ static int packed_delete_refs(struct ref_store *ref_store, const char *msg,
return ret;
}
-static int packed_pack_refs(struct ref_store *UNUSED(ref_store),
- unsigned int UNUSED(flags))
+static int packed_pack_refs(struct ref_store *ref_store UNUSED,
+ unsigned int flags UNUSED)
{
/*
* Packed refs are already packed. It might be that loose refs
@@ -1580,7 +1580,7 @@ static int packed_pack_refs(struct ref_store *UNUSED(ref_store),
return 0;
}
-static struct ref_iterator *packed_reflog_iterator_begin(struct ref_store *UNUSED(ref_store))
+static struct ref_iterator *packed_reflog_iterator_begin(struct ref_store *ref_store UNUSED)
{
return empty_ref_iterator_begin();
}