{"thread":{"id":"58352","subject":"[PATCH] ci: update 'static-analysis' to Ubuntu 22.04","startedAt":"2022-08-23T19:06:25Z","lastAt":"2022-08-31T19:37:23Z","messageCount":26,"participants":["Derrick Stolee via GitGitGadget","Johannes Schindelin","Junio C Hamano","Derrick Stolee","Ævar Arnfjörð Bjarmason","Jeff King","SZEDER Gábor"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"461866","messageId":"pull.1334.git.1661275691795.gitgitgadget@gmail.com","threadId":"58352","inReplyTo":null,"subject":"[PATCH] ci: update 'static-analysis' to Ubuntu 22.04","fromName":"Derrick Stolee via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2022-08-23T17:28:11Z","receivedAt":"2022-08-23T19:06:25Z","isPatch":true,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"From: Derrick Stolee <derrickstolee@github.com>\n\nGitHub Actions scheduled a brownout of Ubuntu 18.04, which canceled all\nruns of the 'static-analysis' job in our CI runs. Update to 22.04 to\navoid this as the brownout later turns into a complete deprecation.\n\nThe use of 18.04 was set in d051ed77ee6 (.github/workflows/main.yml: run\nstatic-analysis on bionic, 2021-02-08) due to the lack of Coccinelle\nbeing available on 20.04 (which continues today).\n\nSigned-off-by: Derrick Stolee <derrickstolee@github.com>\n---\n    ci: update 'static-analysis' to Ubuntu 20.04\n    \n    I noticed this while preparing my bundle URIs series. See an example\n    cancellation at [1]\n    \n    [1]\n    https://github.com/gitgitgadget/git/runs/7954913465?check_suite_focus=true\n    \n    I initially asked about this [2]. Thanks to Matthias Aßhauer for\n    pointing out that 22.04 has Coccinelle available [3].\n    \n    [2]\n    https://lore.kernel.org/git/eb8779bc-fc41-f601-05f2-024e6bf3f316@github.com/\n    [3]\n    https://github.com/gitgitgadget/git/pull/1334#issuecomment-1223597655\n    \n    Thanks,\n    \n     * Stolee\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1334%2Fderrickstolee%2Fstatic-analysis-ubuntu-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1334/derrickstolee/static-analysis-ubuntu-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/1334\n\n .github/workflows/main.yml | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex cd1f52692a5..831f4df56c5 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -309,7 +309,7 @@ jobs:\n     if: needs.ci-config.outputs.enabled == 'yes'\n     env:\n       jobname: StaticAnalysis\n-    runs-on: ubuntu-18.04\n+    runs-on: ubuntu-22.04\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n\nbase-commit: 795ea8776befc95ea2becd8020c7a284677b4161\n-- \ngitgitgadget\n"},{"id":"461896","messageId":"r49psprs-4s48-p6q9-o3q9-37nnr3oq301o@tzk.qr","threadId":"58352","inReplyTo":"pull.1334.git.1661275691795.gitgitgadget@gmail.com","subject":"Re: [PATCH] ci: update 'static-analysis' to Ubuntu 22.04","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2022-08-24T14:40:18Z","receivedAt":"2022-08-24T14:40:34Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Stolee,\n\nOn Tue, 23 Aug 2022, Derrick Stolee via GitGitGadget wrote:\n\n> From: Derrick Stolee <derrickstolee@github.com>\n>\n> GitHub Actions scheduled a brownout of Ubuntu 18.04, which canceled all\n> runs of the 'static-analysis' job in our CI runs. Update to 22.04 to\n> avoid this as the brownout later turns into a complete deprecation.\n>\n> The use of 18.04 was set in d051ed77ee6 (.github/workflows/main.yml: run\n> static-analysis on bionic, 2021-02-08) due to the lack of Coccinelle\n> being available on 20.04 (which continues today).\n\nACK!\n\n>\n> Signed-off-by: Derrick Stolee <derrickstolee@github.com>\n> ---\n>     ci: update 'static-analysis' to Ubuntu 20.04\n>\n>     I noticed this while preparing my bundle URIs series. See an example\n>     cancellation at [1]\n>\n>     [1]\n>     https://github.com/gitgitgadget/git/runs/7954913465?check_suite_focus=true\n>\n>     I initially asked about this [2]. Thanks to Matthias Aßhauer for\n>     pointing out that 22.04 has Coccinelle available [3].\n>\n>     [2]\n>     https://lore.kernel.org/git/eb8779bc-fc41-f601-05f2-024e6bf3f316@github.com/\n>     [3]\n>     https://github.com/gitgitgadget/git/pull/1334#issuecomment-1223597655\n\nThis can be verified also by looking at the successful `static-analysis`\nrun at\nhttps://github.com/gitgitgadget/git/runs/7979368539?check_suite_focus=true\n(which is part of the PR/CI runs at\nhttps://github.com/gitgitgadget/git/pull/1334/checks).\n\nThanks,\nDscho\n\n>\n>     Thanks,\n>\n>      * Stolee\n>\n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1334%2Fderrickstolee%2Fstatic-analysis-ubuntu-v1\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1334/derrickstolee/static-analysis-ubuntu-v1\n> Pull-Request: https://github.com/gitgitgadget/git/pull/1334\n>\n>  .github/workflows/main.yml | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\n> index cd1f52692a5..831f4df56c5 100644\n> --- a/.github/workflows/main.yml\n> +++ b/.github/workflows/main.yml\n> @@ -309,7 +309,7 @@ jobs:\n>      if: needs.ci-config.outputs.enabled == 'yes'\n>      env:\n>        jobname: StaticAnalysis\n> -    runs-on: ubuntu-18.04\n> +    runs-on: ubuntu-22.04\n>      steps:\n>      - uses: actions/checkout@v2\n>      - run: ci/install-dependencies.sh\n>\n> base-commit: 795ea8776befc95ea2becd8020c7a284677b4161\n> --\n> gitgitgadget\n>\n"},{"id":"461909","messageId":"xmqq1qt576px.fsf@gitster.g","threadId":"58352","inReplyTo":"r49psprs-4s48-p6q9-o3q9-37nnr3oq301o@tzk.qr","subject":"Re: [PATCH] ci: update 'static-analysis' to Ubuntu 22.04","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-08-24T19:59:54Z","receivedAt":"2022-08-24T20:00:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> Hi Stolee,\n>\n> On Tue, 23 Aug 2022, Derrick Stolee via GitGitGadget wrote:\n>\n>> From: Derrick Stolee <derrickstolee@github.com>\n>>\n>> GitHub Actions scheduled a brownout of Ubuntu 18.04, which canceled all\n>> runs of the 'static-analysis' job in our CI runs. Update to 22.04 to\n>> avoid this as the brownout later turns into a complete deprecation.\n>>\n>> The use of 18.04 was set in d051ed77ee6 (.github/workflows/main.yml: run\n>> static-analysis on bionic, 2021-02-08) due to the lack of Coccinelle\n>> being available on 20.04 (which continues today).\n>\n> ACK!\n\nYup, this is probably a good move.  We tend to stay away from\nbleeding edge and instead pick a representative one that is likely\nto be with our real users, but 22.04 by no means is one.\n\nI guess we would want to do this even down to 'maint'?\n\nThanks, both.\n"},{"id":"461928","messageId":"xmqqwnax438x.fsf@gitster.g","threadId":"58352","inReplyTo":"pull.1334.git.1661275691795.gitgitgadget@gmail.com","subject":"Re: [PATCH] ci: update 'static-analysis' to Ubuntu 22.04","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-08-24T23:43:10Z","receivedAt":"2022-08-24T23:43:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Derrick Stolee via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: Derrick Stolee <derrickstolee@github.com>\n>\n> GitHub Actions scheduled a brownout of Ubuntu 18.04, which canceled all\n> runs of the 'static-analysis' job in our CI runs. Update to 22.04 to\n> avoid this as the brownout later turns into a complete deprecation.\n>\n> The use of 18.04 was set in d051ed77ee6 (.github/workflows/main.yml: run\n> static-analysis on bionic, 2021-02-08) due to the lack of Coccinelle\n> being available on 20.04 (which continues today).\n>\n> Signed-off-by: Derrick Stolee <derrickstolee@github.com>\n> ---\n>     ci: update 'static-analysis' to Ubuntu 20.04\n>     \n>     I noticed this while preparing my bundle URIs series. See an example\n>     cancellation at [1]\n>     \n>     [1]\n>     https://github.com/gitgitgadget/git/runs/7954913465?check_suite_focus=true\n>     \n>     I initially asked about this [2]. Thanks to Matthias Aßhauer for\n>     pointing out that 22.04 has Coccinelle available [3].\n\nThanks, it is already paying its dividend, it seems.\n\nWe probably need to fix or revert/remove rules we have in\nunused.cocci that makes bogus \"suggestion\".\n\n  https://github.com/git/git/runs/8005321972?check_suite_focus=true\n\n"},{"id":"461931","messageId":"7364f631-e05b-0db8-aaa4-9f0101b6db56@github.com","threadId":"58352","inReplyTo":"xmqqwnax438x.fsf@gitster.g","subject":"Re: [PATCH] ci: update 'static-analysis' to Ubuntu 22.04","fromName":"Derrick Stolee","fromEmail":"derrickstolee@github.com","sentAt":"2022-08-25T00:30:51Z","receivedAt":"2022-08-25T00:30:58Z","isPatch":true,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"On 8/24/22 7:43 PM, Junio C Hamano wrote:\n> \"Derrick Stolee via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n> \n>> From: Derrick Stolee <derrickstolee@github.com>\n>>\n>> GitHub Actions scheduled a brownout of Ubuntu 18.04, which canceled all\n>> runs of the 'static-analysis' job in our CI runs. Update to 22.04 to\n>> avoid this as the brownout later turns into a complete deprecation.\n>>\n>> The use of 18.04 was set in d051ed77ee6 (.github/workflows/main.yml: run\n>> static-analysis on bionic, 2021-02-08) due to the lack of Coccinelle\n>> being available on 20.04 (which continues today).\n>>\n>> Signed-off-by: Derrick Stolee <derrickstolee@github.com>\n>> ---\n>>     ci: update 'static-analysis' to Ubuntu 20.04\n>>     \n>>     I noticed this while preparing my bundle URIs series. See an example\n>>     cancellation at [1]\n>>     \n>>     [1]\n>>     https://github.com/gitgitgadget/git/runs/7954913465?check_suite_focus=true\n>>     \n>>     I initially asked about this [2]. Thanks to Matthias Aßhauer for\n>>     pointing out that 22.04 has Coccinelle available [3].\n> \n> Thanks, it is already paying its dividend, it seems.\n> \n> We probably need to fix or revert/remove rules we have in\n> unused.cocci that makes bogus \"suggestion\".\n> \n>   https://github.com/git/git/runs/8005321972?check_suite_focus=true\n\nYes, this is definitely a bogus suggestion. It's probable that it\nis picked up by the newer version of Coccinelle.\n\nI would recommend removing unused.cocci in a patch after this one,\nand then you can apply both into 'maint'.\n\nPerhaps a careful rewrite of unused.cocci could fix these kind of\nsuggestions using the latest version of Coccinelle, but now is not\nthe time to wait for that.\n\nThanks,\n-Stolee\n"},{"id":"461933","messageId":"xmqqfshl3pbp.fsf@gitster.g","threadId":"58352","inReplyTo":"7364f631-e05b-0db8-aaa4-9f0101b6db56@github.com","subject":"Re: [PATCH] ci: update 'static-analysis' to Ubuntu 22.04","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-08-25T04:43:54Z","receivedAt":"2022-08-25T04:43:59Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Derrick Stolee <derrickstolee@github.com> writes:\n\n>> We probably need to fix or revert/remove rules we have in\n>> unused.cocci that makes bogus \"suggestion\".\n>> \n>>   https://github.com/git/git/runs/8005321972?check_suite_focus=true\n>\n> Yes, this is definitely a bogus suggestion. It's probable that it\n> is picked up by the newer version of Coccinelle.\n\nYes, I think we should tentatively disable the offending one until\nwe know how to properly \"fix\" it.\n"},{"id":"461946","messageId":"220825.86ilmg4mil.gmgdl@evledraar.gmail.com","threadId":"58352","inReplyTo":"xmqqfshl3pbp.fsf@gitster.g","subject":"Re: [PATCH] ci: update 'static-analysis' to Ubuntu 22.04","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-08-25T10:47:53Z","receivedAt":"2022-08-25T10:59:18Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Wed, Aug 24 2022, Junio C Hamano wrote:\n\n> Derrick Stolee <derrickstolee@github.com> writes:\n>\n>>> We probably need to fix or revert/remove rules we have in\n>>> unused.cocci that makes bogus \"suggestion\".\n>>> \n>>>   https://github.com/git/git/runs/8005321972?check_suite_focus=true\n>>\n>> Yes, this is definitely a bogus suggestion. It's probable that it\n>> is picked up by the newer version of Coccinelle.\n>\n> Yes, I think we should tentatively disable the offending one until\n> we know how to properly \"fix\" it.\n\nI'm seeing this relatively late, it would be nice to get a CC on\ndiscussions of of one's code :)\n\nThis is indeed completely broken, but it's not the unused.cocci rule\nthat's broken.\n\nWhat's happening here is that coccinelle can no longer properly parse\nthe file after the UNUSED() macros were applied to refs.c.\n\nTry running with \"--verbose-match --verbose-parsing\", on\n\"seen\". Deleting the UNUSED() from warn_if_dangling_symref() happens to\n\"fix\" it, but it's only working as a result of some hack. Coccinelle is\nrunning into some unbalanced paren issue, and it happens to balance out\nwith that.\n\nI don't think there's any issue here in unused.cocci, it just happens to\nbe the rule that's unlucky enough to fire like that in the face of these\nparse errors.\n\nWe should probably coerce coccinelle into stopping in general if it's\nencountering \"BAD:!!!!!\" parse errors behind the scenes, as it clearly\nresults in broken logic, but offhand (and from briefly browsing the\nmanpage) I don't know a way to do that.\n\nBut the fix here isn't to delete unused.cocci, but to hold off on the\nUNUSEwork D() patches until we figure out how to make coccinelle jive with\nthem.\n\nOne thing that *would* fix it is to go with the approach I suggested in\nhttps://lore.kernel.org/git/220819.868rnk54ju.gmgdl@evledraar.gmail.com/,\ni.e. to not use an \"UNUSED(var)\" form, but just \"UNUSED\".\n\nI tried that just now with this hack, which wouldn't even compile with\nthe compiler, but coccinelle is seemingly smart enough to ignore unknown\ntokens it doesn't know about if they're not introducing parens (i.e. I\ndidn't even have to define UNUSED2).\n\nIt's also not that it punted out entirely, with this changing\nrefs_verify_refname_available() so that \"referent\" actually isn't unused\nfor real would have unused.cocci suggest the same removal, so we're\nmanaging to fully apply rules to the file:\n\t\n\tdiff --git a/refs.c b/refs.c\n\tindex 607694c2662..37e7d88920c 100644\n\t--- a/refs.c\n\t+++ b/refs.c\n\t@@ -442,7 +442,7 @@ struct warn_if_dangling_data {\n\t };\n\t \n\t static int warn_if_dangling_symref(const char *refname,\n\t-\t\t\t\t   const struct object_id *UNUSED(oid),\n\t+\t\t\t\t   const struct object_id *oid UNUSED2,\n\t \t\t\t\t   int flags, void *cb_data)\n\t {\n\t \tstruct warn_if_dangling_data *d = cb_data;\n\t@@ -982,7 +982,7 @@ static void set_read_ref_cutoffs(struct read_ref_at_cb *cb,\n\t }\n\t \n\t static int read_ref_at_ent(struct object_id *ooid, struct object_id *noid,\n\t-\t\t\t   const char *UNUSED(email),\n\t+\t\t\t   const char *email UNUSED2,\n\t \t\t\t   timestamp_t timestamp, int tz,\n\t \t\t\t   const char *message, void *cb_data)\n\t {\n\t@@ -1024,9 +1024,9 @@ static int read_ref_at_ent(struct object_id *ooid, struct object_id *noid,\n\t \treturn cb->found_it;\n\t }\n\t \n\t-static int read_ref_at_ent_newest(struct object_id *UNUSED(ooid),\n\t+static int read_ref_at_ent_newest(struct object_id *ooid UNUSED2,\n\t \t\t\t\t  struct object_id *noid,\n\t-\t\t\t\t  const char *UNUSED(email),\n\t+\t\t\t\t  const char *email UNUSED2,\n\t \t\t\t\t  timestamp_t timestamp, int tz,\n\t \t\t\t\t  const char *message, void *cb_data)\n\t {\n\t@@ -1039,7 +1039,7 @@ static int read_ref_at_ent_newest(struct object_id *UNUSED(ooid),\n\t }\n\t \n\t static int read_ref_at_ent_oldest(struct object_id *ooid, struct object_id *noid,\n\t-\t\t\t\t  const char *UNUSED(email),\n\t+\t\t\t\t  const char *email UNUSED2,\n\t \t\t\t\t  timestamp_t timestamp, int tz,\n\t \t\t\t\t  const char *message, void *cb_data)\n\t {\n\t@@ -1904,7 +1904,7 @@ struct ref_store_hash_entry\n\t \tchar name[FLEX_ARRAY];\n\t };\n\t \n\t-static int ref_store_hash_cmp(const void *UNUSED(cmp_data),\n\t+static int ref_store_hash_cmp(const void *cmp_data UNUSED2,\n\t \t\t\t      const struct hashmap_entry *eptr,\n\t \t\t\t      const struct hashmap_entry *entry_or_key,\n\t \t\t\t      const void *keydata)\n\t\n"},{"id":"461956","messageId":"220825.865yig4bd7.gmgdl@evledraar.gmail.com","threadId":"58352","inReplyTo":"pull.1334.git.1661275691795.gitgitgadget@gmail.com","subject":"Re: [PATCH] ci: update 'static-analysis' to Ubuntu 22.04","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-08-25T14:57:35Z","receivedAt":"2022-08-25T15:00:12Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Tue, Aug 23 2022, Derrick Stolee via GitGitGadget wrote:\n\n> From: Derrick Stolee <derrickstolee@github.com>\n>\n> GitHub Actions scheduled a brownout of Ubuntu 18.04, which canceled all\n> runs of the 'static-analysis' job in our CI runs. Update to 22.04 to\n> avoid this as the brownout later turns into a complete deprecation.\n>\n> The use of 18.04 was set in d051ed77ee6 (.github/workflows/main.yml: run\n> static-analysis on bionic, 2021-02-08) due to the lack of Coccinelle\n> being available on 20.04 (which continues today).\n>\n> Signed-off-by: Derrick Stolee <derrickstolee@github.com>\n> ---\n>     ci: update 'static-analysis' to Ubuntu 20.04\n>     \n>     I noticed this while preparing my bundle URIs series. See an example\n>     cancellation at [1]\n>     \n>     [1]\n>     https://github.com/gitgitgadget/git/runs/7954913465?check_suite_focus=true\n>     \n>     I initially asked about this [2]. Thanks to Matthias Aßhauer for\n>     pointing out that 22.04 has Coccinelle available [3].\n>     \n>     [2]\n>     https://lore.kernel.org/git/eb8779bc-fc41-f601-05f2-024e6bf3f316@github.com/\n>     [3]\n>     https://github.com/gitgitgadget/git/pull/1334#issuecomment-1223597655\n>     \n>     Thanks,\n>     \n>      * Stolee\n>\n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1334%2Fderrickstolee%2Fstatic-analysis-ubuntu-v1\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1334/derrickstolee/static-analysis-ubuntu-v1\n> Pull-Request: https://github.com/gitgitgadget/git/pull/1334\n>\n>  .github/workflows/main.yml | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\n> index cd1f52692a5..831f4df56c5 100644\n> --- a/.github/workflows/main.yml\n> +++ b/.github/workflows/main.yml\n> @@ -309,7 +309,7 @@ jobs:\n>      if: needs.ci-config.outputs.enabled == 'yes'\n>      env:\n>        jobname: StaticAnalysis\n> -    runs-on: ubuntu-18.04\n> +    runs-on: ubuntu-22.04\n\nI think it's worth mentioning in the commit message that the reason\nwe're not going for \"ubuntu-latest\" here is because \"latest\" is a\nmisnomer, it's not the \"latest\", but \"latest-stable\" or\nwhatever. I.e. it's pointing to 20.04 currently:\n\n\thttps://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources\n\nI think per\nhttps://lore.kernel.org/git/211104.86v918i78r.gmgdl@evledraar.gmail.com/\nthat we should pin these in general, but you/Junio disagreed at the\ntime. So maybe a commit message change/comment here noting \"# make this\nubuntu-latest once it's ubuntu-22.04 or later\" or something would make\nthe intent clearer.\n\nAlso: for \"sparse\" didn't we miss doing that, i.e. it's pinned on\nubuntu-20.04 explicitly, but surely that should be \"ubuntu-latest\" now?\n"},{"id":"461958","messageId":"xmqq1qt4486e.fsf@gitster.g","threadId":"58352","inReplyTo":"220825.86ilmg4mil.gmgdl@evledraar.gmail.com","subject":"Re: [PATCH] ci: update 'static-analysis' to Ubuntu 22.04","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-08-25T16:08:57Z","receivedAt":"2022-08-25T16:09:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n\n> What's happening here is that coccinelle can no longer properly parse\n> the file after the UNUSED() macros were applied to refs.c.\n\nSigh.\n\n> \tdiff --git a/refs.c b/refs.c\n> \tindex 607694c2662..37e7d88920c 100644\n> \t--- a/refs.c\n> \t+++ b/refs.c\n> \t@@ -442,7 +442,7 @@ struct warn_if_dangling_data {\n> \t };\n> \t \n> \t static int warn_if_dangling_symref(const char *refname,\n> \t-\t\t\t\t   const struct object_id *UNUSED(oid),\n> \t+\t\t\t\t   const struct object_id *oid UNUSED2,\n> \t \t\t\t\t   int flags, void *cb_data)\n> \t {\n> \t \tstruct warn_if_dangling_data *d = cb_data;\n\nThis is almost \"the most simple and stupid and nobody would get\nconfused\" version, which I may actually be able to live with.\n\nUnfortunately it will not get the \"somebody by mistake uses 'oid'\nand we can break the build no matter what compiler is used by them\nbefore sending the patch out to the list\".\n\nDoing s/oid UNUSED2/oid_UNUSED/ without any __attribute__((unused))\nwould give that benefit to us, but that won't squelch compilation\nwith -Wunused which makes it a non-starter.\n"},{"id":"461959","messageId":"xmqqwnaw2t7t.fsf@gitster.g","threadId":"58352","inReplyTo":"220825.865yig4bd7.gmgdl@evledraar.gmail.com","subject":"Re: [PATCH] ci: update 'static-analysis' to Ubuntu 22.04","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-08-25T16:17:26Z","receivedAt":"2022-08-25T16:17:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n\n>> -    runs-on: ubuntu-18.04\n>> +    runs-on: ubuntu-22.04\n>\n> I think it's worth mentioning in the commit message that the reason\n> we're not going for \"ubuntu-latest\" here is because \"latest\" is a\n> misnomer, it's not the \"latest\", but \"latest-stable\" or\n> whatever.\n\nI think we are naming an exact version because we do not want what\nit means to change under us until the situation stabilizes.  \n\nIf we know that the version after 22.04 that will become \"latest\" is\nalready reasonable when 22.04 (or later) becomes the \"latest\", maybe\nwe decide to use \"latest\", but I suspect that right now is not the\ntime to do that (yet).  We just have proposed to go to 22.04 and\nhaven't even used it long enough.\n\n\n"},{"id":"461964","messageId":"cover-0.2-00000000000-20220825T170709Z-avarab@gmail.com","threadId":"58352","inReplyTo":"xmqq1qt4486e.fsf@gitster.g","subject":"[PATCH 0/2] git-compat-util.h: change UNUSED(var) to UNUSED","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-08-25T17:09:47Z","receivedAt":"2022-08-25T17:10:01Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Thu, Aug 25 2022, Junio C Hamano wrote:\n\n> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n>\n>> What's happening here is that coccinelle can no longer properly parse\n>> the file after the UNUSED() macros were applied to refs.c.\n>\n> Sigh.\n>\n>>      diff --git a/refs.c b/refs.c\n>>      index 607694c2662..37e7d88920c 100644\n>>      --- a/refs.c\n>>      +++ b/refs.c\n>>      @@ -442,7 +442,7 @@ struct warn_if_dangling_data {\n>>       };\n>>\n>>       static int warn_if_dangling_symref(const char *refname,\n>>      -                                  const struct object_id *UNUSED(oid),\n>>      +                                  const struct object_id *oid UNUSED2,\n>>                                         int flags, void *cb_data)\n>>       {\n>>              struct warn_if_dangling_data *d = cb_data;\n>\n> This is almost \"the most simple and stupid and nobody would get\n> confused\" version, which I may actually be able to live with.\n>\n> Unfortunately it will not get the \"somebody by mistake uses 'oid'\n> and we can break the build no matter what compiler is used by them\n> before sending the patch out to the list\".\n>\n> Doing s/oid UNUSED2/oid_UNUSED/ without any __attribute__((unused))\n> would give that benefit to us, but that won't squelch compilation\n> with -Wunused which makes it a non-starter.\n\nI think per the 2/2 that it should be OK, but if you still think it's\na non-starter we'll need some other approach.\n\nWhen I merge this with \"seen\" it suggests no \"unused.cocci\" changes to\nrefs.c anymore, i.e. it unbroke the interaction between the UNUSED\ntopic in next and the change that happened to reveal it.\n\nÆvar Arnfjörð Bjarmason (2):\n  git-compat-util.h: use \"UNUSED\", not \"UNUSED(var)\"\n  git-compat-util.h: use \"deprecated\" for UNUSED variables\n\n add-interactive.c           |  2 +-\n archive-tar.c               |  4 ++--\n archive-zip.c               |  4 ++--\n archive.c                   |  2 +-\n attr.c                      |  4 ++--\n bisect.c                    |  6 +++---\n bloom.c                     |  4 ++--\n builtin/am.c                |  2 +-\n builtin/bisect--helper.c    | 12 ++++++------\n builtin/checkout.c          |  4 ++--\n builtin/commit-graph.c      |  2 +-\n builtin/config.c            |  6 +++---\n builtin/describe.c          |  4 ++--\n builtin/difftool.c          | 10 +++++-----\n builtin/fast-export.c       |  2 +-\n builtin/fast-import.c       |  2 +-\n builtin/fetch.c             |  8 ++++----\n builtin/fsck.c              | 12 ++++++------\n builtin/gc.c                |  4 ++--\n builtin/log.c               |  4 ++--\n builtin/ls-tree.c           | 10 +++++-----\n builtin/multi-pack-index.c  |  2 +-\n builtin/name-rev.c          |  2 +-\n builtin/pack-objects.c      | 12 ++++++------\n builtin/receive-pack.c      |  4 ++--\n builtin/reflog.c            |  4 ++--\n builtin/remote.c            | 14 +++++++-------\n builtin/repack.c            |  4 ++--\n builtin/rev-parse.c         |  4 ++--\n builtin/show-branch.c       |  6 +++---\n builtin/show-ref.c          |  6 +++---\n builtin/stash.c             | 12 ++++++------\n builtin/submodule--helper.c |  4 ++--\n color.c                     |  2 +-\n commit-graph.c              |  4 ++--\n commit.c                    |  6 +++---\n compat/terminal.c           |  2 +-\n config.c                    |  8 ++++----\n convert.c                   |  4 ++--\n delta-islands.c             |  4 ++--\n diff.c                      |  4 ++--\n dir.c                       |  4 ++--\n environment.c               |  4 ++--\n fetch-pack.c                | 12 ++++++------\n git-compat-util.h           | 13 +++++++------\n gpg-interface.c             |  2 +-\n hashmap.c                   | 10 +++++-----\n help.c                      |  4 ++--\n http-backend.c              |  2 +-\n ident.c                     |  2 +-\n ll-merge.c                  |  2 +-\n log-tree.c                  |  2 +-\n ls-refs.c                   |  2 +-\n merge-recursive.c           | 12 ++++++------\n name-hash.c                 |  4 ++--\n negotiator/default.c        |  4 ++--\n negotiator/skipping.c       |  4 ++--\n notes.c                     |  4 ++--\n object-name.c               | 12 ++++++------\n object-store.h              |  2 +-\n oidmap.c                    |  2 +-\n packfile.c                  |  2 +-\n pager.c                     |  2 +-\n patch-ids.c                 |  2 +-\n pretty.c                    |  2 +-\n range-diff.c                |  2 +-\n ref-filter.c                |  2 +-\n reflog.c                    | 18 +++++++++---------\n refs.c                      | 12 ++++++------\n refs/files-backend.c        | 14 +++++++-------\n refs/iterator.c             |  6 +++---\n refs/packed-backend.c       | 16 ++++++++--------\n remote.c                    | 24 ++++++++++++------------\n replace-object.c            |  4 ++--\n revision.c                  | 18 +++++++++---------\n send-pack.c                 |  2 +-\n sequencer.c                 |  4 ++--\n server-info.c               |  2 +-\n shallow.c                   | 10 +++++-----\n strbuf.c                    |  2 +-\n streaming.c                 |  6 +++---\n strmap.c                    |  4 ++--\n sub-process.c               |  4 ++--\n submodule-config.c          |  8 ++++----\n submodule.c                 | 12 ++++++------\n t/helper/test-config.c      |  2 +-\n t/helper/test-ref-store.c   |  4 ++--\n t/helper/test-userdiff.c    |  2 +-\n trailer.c                   |  4 ++--\n transport.c                 |  2 +-\n upload-pack.c               |  6 +++---\n walker.c                    |  6 +++---\n wt-status.c                 | 16 ++++++++--------\n 93 files changed, 270 insertions(+), 269 deletions(-)\n\n-- \n2.37.2.1279.g8741a0e3ea3\n\n"},{"id":"461965","messageId":"patch-2.2-0f603594e5e-20220825T170709Z-avarab@gmail.com","threadId":"58352","inReplyTo":"cover-0.2-00000000000-20220825T170709Z-avarab@gmail.com","subject":"[PATCH 2/2] git-compat-util.h: use \"deprecated\" for UNUSED variables","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-08-25T17:09:49Z","receivedAt":"2022-08-25T17:10:16Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"As noted in the preceding commit our \"UNUSED\" macro was no longer\nprotecting against actual use of the \"unused\" variables, which it was\npreviously doing by renaming the variable.\n\nLet's instead use the \"deprecated\" attribute to accomplish that\ngoal. As [1] rightly notes this has the drawback that compiling with\n\"-Wno-deprecated-declarations\" will silence any such uses. I think the\ntrade-off is worth it as:\n\n * We can consider that a feature, as e.g. backporting certain patches\n   might use a now \"unused\" parameter, and the person doing that might\n   want to silence it with DEVOPTS=no-error.\n\n * This way we play nicely with coccinelle, and any other dumb(er)\n   parser of C (such as syntax highlighters).\n\n * Not every single compilation of git needs to catch \"used but\n   declared unused\" parameters. It's sufficient that the default \"make\n   DEVELOPER=1\" will do so, and that the \"static-analysis\" CI job will\n   catch it.\n\n1. https://lore.kernel.org/git/YwCtkwjWdJVHHZV0@coredump.intra.peff.net/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n git-compat-util.h | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex 5ea7be97493..71a004be409 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -190,7 +190,8 @@ struct strbuf;\n #define _SGI_SOURCE 1\n \n #if defined(__GNUC__)\n-#define UNUSED __attribute__((unused))\n+#define UNUSED __attribute__((unused)) \\\n+\t__attribute__((deprecated (\"parameter declared as UNUSED\")))\n #else\n #define UNUSED\n #endif\n-- \n2.37.2.1279.g8741a0e3ea3\n\n"},{"id":"461966","messageId":"patch-1.2-b99c08903ad-20220825T170709Z-avarab@gmail.com","threadId":"58352","inReplyTo":"cover-0.2-00000000000-20220825T170709Z-avarab@gmail.com","subject":"[PATCH 1/2] git-compat-util.h: use \"UNUSED\", not \"UNUSED(var)\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-08-25T17:09:48Z","receivedAt":"2022-08-25T17:10:18Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"As reported in [1] the \"UNUSED(var)\" macro introduced in\n2174b8c75de (Merge branch 'jk/unused-annotation' into next,\n2022-08-24) breaks coccinelle's parsing of our sources in files where\nit occurs.\n\nLet's instead partially go with the approach suggested in [2] of\nmaking this not take an argument. As noted in [1] \"coccinelle\" will\nignore such tokens in argument lists that it doesn't know about, and\nit's less of a surprise to syntax highlighters.\n\nThis undoes the \"help us notice when a parameter marked as unused is\nactually use\" part of 9b240347543 (git-compat-util: add UNUSED macro,\n2022-08-19), a subsequent commit will further tweak the macro to\nimplement a replacement for that functionality.\n\n1. https://lore.kernel.org/git/220825.86ilmg4mil.gmgdl@evledraar.gmail.com/\n2. https://lore.kernel.org/git/220819.868rnk54ju.gmgdl@evledraar.gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n add-interactive.c           |  2 +-\n archive-tar.c               |  4 ++--\n archive-zip.c               |  4 ++--\n archive.c                   |  2 +-\n attr.c                      |  4 ++--\n bisect.c                    |  6 +++---\n bloom.c                     |  4 ++--\n builtin/am.c                |  2 +-\n builtin/bisect--helper.c    | 12 ++++++------\n builtin/checkout.c          |  4 ++--\n builtin/commit-graph.c      |  2 +-\n builtin/config.c            |  6 +++---\n builtin/describe.c          |  4 ++--\n builtin/difftool.c          | 10 +++++-----\n builtin/fast-export.c       |  2 +-\n builtin/fast-import.c       |  2 +-\n builtin/fetch.c             |  8 ++++----\n builtin/fsck.c              | 12 ++++++------\n builtin/gc.c                |  4 ++--\n builtin/log.c               |  4 ++--\n builtin/ls-tree.c           | 10 +++++-----\n builtin/multi-pack-index.c  |  2 +-\n builtin/name-rev.c          |  2 +-\n builtin/pack-objects.c      | 12 ++++++------\n builtin/receive-pack.c      |  4 ++--\n builtin/reflog.c            |  4 ++--\n builtin/remote.c            | 14 +++++++-------\n builtin/repack.c            |  4 ++--\n builtin/rev-parse.c         |  4 ++--\n builtin/show-branch.c       |  6 +++---\n builtin/show-ref.c          |  6 +++---\n builtin/stash.c             | 12 ++++++------\n builtin/submodule--helper.c |  4 ++--\n color.c                     |  2 +-\n commit-graph.c              |  4 ++--\n commit.c                    |  6 +++---\n compat/terminal.c           |  2 +-\n config.c                    |  8 ++++----\n convert.c                   |  4 ++--\n delta-islands.c             |  4 ++--\n diff.c                      |  4 ++--\n dir.c                       |  4 ++--\n environment.c               |  4 ++--\n fetch-pack.c                | 12 ++++++------\n git-compat-util.h           | 12 ++++++------\n gpg-interface.c             |  2 +-\n hashmap.c                   | 10 +++++-----\n help.c                      |  4 ++--\n http-backend.c              |  2 +-\n ident.c                     |  2 +-\n ll-merge.c                  |  2 +-\n log-tree.c                  |  2 +-\n ls-refs.c                   |  2 +-\n merge-recursive.c           | 12 ++++++------\n name-hash.c                 |  4 ++--\n negotiator/default.c        |  4 ++--\n negotiator/skipping.c       |  4 ++--\n notes.c                     |  4 ++--\n object-name.c               | 12 ++++++------\n object-store.h              |  2 +-\n oidmap.c                    |  2 +-\n packfile.c                  |  2 +-\n pager.c                     |  2 +-\n patch-ids.c                 |  2 +-\n pretty.c                    |  2 +-\n range-diff.c                |  2 +-\n ref-filter.c                |  2 +-\n reflog.c                    | 18 +++++++++---------\n refs.c                      | 12 ++++++------\n refs/files-backend.c        | 14 +++++++-------\n refs/iterator.c             |  6 +++---\n refs/packed-backend.c       | 16 ++++++++--------\n remote.c                    | 24 ++++++++++++------------\n replace-object.c            |  4 ++--\n revision.c                  | 18 +++++++++---------\n send-pack.c                 |  2 +-\n sequencer.c                 |  4 ++--\n server-info.c               |  2 +-\n shallow.c                   | 10 +++++-----\n strbuf.c                    |  2 +-\n streaming.c                 |  6 +++---\n strmap.c                    |  4 ++--\n sub-process.c               |  4 ++--\n submodule-config.c          |  8 ++++----\n submodule.c                 | 12 ++++++------\n t/helper/test-config.c      |  2 +-\n t/helper/test-ref-store.c   |  4 ++--\n t/helper/test-userdiff.c    |  2 +-\n trailer.c                   |  4 ++--\n transport.c                 |  2 +-\n upload-pack.c               |  6 +++---\n walker.c                    |  6 +++---\n wt-status.c                 | 16 ++++++++--------\n 93 files changed, 269 insertions(+), 269 deletions(-)\n\ndiff --git a/add-interactive.c b/add-interactive.c\nindex 2fcad676544..f071b2a1b4f 100644\n--- a/add-interactive.c\n+++ b/add-interactive.c\n@@ -430,7 +430,7 @@ struct pathname_entry {\n \tstruct file_item *item;\n };\n \n-static int pathname_entry_cmp(const void *UNUSED(cmp_data),\n+static int pathname_entry_cmp(const void *cmp_data UNUSED,\n \t\t\t      const struct hashmap_entry *he1,\n \t\t\t      const struct hashmap_entry *he2,\n \t\t\t      const void *name)\ndiff --git a/archive-tar.c b/archive-tar.c\nindex 0d66a1e0a85..3e4822b6840 100644\n--- a/archive-tar.c\n+++ b/archive-tar.c\n@@ -367,7 +367,7 @@ static struct archiver *find_tar_filter(const char *name, size_t len)\n }\n \n static int tar_filter_config(const char *var, const char *value,\n-\t\t\t     void *UNUSED(data))\n+\t\t\t     void *data UNUSED)\n {\n \tstruct archiver *ar;\n \tconst char *name;\n@@ -421,7 +421,7 @@ static int git_tar_config(const char *var, const char *value, void *cb)\n \treturn tar_filter_config(var, value, cb);\n }\n \n-static int write_tar_archive(const struct archiver *UNUSED(ar),\n+static int write_tar_archive(const struct archiver *ar UNUSED,\n \t\t\t     struct archiver_args *args)\n {\n \tint err = 0;\ndiff --git a/archive-zip.c b/archive-zip.c\nindex d63782dc31b..0456f1ebf15 100644\n--- a/archive-zip.c\n+++ b/archive-zip.c\n@@ -613,12 +613,12 @@ static void dos_time(timestamp_t *timestamp, int *dos_date, int *dos_time)\n }\n \n static int archive_zip_config(const char *var, const char *value,\n-\t\t\t      void *UNUSED(data))\n+\t\t\t      void *data UNUSED)\n {\n \treturn userdiff_config(var, value);\n }\n \n-static int write_zip_archive(const struct archiver *UNUSED(ar),\n+static int write_zip_archive(const struct archiver *ar UNUSED,\n \t\t\t     struct archiver_args *args)\n {\n \tint err;\ndiff --git a/archive.c b/archive.c\nindex 8b165e935bd..61a79e4a227 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -382,7 +382,7 @@ struct path_exists_context {\n \tstruct archiver_args *args;\n };\n \n-static int reject_entry(const struct object_id *UNUSED(oid),\n+static int reject_entry(const struct object_id *oid UNUSED,\n \t\t\tstruct strbuf *base,\n \t\t\tconst char *filename, unsigned mode,\n \t\t\tvoid *context)\ndiff --git a/attr.c b/attr.c\nindex 375b5c0dbf7..0b599334dd8 100644\n--- a/attr.c\n+++ b/attr.c\n@@ -61,10 +61,10 @@ struct attr_hash_entry {\n };\n \n /* attr_hashmap comparison function */\n-static int attr_hash_entry_cmp(const void *UNUSED(cmp_data),\n+static int attr_hash_entry_cmp(const void *cmp_data UNUSED,\n \t\t\t       const struct hashmap_entry *eptr,\n \t\t\t       const struct hashmap_entry *entry_or_key,\n-\t\t\t       const void *UNUSED(keydata))\n+\t\t\t       const void *keydata UNUSED)\n {\n \tconst struct attr_hash_entry *a, *b;\n \ndiff --git a/bisect.c b/bisect.c\nindex 07ccd1bce61..fd581b85a72 100644\n--- a/bisect.c\n+++ b/bisect.c\n@@ -441,7 +441,7 @@ void find_bisection(struct commit_list **commit_list, int *reaches,\n }\n \n static int register_ref(const char *refname, const struct object_id *oid,\n-\t\t\tint UNUSED(flags), void *UNUSED(cb_data))\n+\t\t\tint flags UNUSED, void *cb_data UNUSED)\n {\n \tstruct strbuf good_prefix = STRBUF_INIT;\n \tstrbuf_addstr(&good_prefix, term_good);\n@@ -1161,8 +1161,8 @@ int estimate_bisect_steps(int all)\n }\n \n static int mark_for_removal(const char *refname,\n-\t\t\t    const struct object_id *UNUSED(oid),\n-\t\t\t    int UNUSED(flag), void *cb_data)\n+\t\t\t    const struct object_id *oid UNUSED,\n+\t\t\t    int flag UNUSED, void *cb_data)\n {\n \tstruct string_list *refs = cb_data;\n \tchar *ref = xstrfmt(\"refs/bisect%s\", refname);\ndiff --git a/bloom.c b/bloom.c\nindex 94fb97e60ed..d0730525da5 100644\n--- a/bloom.c\n+++ b/bloom.c\n@@ -163,10 +163,10 @@ void init_bloom_filters(void)\n \tinit_bloom_filter_slab(&bloom_filters);\n }\n \n-static int pathmap_cmp(const void *UNUSED(hashmap_cmp_fn_data),\n+static int pathmap_cmp(const void *hashmap_cmp_fn_data UNUSED,\n \t\t       const struct hashmap_entry *eptr,\n \t\t       const struct hashmap_entry *entry_or_key,\n-\t\t       const void *UNUSED(keydata))\n+\t\t       const void *keydata UNUSED)\n {\n \tconst struct pathmap_hash_entry *e1, *e2;\n \ndiff --git a/builtin/am.c b/builtin/am.c\nindex 0811b9ff676..39fea248330 100644\n--- a/builtin/am.c\n+++ b/builtin/am.c\n@@ -2301,7 +2301,7 @@ static int parse_opt_show_current_patch(const struct option *opt, const char *ar\n \treturn 0;\n }\n \n-static int git_am_config(const char *k, const char *v, void *UNUSED(cb))\n+static int git_am_config(const char *k, const char *v, void *cb UNUSED)\n {\n \tint status;\n \ndiff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c\nindex 87c8b2d818b..aa975bd9268 100644\n--- a/builtin/bisect--helper.c\n+++ b/builtin/bisect--helper.c\n@@ -329,9 +329,9 @@ static int check_and_set_terms(struct bisect_terms *terms, const char *cmd)\n \treturn 0;\n }\n \n-static int inc_nr(const char *UNUSED(refname),\n-\t\t  const struct object_id *UNUSED(oid),\n-\t\t  int UNUSED(flag), void *cb_data)\n+static int inc_nr(const char *refname UNUSED,\n+\t\t  const struct object_id *oid UNUSED,\n+\t\t  int flag UNUSED, void *cb_data)\n {\n \tunsigned int *nr = (unsigned int *)cb_data;\n \t(*nr)++;\n@@ -519,7 +519,7 @@ static int bisect_append_log_quoted(const char **argv)\n }\n \n static int add_bisect_ref(const char *refname, const struct object_id *oid,\n-\t\t\t  int UNUSED(flags), void *cb)\n+\t\t\t  int flags UNUSED, void *cb)\n {\n \tstruct add_bisect_ref_data *data = cb;\n \n@@ -1135,9 +1135,9 @@ static int bisect_visualize(struct bisect_terms *terms, const char **argv, int a\n \treturn res;\n }\n \n-static int get_first_good(const char *UNUSED(refname),\n+static int get_first_good(const char *refname UNUSED,\n \t\t\t  const struct object_id *oid,\n-\t\t\t  int UNUSED(flag), void *cb_data)\n+\t\t\t  int flag UNUSED, void *cb_data)\n {\n \toidcpy(cb_data, oid);\n \treturn 1;\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex d18c8c886e9..2a132392fbe 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -125,7 +125,7 @@ static int post_checkout_hook(struct commit *old_commit, struct commit *new_comm\n }\n \n static int update_some(const struct object_id *oid, struct strbuf *base,\n-\t\t       const char *pathname, unsigned mode, void *UNUSED(context))\n+\t\t       const char *pathname, unsigned mode, void *context UNUSED)\n {\n \tint len;\n \tstruct cache_entry *ce;\n@@ -990,7 +990,7 @@ static void update_refs_for_switch(const struct checkout_opts *opts,\n \n static int add_pending_uninteresting_ref(const char *refname,\n \t\t\t\t\t const struct object_id *oid,\n-\t\t\t\t\t int UNUSED(flags), void *cb_data)\n+\t\t\t\t\t int flags UNUSED, void *cb_data)\n {\n \tadd_pending_oid(cb_data, refname, oid, UNINTERESTING);\n \treturn 0;\ndiff --git a/builtin/commit-graph.c b/builtin/commit-graph.c\nindex ea923ea33ad..aaa1b5b9600 100644\n--- a/builtin/commit-graph.c\n+++ b/builtin/commit-graph.c\n@@ -179,7 +179,7 @@ static int write_option_max_new_filters(const struct option *opt,\n }\n \n static int git_commit_graph_write_config(const char *var, const char *value,\n-\t\t\t\t\t void *UNUSED(cb))\n+\t\t\t\t\t void *cb UNUSED)\n {\n \tif (!strcmp(var, \"commitgraph.maxnewfilters\"))\n \t\twrite_opts.max_new_filters = git_config_int(var, value);\ndiff --git a/builtin/config.c b/builtin/config.c\nindex bdc8b1d1a89..753e5fac297 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -208,7 +208,7 @@ static void show_config_scope(struct strbuf *buf)\n }\n \n static int show_all_config(const char *key_, const char *value_,\n-\t\t\t   void *UNUSED(cb))\n+\t\t\t   void *cb UNUSED)\n {\n \tif (show_origin || show_scope) {\n \t\tstruct strbuf buf = STRBUF_INIT;\n@@ -460,7 +460,7 @@ static const char *get_colorbool_slot;\n static char parsed_color[COLOR_MAXLEN];\n \n static int git_get_color_config(const char *var, const char *value,\n-\t\t\t\tvoid *UNUSED(cb))\n+\t\t\t\tvoid *cb UNUSED)\n {\n \tif (!strcmp(var, get_color_slot)) {\n \t\tif (!value)\n@@ -492,7 +492,7 @@ static int get_colorbool_found;\n static int get_diff_color_found;\n static int get_color_ui_found;\n static int git_get_colorbool_config(const char *var, const char *value,\n-\t\t\t\t    void *UNUSED(data))\n+\t\t\t\t    void *data UNUSED)\n {\n \tif (!strcmp(var, get_colorbool_slot))\n \t\tget_colorbool_found = git_config_colorbool(var, value);\ndiff --git a/builtin/describe.c b/builtin/describe.c\nindex 084fa00f2a5..e17c4b4c69b 100644\n--- a/builtin/describe.c\n+++ b/builtin/describe.c\n@@ -63,7 +63,7 @@ static const char *prio_names[] = {\n \tN_(\"head\"), N_(\"lightweight\"), N_(\"annotated\"),\n };\n \n-static int commit_name_neq(const void *UNUSED(cmp_data),\n+static int commit_name_neq(const void *cmp_data UNUSED,\n \t\t\t   const struct hashmap_entry *eptr,\n \t\t\t   const struct hashmap_entry *entry_or_key,\n \t\t\t   const void *peeled)\n@@ -141,7 +141,7 @@ static void add_to_known_names(const char *path,\n }\n \n static int get_name(const char *path, const struct object_id *oid,\n-\t\t    int UNUSED(flag), void *UNUSED(cb_data))\n+\t\t    int flag UNUSED, void *cb_data UNUSED)\n {\n \tint is_tag = 0;\n \tstruct object_id peeled;\ndiff --git a/builtin/difftool.c b/builtin/difftool.c\nindex a570200e66a..f780ebfd55f 100644\n--- a/builtin/difftool.c\n+++ b/builtin/difftool.c\n@@ -125,10 +125,10 @@ struct working_tree_entry {\n \tchar path[FLEX_ARRAY];\n };\n \n-static int working_tree_entry_cmp(const void *UNUSED(cmp_data),\n+static int working_tree_entry_cmp(const void *cmp_data UNUSED,\n \t\t\t\t  const struct hashmap_entry *eptr,\n \t\t\t\t  const struct hashmap_entry *entry_or_key,\n-\t\t\t\t  const void *UNUSED(keydata))\n+\t\t\t\t  const void *keydata UNUSED)\n {\n \tconst struct working_tree_entry *a, *b;\n \n@@ -148,10 +148,10 @@ struct pair_entry {\n \tconst char path[FLEX_ARRAY];\n };\n \n-static int pair_cmp(const void *UNUSED(cmp_data),\n+static int pair_cmp(const void *cmp_data UNUSED,\n \t\t    const struct hashmap_entry *eptr,\n \t\t    const struct hashmap_entry *entry_or_key,\n-\t\t    const void *UNUSED(keydata))\n+\t\t    const void *keydata UNUSED)\n {\n \tconst struct pair_entry *a, *b;\n \n@@ -184,7 +184,7 @@ struct path_entry {\n \tchar path[FLEX_ARRAY];\n };\n \n-static int path_entry_cmp(const void *UNUSED(cmp_data),\n+static int path_entry_cmp(const void *cmp_data UNUSED,\n \t\t\t  const struct hashmap_entry *eptr,\n \t\t\t  const struct hashmap_entry *entry_or_key,\n \t\t\t  const void *key)\ndiff --git a/builtin/fast-export.c b/builtin/fast-export.c\nindex bb05b50a5a0..ab5b0ff610a 100644\n--- a/builtin/fast-export.c\n+++ b/builtin/fast-export.c\n@@ -119,7 +119,7 @@ struct anonymized_entry_key {\n \tsize_t orig_len;\n };\n \n-static int anonymized_entry_cmp(const void *UNUSED(cmp_data),\n+static int anonymized_entry_cmp(const void *cmp_data UNUSED,\n \t\t\t\tconst struct hashmap_entry *eptr,\n \t\t\t\tconst struct hashmap_entry *entry_or_key,\n \t\t\t\tconst void *keydata)\ndiff --git a/builtin/fast-import.c b/builtin/fast-import.c\nindex 76ed0c2db9c..7134683ab93 100644\n--- a/builtin/fast-import.c\n+++ b/builtin/fast-import.c\n@@ -46,7 +46,7 @@ struct object_entry {\n \t\tdepth : DEPTH_BITS;\n };\n \n-static int object_entry_hashcmp(const void *UNUSED(map_data),\n+static int object_entry_hashcmp(const void *map_data UNUSED,\n \t\t\t\tconst struct hashmap_entry *eptr,\n \t\t\t\tconst struct hashmap_entry *entry_or_key,\n \t\t\t\tconst void *keydata)\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex 5fddaef4804..7f5b0f4c2a3 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -301,7 +301,7 @@ struct refname_hash_entry {\n \tchar refname[FLEX_ARRAY];\n };\n \n-static int refname_hash_entry_cmp(const void *UNUSED(hashmap_cmp_fn_data),\n+static int refname_hash_entry_cmp(const void *hashmap_cmp_fn_data UNUSED,\n \t\t\t\t  const struct hashmap_entry *eptr,\n \t\t\t\t  const struct hashmap_entry *entry_or_key,\n \t\t\t\t  const void *keydata)\n@@ -329,7 +329,7 @@ static struct refname_hash_entry *refname_hash_add(struct hashmap *map,\n \n static int add_one_refname(const char *refname,\n \t\t\t   const struct object_id *oid,\n-\t\t\t   int UNUSED(flag), void *cbdata)\n+\t\t\t   int flag UNUSED, void *cbdata)\n {\n \tstruct hashmap *refname_map = cbdata;\n \n@@ -1462,9 +1462,9 @@ static void set_option(struct transport *transport, const char *name, const char\n }\n \n \n-static int add_oid(const char *UNUSED(refname),\n+static int add_oid(const char *refname UNUSED,\n \t\t   const struct object_id *oid,\n-\t\t   int UNUSED(flags), void *cb_data)\n+\t\t   int flags UNUSED, void *cb_data)\n {\n \tstruct oid_array *oids = cb_data;\n \ndiff --git a/builtin/fsck.c b/builtin/fsck.c\nindex 31d3da8954b..f7916f06ed5 100644\n--- a/builtin/fsck.c\n+++ b/builtin/fsck.c\n@@ -488,9 +488,9 @@ static void fsck_handle_reflog_oid(const char *refname, struct object_id *oid,\n }\n \n static int fsck_handle_reflog_ent(struct object_id *ooid, struct object_id *noid,\n-\t\t\t\t  const char *UNUSED(email),\n-\t\t\t\t  timestamp_t timestamp, int UNUSED(tz),\n-\t\t\t\t  const char *UNUSED(message), void *cb_data)\n+\t\t\t\t  const char *email UNUSED,\n+\t\t\t\t  timestamp_t timestamp, int tz UNUSED,\n+\t\t\t\t  const char *message UNUSED, void *cb_data)\n {\n \tconst char *refname = cb_data;\n \n@@ -504,8 +504,8 @@ static int fsck_handle_reflog_ent(struct object_id *ooid, struct object_id *noid\n }\n \n static int fsck_handle_reflog(const char *logname,\n-\t\t\t      const struct object_id *UNUSED(oid),\n-\t\t\t      int UNUSED(flag), void *cb_data)\n+\t\t\t      const struct object_id *oid UNUSED,\n+\t\t\t      int flag UNUSED, void *cb_data)\n {\n \tstruct strbuf refname = STRBUF_INIT;\n \n@@ -516,7 +516,7 @@ static int fsck_handle_reflog(const char *logname,\n }\n \n static int fsck_handle_ref(const char *refname, const struct object_id *oid,\n-\t\t\t   int UNUSED(flag), void *UNUSED(cb_data))\n+\t\t\t   int flag UNUSED, void *cb_data UNUSED)\n {\n \tstruct object *obj;\n \ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex e4ede128c92..2d093211855 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -782,9 +782,9 @@ struct cg_auto_data {\n \tint limit;\n };\n \n-static int dfs_on_ref(const char *UNUSED(refname),\n+static int dfs_on_ref(const char *refname UNUSED,\n \t\t      const struct object_id *oid,\n-\t\t      int UNUSED(flags),\n+\t\t      int flags UNUSED,\n \t\t      void *cb_data)\n {\n \tstruct cg_auto_data *data = (struct cg_auto_data *)cb_data;\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 79a2e4d0bbb..3f9a6e8cf20 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -645,8 +645,8 @@ static int show_tag_object(const struct object_id *oid, struct rev_info *rev)\n \treturn 0;\n }\n \n-static int show_tree_object(const struct object_id *UNUSED(oid),\n-\t\t\t    struct strbuf *UNUSED(base),\n+static int show_tree_object(const struct object_id *oid UNUSED,\n+\t\t\t    struct strbuf *base UNUSED,\n \t\t\t    const char *pathname, unsigned mode,\n \t\t\t    void *context)\n {\ndiff --git a/builtin/ls-tree.c b/builtin/ls-tree.c\nindex 48df337605f..c3ea09281af 100644\n--- a/builtin/ls-tree.c\n+++ b/builtin/ls-tree.c\n@@ -142,7 +142,7 @@ static int show_recursive(const char *base, size_t baselen, const char *pathname\n }\n \n static int show_tree_fmt(const struct object_id *oid, struct strbuf *base,\n-\t\t\t const char *pathname, unsigned mode, void *UNUSED(context))\n+\t\t\t const char *pathname, unsigned mode, void *context UNUSED)\n {\n \tsize_t baselen;\n \tint recurse = 0;\n@@ -213,7 +213,7 @@ static void show_tree_common_default_long(struct strbuf *base,\n \n static int show_tree_default(const struct object_id *oid, struct strbuf *base,\n \t\t\t     const char *pathname, unsigned mode,\n-\t\t\t     void *UNUSED(context))\n+\t\t\t     void *context UNUSED)\n {\n \tint early;\n \tint recurse;\n@@ -231,7 +231,7 @@ static int show_tree_default(const struct object_id *oid, struct strbuf *base,\n \n static int show_tree_long(const struct object_id *oid, struct strbuf *base,\n \t\t\t  const char *pathname, unsigned mode,\n-\t\t\t  void *UNUSED(context))\n+\t\t\t  void *context UNUSED)\n {\n \tint early;\n \tint recurse;\n@@ -261,7 +261,7 @@ static int show_tree_long(const struct object_id *oid, struct strbuf *base,\n \n static int show_tree_name_only(const struct object_id *oid, struct strbuf *base,\n \t\t\t       const char *pathname, unsigned mode,\n-\t\t\t       void *UNUSED(context))\n+\t\t\t       void *context UNUSED)\n {\n \tint early;\n \tint recurse;\n@@ -282,7 +282,7 @@ static int show_tree_name_only(const struct object_id *oid, struct strbuf *base,\n \n static int show_tree_object(const struct object_id *oid, struct strbuf *base,\n \t\t\t    const char *pathname, unsigned mode,\n-\t\t\t    void *UNUSED(context))\n+\t\t\t    void *context UNUSED)\n {\n \tint early;\n \tint recurse;\ndiff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c\nindex 8d156766afe..b3a3f0a571a 100644\n--- a/builtin/multi-pack-index.c\n+++ b/builtin/multi-pack-index.c\n@@ -78,7 +78,7 @@ static struct option *add_common_options(struct option *prev)\n }\n \n static int git_multi_pack_index_write_config(const char *var, const char *value,\n-\t\t\t\t\t     void *UNUSED(cb))\n+\t\t\t\t\t     void *cb UNUSED)\n {\n \tif (!strcmp(var, \"pack.writebitmaphashcache\")) {\n \t\tif (git_config_bool(var, value))\ndiff --git a/builtin/name-rev.c b/builtin/name-rev.c\nindex c4dc143c4b7..15535e914a6 100644\n--- a/builtin/name-rev.c\n+++ b/builtin/name-rev.c\n@@ -345,7 +345,7 @@ static int cmp_by_tag_and_age(const void *a_, const void *b_)\n }\n \n static int name_ref(const char *path, const struct object_id *oid,\n-\t\t    int UNUSED(flags), void *cb_data)\n+\t\t    int flags UNUSED, void *cb_data)\n {\n \tstruct object *o = parse_object(the_repository, oid);\n \tstruct name_ref_data *data = cb_data;\ndiff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\nindex eb93e5c8fe9..8fd2794a324 100644\n--- a/builtin/pack-objects.c\n+++ b/builtin/pack-objects.c\n@@ -759,8 +759,8 @@ static enum write_one_status write_one(struct hashfile *f,\n \treturn WRITE_ONE_WRITTEN;\n }\n \n-static int mark_tagged(const char *UNUSED(path), const struct object_id *oid,\n-\t\t       int UNUSED(flag), void *UNUSED(cb_data))\n+static int mark_tagged(const char *path UNUSED, const struct object_id *oid,\n+\t\t       int flag UNUSED, void *cb_data UNUSED)\n {\n \tstruct object_id peeled;\n \tstruct object_entry *entry = packlist_find(&to_pack, oid);\n@@ -3035,8 +3035,8 @@ static void add_tag_chain(const struct object_id *oid)\n \t}\n }\n \n-static int add_ref_tag(const char *UNUSED(tag), const struct object_id *oid,\n-\t\t       int UNUSED(flag), void *UNUSED(cb_data))\n+static int add_ref_tag(const char *tag UNUSED, const struct object_id *oid,\n+\t\t       int flag UNUSED, void *cb_data UNUSED)\n {\n \tstruct object_id peeled;\n \n@@ -3952,8 +3952,8 @@ static void record_recent_commit(struct commit *commit, void *data)\n \n static int mark_bitmap_preferred_tip(const char *refname,\n \t\t\t\t     const struct object_id *oid,\n-\t\t\t\t     int UNUSED(flags),\n-\t\t\t\t     void *UNUSED(data))\n+\t\t\t\t     int flags UNUSED,\n+\t\t\t\t     void *data UNUSED)\n {\n \tstruct object_id peeled;\n \tstruct object *object;\ndiff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\nindex 6882d526e67..44bcea3a5b3 100644\n--- a/builtin/receive-pack.c\n+++ b/builtin/receive-pack.c\n@@ -291,7 +291,7 @@ static void show_ref(const char *path, const struct object_id *oid)\n }\n \n static int show_ref_cb(const char *path_full, const struct object_id *oid,\n-\t\t       int UNUSED(flag), void *data)\n+\t\t       int flag UNUSED, void *data)\n {\n \tstruct oidset *seen = data;\n \tconst char *path = strip_namespace(path_full);\n@@ -465,7 +465,7 @@ static void rp_error(const char *err, ...)\n \tva_end(params);\n }\n \n-static int copy_to_sideband(int in, int UNUSED(out), void *UNUSED(arg))\n+static int copy_to_sideband(int in, int out UNUSED, void *arg UNUSED)\n {\n \tchar data[128];\n \tint keepalive_active = 0;\ndiff --git a/builtin/reflog.c b/builtin/reflog.c\nindex 63f9a233571..8f2da0b65b9 100644\n--- a/builtin/reflog.c\n+++ b/builtin/reflog.c\n@@ -56,8 +56,8 @@ struct worktree_reflogs {\n \tstruct string_list reflogs;\n };\n \n-static int collect_reflog(const char *ref, const struct object_id *UNUSED(oid),\n-\t\t\t  int UNUSED(flags), void *cb_data)\n+static int collect_reflog(const char *ref, const struct object_id *oid UNUSED,\n+\t\t\t  int flags UNUSED, void *cb_data)\n {\n \tstruct worktree_reflogs *cb = cb_data;\n \tstruct worktree *worktree = cb->worktree;\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex 87dda7c37bd..24cd809d240 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -265,7 +265,7 @@ static const char *abbrev_ref(const char *name, const char *prefix)\n #define abbrev_branch(name) abbrev_ref((name), \"refs/heads/\")\n \n static int config_read_branches(const char *key, const char *value,\n-\t\t\t\tvoid *UNUSED(data))\n+\t\t\t\tvoid *data UNUSED)\n {\n \tconst char *orig_key = key;\n \tchar *name;\n@@ -539,8 +539,8 @@ struct branches_for_remote {\n };\n \n static int add_branch_for_removal(const char *refname,\n-\t\t\t\t  const struct object_id *UNUSED(oid),\n-\t\t\t\t  int UNUSED(flags), void *cb_data)\n+\t\t\t\t  const struct object_id *oid UNUSED,\n+\t\t\t\t  int flags UNUSED, void *cb_data)\n {\n \tstruct branches_for_remote *branches = cb_data;\n \tstruct refspec_item refspec;\n@@ -582,8 +582,8 @@ struct rename_info {\n };\n \n static int read_remote_branches(const char *refname,\n-\t\t\t\tconst struct object_id *UNUSED(oid),\n-\t\t\t\tint UNUSED(flags), void *cb_data)\n+\t\t\t\tconst struct object_id *oid UNUSED,\n+\t\t\t\tint flags UNUSED, void *cb_data)\n {\n \tstruct rename_info *rename = cb_data;\n \tstruct strbuf buf = STRBUF_INIT;\n@@ -956,7 +956,7 @@ static void free_remote_ref_states(struct ref_states *states)\n }\n \n static int append_ref_to_tracked_list(const char *refname,\n-\t\t\t\t      const struct object_id *UNUSED(oid),\n+\t\t\t\t      const struct object_id *oid UNUSED,\n \t\t\t\t      int flags, void *cb_data)\n {\n \tstruct ref_states *states = cb_data;\n@@ -1486,7 +1486,7 @@ static int prune(int argc, const char **argv)\n \treturn result;\n }\n \n-static int get_remote_default(const char *key, const char *UNUSED(value), void *priv)\n+static int get_remote_default(const char *key, const char *value UNUSED, void *priv)\n {\n \tif (strcmp(key, \"remotes.default\") == 0) {\n \t\tint *found = priv;\ndiff --git a/builtin/repack.c b/builtin/repack.c\nindex ff952dec48d..a5bacc77974 100644\n--- a/builtin/repack.c\n+++ b/builtin/repack.c\n@@ -514,9 +514,9 @@ struct midx_snapshot_ref_data {\n \tint preferred;\n };\n \n-static int midx_snapshot_ref_one(const char *UNUSED(refname),\n+static int midx_snapshot_ref_one(const char *refname UNUSED,\n \t\t\t\t const struct object_id *oid,\n-\t\t\t\t int UNUSED(flag), void *_data)\n+\t\t\t\t int flag UNUSED, void *_data)\n {\n \tstruct midx_snapshot_ref_data *data = _data;\n \tstruct object_id peeled;\ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex 3c448d438bc..e5d70ee6d2d 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -196,7 +196,7 @@ static int show_default(void)\n }\n \n static int show_reference(const char *refname, const struct object_id *oid,\n-\t\t\t  int UNUSED(flag), void *UNUSED(cb_data))\n+\t\t\t  int flag UNUSED, void *cb_data UNUSED)\n {\n \tif (ref_excluded(ref_excludes, refname))\n \t\treturn 0;\n@@ -205,7 +205,7 @@ static int show_reference(const char *refname, const struct object_id *oid,\n }\n \n static int anti_reference(const char *refname, const struct object_id *oid,\n-\t\t\t  int UNUSED(flag), void *UNUSED(cb_data))\n+\t\t\t  int flag UNUSED, void *cb_data UNUSED)\n {\n \tshow_rev(REVERSED, oid, refname);\n \treturn 0;\ndiff --git a/builtin/show-branch.c b/builtin/show-branch.c\nindex 3ec011bea43..d3f5715e3e3 100644\n--- a/builtin/show-branch.c\n+++ b/builtin/show-branch.c\n@@ -404,7 +404,7 @@ static int append_ref(const char *refname, const struct object_id *oid,\n }\n \n static int append_head_ref(const char *refname, const struct object_id *oid,\n-\t\t\t   int UNUSED(flag), void *UNUSED(cb_data))\n+\t\t\t   int flag UNUSED, void *cb_data UNUSED)\n {\n \tstruct object_id tmp;\n \tint ofs = 11;\n@@ -419,7 +419,7 @@ static int append_head_ref(const char *refname, const struct object_id *oid,\n }\n \n static int append_remote_ref(const char *refname, const struct object_id *oid,\n-\t\t\t     int UNUSED(flag), void *UNUSED(cb_data))\n+\t\t\t     int flag UNUSED, void *cb_data UNUSED)\n {\n \tstruct object_id tmp;\n \tint ofs = 13;\n@@ -434,7 +434,7 @@ static int append_remote_ref(const char *refname, const struct object_id *oid,\n }\n \n static int append_tag_ref(const char *refname, const struct object_id *oid,\n-\t\t\t  int UNUSED(flag), void *UNUSED(cb_data))\n+\t\t\t  int flag UNUSED, void *cb_data UNUSED)\n {\n \tif (!starts_with(refname, \"refs/tags/\"))\n \t\treturn 0;\ndiff --git a/builtin/show-ref.c b/builtin/show-ref.c\nindex 97465372200..48569061087 100644\n--- a/builtin/show-ref.c\n+++ b/builtin/show-ref.c\n@@ -47,7 +47,7 @@ static void show_one(const char *refname, const struct object_id *oid)\n }\n \n static int show_ref(const char *refname, const struct object_id *oid,\n-\t\t    int UNUSED(flag), void *UNUSED(cbdata))\n+\t\t    int flag UNUSED, void *cbdata UNUSED)\n {\n \tif (show_head && !strcmp(refname, \"HEAD\"))\n \t\tgoto match;\n@@ -78,8 +78,8 @@ static int show_ref(const char *refname, const struct object_id *oid,\n }\n \n static int add_existing(const char *refname,\n-\t\t\tconst struct object_id *UNUSED(oid),\n-\t\t\tint UNUSED(flag), void *cbdata)\n+\t\t\tconst struct object_id *oid UNUSED,\n+\t\t\tint flag UNUSED, void *cbdata)\n {\n \tstruct string_list *list = (struct string_list *)cbdata;\n \tstring_list_insert(list, refname);\ndiff --git a/builtin/stash.c b/builtin/stash.c\nindex a741b920b32..3492aff751a 100644\n--- a/builtin/stash.c\n+++ b/builtin/stash.c\n@@ -638,12 +638,12 @@ static int apply_stash(int argc, const char **argv, const char *prefix)\n \treturn ret;\n }\n \n-static int reject_reflog_ent(struct object_id *UNUSED(ooid),\n-\t\t\t     struct object_id *UNUSED(noid),\n-\t\t\t     const char *UNUSED(email),\n-\t\t\t     timestamp_t UNUSED(timestamp),\n-\t\t\t     int UNUSED(tz), const char *UNUSED(message),\n-\t\t\t     void *UNUSED(cb_data))\n+static int reject_reflog_ent(struct object_id *ooid UNUSED,\n+\t\t\t     struct object_id *noid UNUSED,\n+\t\t\t     const char *email UNUSED,\n+\t\t\t     timestamp_t timestamp UNUSED,\n+\t\t\t     int tz UNUSED, const char *message UNUSED,\n+\t\t\t     void *cb_data UNUSED)\n {\n \treturn 1;\n }\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex e24e721458d..88df6c5017d 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -622,9 +622,9 @@ static void print_status(unsigned int flags, char state, const char *path,\n \tprintf(\"\\n\");\n }\n \n-static int handle_submodule_head_ref(const char *UNUSED(refname),\n+static int handle_submodule_head_ref(const char *refname UNUSED,\n \t\t\t\t     const struct object_id *oid,\n-\t\t\t\t     int UNUSED(flags),\n+\t\t\t\t     int flags UNUSED,\n \t\t\t\t     void *cb_data)\n {\n \tstruct object_id *output = cb_data;\ndiff --git a/color.c b/color.c\nindex 04ad0a8bf75..f05d8a81d72 100644\n--- a/color.c\n+++ b/color.c\n@@ -415,7 +415,7 @@ int want_color_fd(int fd, int var)\n \treturn var;\n }\n \n-int git_color_config(const char *var, const char *value, void *UNUSED(cb))\n+int git_color_config(const char *var, const char *value, void *cb UNUSED)\n {\n \tif (!strcmp(var, \"color.ui\")) {\n \t\tgit_use_color_default = git_config_colorbool(var, value);\ndiff --git a/commit-graph.c b/commit-graph.c\nindex 1ab5c3233ff..97dd1001ece 100644\n--- a/commit-graph.c\n+++ b/commit-graph.c\n@@ -1639,9 +1639,9 @@ struct refs_cb_data {\n \tstruct progress *progress;\n };\n \n-static int add_ref_to_set(const char *UNUSED(refname),\n+static int add_ref_to_set(const char *refname UNUSED,\n \t\t\t  const struct object_id *oid,\n-\t\t\t  int UNUSED(flags), void *cb_data)\n+\t\t\t  int flags UNUSED, void *cb_data)\n {\n \tstruct object_id peeled;\n \tstruct refs_cb_data *data = (struct refs_cb_data *)cb_data;\ndiff --git a/commit.c b/commit.c\nindex cb20082736d..89b8efc6116 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -951,9 +951,9 @@ static void add_one_commit(struct object_id *oid, struct rev_collect *revs)\n }\n \n static int collect_one_reflog_ent(struct object_id *ooid, struct object_id *noid,\n-\t\t\t\t  const char *UNUSED(ident),\n-\t\t\t\t  timestamp_t UNUSED(timestamp), int UNUSED(tz),\n-\t\t\t\t  const char *UNUSED(message), void *cbdata)\n+\t\t\t\t  const char *ident UNUSED,\n+\t\t\t\t  timestamp_t timestamp UNUSED, int tz UNUSED,\n+\t\t\t\t  const char *message UNUSED, void *cbdata)\n {\n \tstruct rev_collect *revs = cbdata;\n \ndiff --git a/compat/terminal.c b/compat/terminal.c\nindex 0b0caae8571..ea490a7ced4 100644\n--- a/compat/terminal.c\n+++ b/compat/terminal.c\n@@ -477,7 +477,7 @@ struct escape_sequence_entry {\n \tchar sequence[FLEX_ARRAY];\n };\n \n-static int sequence_entry_cmp(const void *UNUSED(hashmap_cmp_fn_data),\n+static int sequence_entry_cmp(const void *hashmap_cmp_fn_data UNUSED,\n \t\t\t      const struct escape_sequence_entry *e1,\n \t\t\t      const struct escape_sequence_entry *e2,\n \t\t\t      const void *keydata)\ndiff --git a/config.c b/config.c\nindex c92f1efd6bf..cbb5a3bab74 100644\n--- a/config.c\n+++ b/config.c\n@@ -362,8 +362,8 @@ static void populate_remote_urls(struct config_include_data *inc)\n \tcurrent_parsing_scope = store_scope;\n }\n \n-static int forbid_remote_url(const char *var, const char *UNUSED(value),\n-\t\t\t     void *UNUSED(data))\n+static int forbid_remote_url(const char *var, const char *value UNUSED,\n+\t\t\t     void *data UNUSED)\n {\n \tconst char *remote_name;\n \tsize_t remote_name_len;\n@@ -2338,10 +2338,10 @@ static int configset_add_value(struct config_set *cs, const char *key, const cha\n \treturn 0;\n }\n \n-static int config_set_element_cmp(const void *UNUSED(cmp_data),\n+static int config_set_element_cmp(const void *cmp_data UNUSED,\n \t\t\t\t  const struct hashmap_entry *eptr,\n \t\t\t\t  const struct hashmap_entry *entry_or_key,\n-\t\t\t\t  const void *UNUSED(keydata))\n+\t\t\t\t  const void *keydata UNUSED)\n {\n \tconst struct config_set_element *e1, *e2;\n \ndiff --git a/convert.c b/convert.c\nindex 25d89fa83ba..95e6a5244fc 100644\n--- a/convert.c\n+++ b/convert.c\n@@ -619,7 +619,7 @@ struct filter_params {\n \tconst char *path;\n };\n \n-static int filter_buffer_or_fd(int UNUSED(in), int out, void *data)\n+static int filter_buffer_or_fd(int in UNUSED, int out, void *data)\n {\n \t/*\n \t * Spawn cmd and feed the buffer contents through its stdin.\n@@ -1008,7 +1008,7 @@ static int apply_filter(const char *path, const char *src, size_t len,\n \treturn 0;\n }\n \n-static int read_convert_config(const char *var, const char *value, void *UNUSED(cb))\n+static int read_convert_config(const char *var, const char *value, void *cb UNUSED)\n {\n \tconst char *key, *name;\n \tsize_t namelen;\ndiff --git a/delta-islands.c b/delta-islands.c\nindex c64333f9de2..26f9e99e1a9 100644\n--- a/delta-islands.c\n+++ b/delta-islands.c\n@@ -316,7 +316,7 @@ static regex_t *island_regexes;\n static unsigned int island_regexes_alloc, island_regexes_nr;\n static const char *core_island_name;\n \n-static int island_config_callback(const char *k, const char *v, void *UNUSED(cb))\n+static int island_config_callback(const char *k, const char *v, void *cb UNUSED)\n {\n \tif (!strcmp(k, \"pack.island\")) {\n \t\tstruct strbuf re = STRBUF_INIT;\n@@ -365,7 +365,7 @@ static void add_ref_to_island(const char *island_name, const struct object_id *o\n }\n \n static int find_island_for_ref(const char *refname, const struct object_id *oid,\n-\t\t\t       int UNUSED(flags), void *UNUSED(data))\n+\t\t\t       int flags UNUSED, void *data UNUSED)\n {\n \t/*\n \t * We should advertise 'ARRAY_SIZE(matches) - 2' as the max,\ndiff --git a/diff.c b/diff.c\nindex 7c7d53d2771..f19bc766289 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -265,7 +265,7 @@ void init_diff_ui_defaults(void)\n }\n \n int git_diff_heuristic_config(const char *var, const char *value,\n-\t\t\t      void *UNUSED(cb))\n+\t\t\t      void *cb UNUSED)\n {\n \tif (!strcmp(var, \"diff.indentheuristic\"))\n \t\tdiff_indent_heuristic = git_config_bool(var, value);\n@@ -917,7 +917,7 @@ struct interned_diff_symbol {\n static int interned_diff_symbol_cmp(const void *hashmap_cmp_fn_data,\n \t\t\t\t    const struct hashmap_entry *eptr,\n \t\t\t\t    const struct hashmap_entry *entry_or_key,\n-\t\t\t\t    const void *UNUSED(keydata))\n+\t\t\t\t    const void *keydata UNUSED)\n {\n \tconst struct diff_options *diffopt = hashmap_cmp_fn_data;\n \tconst struct emitted_diff_symbol *a, *b;\ndiff --git a/dir.c b/dir.c\nindex 42f8ee06e09..a2ec4f652ba 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -655,10 +655,10 @@ void parse_path_pattern(const char **pattern,\n \t*patternlen = len;\n }\n \n-int pl_hashmap_cmp(const void *UNUSED(cmp_data),\n+int pl_hashmap_cmp(const void *cmp_data UNUSED,\n \t\t   const struct hashmap_entry *a,\n \t\t   const struct hashmap_entry *b,\n-\t\t   const void *UNUSED(key))\n+\t\t   const void *key UNUSED)\n {\n \tconst struct pattern_entry *ee1 =\n \t\t\tcontainer_of(a, struct pattern_entry, ent);\ndiff --git a/environment.c b/environment.c\nindex a0ceb6d6558..c94480f92f4 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -333,10 +333,10 @@ static void set_git_dir_1(const char *path)\n \tsetup_git_env(path);\n }\n \n-static void update_relative_gitdir(const char *UNUSED(name),\n+static void update_relative_gitdir(const char *name UNUSED,\n \t\t\t\t   const char *old_cwd,\n \t\t\t\t   const char *new_cwd,\n-\t\t\t\t   void *UNUSED(data))\n+\t\t\t\t   void *data UNUSED)\n {\n \tchar *path = reparent_relative_path(old_cwd, new_cwd, get_git_dir());\n \tstruct tmp_objdir *tmp_objdir = tmp_objdir_unapply_primary_odb();\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex 9f2933e868a..633718099b7 100644\n--- a/fetch-pack.c\n+++ b/fetch-pack.c\n@@ -176,9 +176,9 @@ static int rev_list_insert_ref(struct fetch_negotiator *negotiator,\n \treturn 0;\n }\n \n-static int rev_list_insert_ref_oid(const char *UNUSED(refname),\n+static int rev_list_insert_ref_oid(const char *refname UNUSED,\n \t\t\t\t   const struct object_id *oid,\n-\t\t\t\t   int UNUSED(flag),\n+\t\t\t\t   int flag UNUSED,\n \t\t\t\t   void *cb_data)\n {\n \treturn rev_list_insert_ref(cb_data, oid);\n@@ -582,10 +582,10 @@ static int mark_complete(const struct object_id *oid)\n \treturn 0;\n }\n \n-static int mark_complete_oid(const char *UNUSED(refname),\n+static int mark_complete_oid(const char *refname UNUSED,\n \t\t\t     const struct object_id *oid,\n-\t\t\t     int UNUSED(flag),\n-\t\t\t     void *UNUSED(cb_data))\n+\t\t\t     int flag UNUSED,\n+\t\t\t     void *cb_data UNUSED)\n {\n \treturn mark_complete(oid);\n }\n@@ -823,7 +823,7 @@ static int everything_local(struct fetch_pack_args *args,\n \treturn retval;\n }\n \n-static int sideband_demux(int UNUSED(in), int out, void *data)\n+static int sideband_demux(int in UNUSED, int out, void *data)\n {\n \tint *xd = data;\n \tint ret;\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex a9690126bb0..5ea7be97493 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -190,9 +190,9 @@ struct strbuf;\n #define _SGI_SOURCE 1\n \n #if defined(__GNUC__)\n-#define UNUSED(var) UNUSED_##var __attribute__((unused))\n+#define UNUSED __attribute__((unused))\n #else\n-#define UNUSED(var) UNUSED_##var\n+#define UNUSED\n #endif\n \n #if defined(WIN32) && !defined(__CYGWIN__) /* Both MinGW and MSVC */\n@@ -403,9 +403,9 @@ typedef uintmax_t timestamp_t;\n #endif\n \n #ifndef platform_core_config\n-static inline int noop_core_config(const char *UNUSED(var),\n-\t\t\t\t   const char *UNUSED(value),\n-\t\t\t\t   void *UNUSED(cb))\n+static inline int noop_core_config(const char *var UNUSED,\n+\t\t\t\t   const char *value UNUSED,\n+\t\t\t\t   void *cb UNUSED)\n {\n \treturn 0;\n }\n@@ -499,7 +499,7 @@ static inline void extract_id_from_env(const char *env, uid_t *id)\n }\n \n static inline int is_path_owned_by_current_uid(const char *path,\n-\t\t\t\t\t       struct strbuf *UNUSED(report))\n+\t\t\t\t\t       struct strbuf *report UNUSED)\n {\n \tstruct stat st;\n \tuid_t euid;\ndiff --git a/gpg-interface.c b/gpg-interface.c\nindex 721d69bf42a..9aa714bdeea 100644\n--- a/gpg-interface.c\n+++ b/gpg-interface.c\n@@ -699,7 +699,7 @@ void set_signing_key(const char *key)\n \tconfigured_signing_key = xstrdup(key);\n }\n \n-int git_gpg_config(const char *var, const char *value, void *UNUSED(cb))\n+int git_gpg_config(const char *var, const char *value, void *cb UNUSED)\n {\n \tstruct gpg_format *fmt = NULL;\n \tchar *fmtname = NULL;\ndiff --git a/hashmap.c b/hashmap.c\nindex 763aa1d8a37..cf5fea87eb0 100644\n--- a/hashmap.c\n+++ b/hashmap.c\n@@ -142,10 +142,10 @@ static inline struct hashmap_entry **find_entry_ptr(const struct hashmap *map,\n \treturn e;\n }\n \n-static int always_equal(const void *UNUSED(cmp_data),\n-\t\t\tconst struct hashmap_entry *UNUSED(entry1),\n-\t\t\tconst struct hashmap_entry *UNUSED(entry2),\n-\t\t\tconst void *UNUSED(keydata))\n+static int always_equal(const void *cmp_data UNUSED,\n+\t\t\tconst struct hashmap_entry *entry1 UNUSED,\n+\t\t\tconst struct hashmap_entry *entry2 UNUSED,\n+\t\t\tconst void *keydata UNUSED)\n {\n \treturn 0;\n }\n@@ -313,7 +313,7 @@ struct pool_entry {\n \tunsigned char data[FLEX_ARRAY];\n };\n \n-static int pool_entry_cmp(const void *UNUSED(cmp_data),\n+static int pool_entry_cmp(const void *cmp_data UNUSED,\n \t\t\t  const struct hashmap_entry *eptr,\n \t\t\t  const struct hashmap_entry *entry_or_key,\n \t\t\t  const void *keydata)\ndiff --git a/help.c b/help.c\nindex c5b5848188f..ec670d5f68b 100644\n--- a/help.c\n+++ b/help.c\n@@ -782,8 +782,8 @@ struct similar_ref_cb {\n };\n \n static int append_similar_ref(const char *refname,\n-\t\t\t      const struct object_id *UNUSED(oid),\n-\t\t\t      int UNUSED(flags), void *cb_data)\n+\t\t\t      const struct object_id *oid UNUSED,\n+\t\t\t      int flags UNUSED, void *cb_data)\n {\n \tstruct similar_ref_cb *cb = (struct similar_ref_cb *)(cb_data);\n \tchar *branch = strrchr(refname, '/') + 1;\ndiff --git a/http-backend.c b/http-backend.c\nindex 20db0ea6208..6eb3b2fe51c 100644\n--- a/http-backend.c\n+++ b/http-backend.c\n@@ -505,7 +505,7 @@ static void run_service(const char **argv, int buffer_input)\n }\n \n static int show_text_ref(const char *name, const struct object_id *oid,\n-\t\t\t int UNUSED(flag), void *cb_data)\n+\t\t\t int flag UNUSED, void *cb_data)\n {\n \tconst char *name_nons = strip_namespace(name);\n \tstruct strbuf *buf = cb_data;\ndiff --git a/ident.c b/ident.c\nindex 48745a1f0e9..6de76f9421d 100644\n--- a/ident.c\n+++ b/ident.c\n@@ -668,7 +668,7 @@ static int set_ident(const char *var, const char *value)\n \treturn 0;\n }\n \n-int git_ident_config(const char *var, const char *value, void *UNUSED(data))\n+int git_ident_config(const char *var, const char *value, void *data UNUSED)\n {\n \tif (!strcmp(var, \"user.useconfigonly\")) {\n \t\tident_use_config_only = git_config_bool(var, value);\ndiff --git a/ll-merge.c b/ll-merge.c\nindex 9f3ae1f8fe1..8955d7e1f6e 100644\n--- a/ll-merge.c\n+++ b/ll-merge.c\n@@ -250,7 +250,7 @@ static struct ll_merge_driver *ll_user_merge, **ll_user_merge_tail;\n static const char *default_ll_merge;\n \n static int read_merge_config(const char *var, const char *value,\n-\t\t\t     void *UNUSED(cb))\n+\t\t\t     void *cb UNUSED)\n {\n \tstruct ll_merge_driver *fn;\n \tconst char *key, *name;\ndiff --git a/log-tree.c b/log-tree.c\nindex 114bd80365e..ccdbf08feba 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -135,7 +135,7 @@ static int ref_filter_match(const char *refname,\n }\n \n static int add_ref_decoration(const char *refname, const struct object_id *oid,\n-\t\t\t      int UNUSED(flags),\n+\t\t\t      int flags UNUSED,\n \t\t\t      void *cb_data)\n {\n \tstruct object *obj;\ndiff --git a/ls-refs.c b/ls-refs.c\nindex e54b883e879..fa0d01b47c1 100644\n--- a/ls-refs.c\n+++ b/ls-refs.c\n@@ -137,7 +137,7 @@ static void send_possibly_unborn_head(struct ls_refs_data *data)\n }\n \n static int ls_refs_config(const char *var, const char *value,\n-\t\t\t  void *UNUSED(data))\n+\t\t\t  void *data UNUSED)\n {\n \t/*\n \t * We only serve fetches over v2 for now, so respect only \"uploadpack\"\ndiff --git a/merge-recursive.c b/merge-recursive.c\nindex 08c1c36d334..4ddd3adea00 100644\n--- a/merge-recursive.c\n+++ b/merge-recursive.c\n@@ -45,7 +45,7 @@ struct path_hashmap_entry {\n \tchar path[FLEX_ARRAY];\n };\n \n-static int path_hashmap_cmp(const void *UNUSED(cmp_data),\n+static int path_hashmap_cmp(const void *cmp_data UNUSED,\n \t\t\t    const struct hashmap_entry *eptr,\n \t\t\t    const struct hashmap_entry *entry_or_key,\n \t\t\t    const void *keydata)\n@@ -89,10 +89,10 @@ static struct dir_rename_entry *dir_rename_find_entry(struct hashmap *hashmap,\n \treturn hashmap_get_entry(hashmap, &key, ent, NULL);\n }\n \n-static int dir_rename_cmp(const void *UNUSED(cmp_data),\n+static int dir_rename_cmp(const void *cmp_data UNUSED,\n \t\t\t  const struct hashmap_entry *eptr,\n \t\t\t  const struct hashmap_entry *entry_or_key,\n-\t\t\t  const void *UNUSED(keydata))\n+\t\t\t  const void *keydata UNUSED)\n {\n \tconst struct dir_rename_entry *e1, *e2;\n \n@@ -134,10 +134,10 @@ static struct collision_entry *collision_find_entry(struct hashmap *hashmap,\n \treturn hashmap_get_entry(hashmap, &key, ent, NULL);\n }\n \n-static int collision_cmp(const void *UNUSED(cmp_data),\n+static int collision_cmp(const void *cmp_data UNUSED,\n \t\t\t const struct hashmap_entry *eptr,\n \t\t\t const struct hashmap_entry *entry_or_key,\n-\t\t\t const void *UNUSED(keydata))\n+\t\t\t const void *keydata UNUSED)\n {\n \tconst struct collision_entry *e1, *e2;\n \n@@ -456,7 +456,7 @@ static void unpack_trees_finish(struct merge_options *opt)\n \tclear_unpack_trees_porcelain(&opt->priv->unpack_opts);\n }\n \n-static int save_files_dirs(const struct object_id *UNUSED(oid),\n+static int save_files_dirs(const struct object_id *oid UNUSED,\n \t\t\t   struct strbuf *base, const char *path,\n \t\t\t   unsigned int mode, void *context)\n {\ndiff --git a/name-hash.c b/name-hash.c\nindex d0da6db5646..cd009c7c8ae 100644\n--- a/name-hash.c\n+++ b/name-hash.c\n@@ -18,7 +18,7 @@ struct dir_entry {\n \tchar name[FLEX_ARRAY];\n };\n \n-static int dir_entry_cmp(const void *UNUSED(cmp_data),\n+static int dir_entry_cmp(const void *cmp_data UNUSED,\n \t\t\t const struct hashmap_entry *eptr,\n \t\t\t const struct hashmap_entry *entry_or_key,\n \t\t\t const void *keydata)\n@@ -120,7 +120,7 @@ static void hash_index_entry(struct index_state *istate, struct cache_entry *ce)\n \t\tadd_dir_entry(istate, ce);\n }\n \n-static int cache_entry_cmp(const void *UNUSED(cmp_data),\n+static int cache_entry_cmp(const void *cmp_data UNUSED,\n \t\t\t   const struct hashmap_entry *eptr,\n \t\t\t   const struct hashmap_entry *entry_or_key,\n \t\t\t   const void *remove)\ndiff --git a/negotiator/default.c b/negotiator/default.c\nindex 10f0a46e624..b7e79feaf04 100644\n--- a/negotiator/default.c\n+++ b/negotiator/default.c\n@@ -36,8 +36,8 @@ static void rev_list_push(struct negotiation_state *ns,\n }\n \n static int clear_marks(const char *refname, const struct object_id *oid,\n-\t\t       int UNUSED(flag),\n-\t\t       void *UNUSED(cb_data))\n+\t\t       int flag UNUSED,\n+\t\t       void *cb_data UNUSED)\n {\n \tstruct object *o = deref_tag(the_repository, parse_object(the_repository, oid), refname, 0);\n \ndiff --git a/negotiator/skipping.c b/negotiator/skipping.c\nindex f2aa58af923..c4398f5ae15 100644\n--- a/negotiator/skipping.c\n+++ b/negotiator/skipping.c\n@@ -72,8 +72,8 @@ static struct entry *rev_list_push(struct data *data, struct commit *commit, int\n }\n \n static int clear_marks(const char *refname, const struct object_id *oid,\n-\t\t       int UNUSED(flag),\n-\t\t       void *UNUSED(cb_data))\n+\t\t       int flag UNUSED,\n+\t\t       void *cb_data UNUSED)\n {\n \tstruct object *o = deref_tag(the_repository, parse_object(the_repository, oid), refname, 0);\n \ndiff --git a/notes.c b/notes.c\nindex 3be98e70851..94074afe17a 100644\n--- a/notes.c\n+++ b/notes.c\n@@ -925,8 +925,8 @@ int combine_notes_cat_sort_uniq(struct object_id *cur_oid,\n }\n \n static int string_list_add_one_ref(const char *refname,\n-\t\t\t\t   const struct object_id *UNUSED(oid),\n-\t\t\t\t   int UNUSED(flag), void *cb)\n+\t\t\t\t   const struct object_id *oid UNUSED,\n+\t\t\t\t   int flag UNUSED, void *cb)\n {\n \tstruct string_list *refs = cb;\n \tif (!unsorted_string_list_has_string(refs, refname))\ndiff --git a/object-name.c b/object-name.c\nindex 3f7fce83224..2dd1a0f56e1 100644\n--- a/object-name.c\n+++ b/object-name.c\n@@ -1306,7 +1306,7 @@ struct handle_one_ref_cb {\n };\n \n static int handle_one_ref(const char *path, const struct object_id *oid,\n-\t\t\t  int UNUSED(flag),\n+\t\t\t  int flag UNUSED,\n \t\t\t  void *cb_data)\n {\n \tstruct handle_one_ref_cb *cb = cb_data;\n@@ -1385,11 +1385,11 @@ struct grab_nth_branch_switch_cbdata {\n \tstruct strbuf *sb;\n };\n \n-static int grab_nth_branch_switch(struct object_id *UNUSED(ooid),\n-\t\t\t\t  struct object_id *UNUSED(noid),\n-\t\t\t\t  const char *UNUSED(email),\n-\t\t\t\t  timestamp_t UNUSED(timestamp),\n-\t\t\t\t  int UNUSED(tz),\n+static int grab_nth_branch_switch(struct object_id *ooid UNUSED,\n+\t\t\t\t  struct object_id *noid UNUSED,\n+\t\t\t\t  const char *email UNUSED,\n+\t\t\t\t  timestamp_t timestamp UNUSED,\n+\t\t\t\t  int tz UNUSED,\n \t\t\t\t  const char *message, void *cb_data)\n {\n \tstruct grab_nth_branch_switch_cbdata *cb = cb_data;\ndiff --git a/object-store.h b/object-store.h\nindex cf5494af807..1be57abaf10 100644\n--- a/object-store.h\n+++ b/object-store.h\n@@ -141,7 +141,7 @@ struct packed_git {\n \n struct multi_pack_index;\n \n-static inline int pack_map_entry_cmp(const void *UNUSED(cmp_data),\n+static inline int pack_map_entry_cmp(const void *cmp_data UNUSED,\n \t\t\t\t     const struct hashmap_entry *entry,\n \t\t\t\t     const struct hashmap_entry *entry2,\n \t\t\t\t     const void *keydata)\ndiff --git a/oidmap.c b/oidmap.c\nindex 32aeb0526fe..49965fe8568 100644\n--- a/oidmap.c\n+++ b/oidmap.c\n@@ -1,7 +1,7 @@\n #include \"cache.h\"\n #include \"oidmap.h\"\n \n-static int oidmap_neq(const void *UNUSED(hashmap_cmp_fn_data),\n+static int oidmap_neq(const void *hashmap_cmp_fn_data UNUSED,\n \t\t      const struct hashmap_entry *e1,\n \t\t      const struct hashmap_entry *e2,\n \t\t      const void *keydata)\ndiff --git a/packfile.c b/packfile.c\nindex d7cf8382dee..bee8583119e 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -1392,7 +1392,7 @@ static int delta_base_cache_key_eq(const struct delta_base_cache_key *a,\n \treturn a->p == b->p && a->base_offset == b->base_offset;\n }\n \n-static int delta_base_cache_hash_cmp(const void *UNUSED(cmp_data),\n+static int delta_base_cache_hash_cmp(const void *cmp_data UNUSED,\n \t\t\t\t     const struct hashmap_entry *va,\n \t\t\t\t     const struct hashmap_entry *vb,\n \t\t\t\t     const void *vkey)\ndiff --git a/pager.c b/pager.c\nindex 19c016ff549..b66bbff2785 100644\n--- a/pager.c\n+++ b/pager.c\n@@ -39,7 +39,7 @@ static void wait_for_pager_signal(int signo)\n }\n \n static int core_pager_config(const char *var, const char *value,\n-\t\t\t     void *UNUSED(data))\n+\t\t\t     void *data UNUSED)\n {\n \tif (!strcmp(var, \"core.pager\"))\n \t\treturn git_config_string(&pager_program, var, value);\ndiff --git a/patch-ids.c b/patch-ids.c\nindex cdfa5135490..46c6a8f3eab 100644\n--- a/patch-ids.c\n+++ b/patch-ids.c\n@@ -38,7 +38,7 @@ int commit_patch_id(struct commit *commit, struct diff_options *options,\n static int patch_id_neq(const void *cmpfn_data,\n \t\t\tconst struct hashmap_entry *eptr,\n \t\t\tconst struct hashmap_entry *entry_or_key,\n-\t\t\tconst void *UNUSED(keydata))\n+\t\t\tconst void *keydata UNUSED)\n {\n \t/* NEEDSWORK: const correctness? */\n \tstruct diff_options *opt = (void *)cmpfn_data;\ndiff --git a/pretty.c b/pretty.c\nindex 584026b7469..f0277bd42b9 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -44,7 +44,7 @@ static void save_user_format(struct rev_info *rev, const char *cp, int is_tforma\n }\n \n static int git_pretty_formats_config(const char *var, const char *value,\n-\t\t\t\t     void *UNUSED(cb))\n+\t\t\t\t     void *cb UNUSED)\n {\n \tstruct cmt_fmt_map *commit_format = NULL;\n \tconst char *name;\ndiff --git a/range-diff.c b/range-diff.c\nindex 1528fdd0db8..462710ffe40 100644\n--- a/range-diff.c\n+++ b/range-diff.c\n@@ -224,7 +224,7 @@ static int read_patches(const char *range, struct string_list *list,\n \treturn ret;\n }\n \n-static int patch_util_cmp(const void *UNUSED(cmp_data),\n+static int patch_util_cmp(const void *cmp_data UNUSED,\n \t\t\t  const struct patch_util *a,\n \t\t\t  const struct patch_util *b,\n \t\t\t  const char *keydata)\ndiff --git a/ref-filter.c b/ref-filter.c\nindex baf252b77d6..fd1cb14b0f1 100644\n--- a/ref-filter.c\n+++ b/ref-filter.c\n@@ -89,7 +89,7 @@ struct ref_to_worktree_entry {\n \tstruct worktree *wt; /* key is wt->head_ref */\n };\n \n-static int ref_to_worktree_map_cmpfnc(const void *UNUSED(lookupdata),\n+static int ref_to_worktree_map_cmpfnc(const void *lookupdata UNUSED,\n \t\t\t\t      const struct hashmap_entry *eptr,\n \t\t\t\t      const struct hashmap_entry *kptr,\n \t\t\t\t      const void *keydata_aka_refname)\ndiff --git a/reflog.c b/reflog.c\nindex 56ea3ba7624..d258fd31995 100644\n--- a/reflog.c\n+++ b/reflog.c\n@@ -240,9 +240,9 @@ static int unreachable(struct expire_reflog_policy_cb *cb, struct commit *commit\n  * Return true iff the specified reflog entry should be expired.\n  */\n int should_expire_reflog_ent(struct object_id *ooid, struct object_id *noid,\n-\t\t\t     const char *UNUSED(email),\n-\t\t\t     timestamp_t timestamp, int UNUSED(tz),\n-\t\t\t     const char *UNUSED(message), void *cb_data)\n+\t\t\t     const char *email UNUSED,\n+\t\t\t     timestamp_t timestamp, int tz UNUSED,\n+\t\t\t     const char *message UNUSED, void *cb_data)\n {\n \tstruct expire_reflog_policy_cb *cb = cb_data;\n \tstruct commit *old_commit, *new_commit;\n@@ -295,7 +295,7 @@ int should_expire_reflog_ent_verbose(struct object_id *ooid,\n \treturn expire;\n }\n \n-static int push_tip_to_list(const char *UNUSED(refname),\n+static int push_tip_to_list(const char *refname UNUSED,\n \t\t\t    const struct object_id *oid,\n \t\t\t    int flags, void *cb_data)\n {\n@@ -380,11 +380,11 @@ void reflog_expiry_cleanup(void *cb_data)\n \t}\n }\n \n-int count_reflog_ent(struct object_id *UNUSED(ooid),\n-\t\t     struct object_id *UNUSED(noid),\n-\t\t     const char *UNUSED(email),\n-\t\t     timestamp_t timestamp, int UNUSED(tz),\n-\t\t     const char *UNUSED(message), void *cb_data)\n+int count_reflog_ent(struct object_id *ooid UNUSED,\n+\t\t     struct object_id *noid UNUSED,\n+\t\t     const char *email UNUSED,\n+\t\t     timestamp_t timestamp, int tz UNUSED,\n+\t\t     const char *message UNUSED, void *cb_data)\n {\n \tstruct cmd_reflog_expire_cb *cb = cb_data;\n \tif (!cb->expire_total || timestamp < cb->expire_total)\ndiff --git a/refs.c b/refs.c\nindex 5012bba3578..b1b3077ecc5 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -359,7 +359,7 @@ struct warn_if_dangling_data {\n };\n \n static int warn_if_dangling_symref(const char *refname,\n-\t\t\t\t   const struct object_id *UNUSED(oid),\n+\t\t\t\t   const struct object_id *oid UNUSED,\n \t\t\t\t   int flags, void *cb_data)\n {\n \tstruct warn_if_dangling_data *d = cb_data;\n@@ -894,7 +894,7 @@ static void set_read_ref_cutoffs(struct read_ref_at_cb *cb,\n }\n \n static int read_ref_at_ent(struct object_id *ooid, struct object_id *noid,\n-\t\t\t   const char *UNUSED(email),\n+\t\t\t   const char *email UNUSED,\n \t\t\t   timestamp_t timestamp, int tz,\n \t\t\t   const char *message, void *cb_data)\n {\n@@ -936,9 +936,9 @@ static int read_ref_at_ent(struct object_id *ooid, struct object_id *noid,\n \treturn cb->found_it;\n }\n \n-static int read_ref_at_ent_newest(struct object_id *UNUSED(ooid),\n+static int read_ref_at_ent_newest(struct object_id *ooid UNUSED,\n \t\t\t\t  struct object_id *noid,\n-\t\t\t\t  const char *UNUSED(email),\n+\t\t\t\t  const char *email UNUSED,\n \t\t\t\t  timestamp_t timestamp, int tz,\n \t\t\t\t  const char *message, void *cb_data)\n {\n@@ -951,7 +951,7 @@ static int read_ref_at_ent_newest(struct object_id *UNUSED(ooid),\n }\n \n static int read_ref_at_ent_oldest(struct object_id *ooid, struct object_id *noid,\n-\t\t\t\t  const char *UNUSED(email),\n+\t\t\t\t  const char *email UNUSED,\n \t\t\t\t  timestamp_t timestamp, int tz,\n \t\t\t\t  const char *message, void *cb_data)\n {\n@@ -1815,7 +1815,7 @@ struct ref_store_hash_entry\n \tchar name[FLEX_ARRAY];\n };\n \n-static int ref_store_hash_cmp(const void *UNUSED(cmp_data),\n+static int ref_store_hash_cmp(const void *cmp_data UNUSED,\n \t\t\t      const struct hashmap_entry *eptr,\n \t\t\t      const struct hashmap_entry *entry_or_key,\n \t\t\t      const void *keydata)\ndiff --git a/refs/files-backend.c b/refs/files-backend.c\nindex 13bfdb7701d..e4009b3c421 100644\n--- a/refs/files-backend.c\n+++ b/refs/files-backend.c\n@@ -2202,8 +2202,8 @@ static int files_reflog_iterator_advance(struct ref_iterator *ref_iterator)\n \treturn ok;\n }\n \n-static int files_reflog_iterator_peel(struct ref_iterator *UNUSED(ref_iterator),\n-\t\t\t\t      struct object_id *UNUSED(peeled))\n+static int files_reflog_iterator_peel(struct ref_iterator *ref_iterator UNUSED,\n+\t\t\t\t      struct object_id *peeled UNUSED)\n {\n \tBUG(\"ref_iterator_peel() called for reflog_iterator\");\n }\n@@ -2257,7 +2257,7 @@ static struct ref_iterator *reflog_iterator_begin(struct ref_store *ref_store,\n static enum iterator_selection reflog_iterator_select(\n \tstruct ref_iterator *iter_worktree,\n \tstruct ref_iterator *iter_common,\n-\tvoid *UNUSED(cb_data))\n+\tvoid *cb_data UNUSED)\n {\n \tif (iter_worktree) {\n \t\t/*\n@@ -2985,7 +2985,7 @@ static int files_transaction_finish(struct ref_store *ref_store,\n \n static int files_transaction_abort(struct ref_store *ref_store,\n \t\t\t\t   struct ref_transaction *transaction,\n-\t\t\t\t   struct strbuf *UNUSED(err))\n+\t\t\t\t   struct strbuf *err UNUSED)\n {\n \tstruct files_ref_store *refs =\n \t\tfiles_downcast(ref_store, 0, \"ref_transaction_abort\");\n@@ -2995,8 +2995,8 @@ static int files_transaction_abort(struct ref_store *ref_store,\n }\n \n static int ref_present(const char *refname,\n-\t\t       const struct object_id *UNUSED(oid),\n-\t\t       int UNUSED(flags),\n+\t\t       const struct object_id *oid UNUSED,\n+\t\t       int flags UNUSED,\n \t\t       void *cb_data)\n {\n \tstruct string_list *affected_refnames = cb_data;\n@@ -3261,7 +3261,7 @@ static int files_reflog_expire(struct ref_store *ref_store,\n \treturn -1;\n }\n \n-static int files_init_db(struct ref_store *ref_store, struct strbuf *UNUSED(err))\n+static int files_init_db(struct ref_store *ref_store, struct strbuf *err UNUSED)\n {\n \tstruct files_ref_store *refs =\n \t\tfiles_downcast(ref_store, REF_STORE_WRITE, \"init_db\");\ndiff --git a/refs/iterator.c b/refs/iterator.c\nindex e34921db729..c9fd0bcaf90 100644\n--- a/refs/iterator.c\n+++ b/refs/iterator.c\n@@ -51,8 +51,8 @@ static int empty_ref_iterator_advance(struct ref_iterator *ref_iterator)\n \treturn ref_iterator_abort(ref_iterator);\n }\n \n-static int empty_ref_iterator_peel(struct ref_iterator *UNUSED(ref_iterator),\n-\t\t\t\t   struct object_id *UNUSED(peeled))\n+static int empty_ref_iterator_peel(struct ref_iterator *ref_iterator UNUSED,\n+\t\t\t\t   struct object_id *peeled UNUSED)\n {\n \tBUG(\"peel called for empty iterator\");\n }\n@@ -238,7 +238,7 @@ struct ref_iterator *merge_ref_iterator_begin(\n  */\n static enum iterator_selection overlay_iterator_select(\n \t\tstruct ref_iterator *front, struct ref_iterator *back,\n-\t\tvoid *UNUSED(cb_data))\n+\t\tvoid *cb_data UNUSED)\n {\n \tint cmp;\n \ndiff --git a/refs/packed-backend.c b/refs/packed-backend.c\nindex a45bb686f0b..43cdb97f8b3 100644\n--- a/refs/packed-backend.c\n+++ b/refs/packed-backend.c\n@@ -726,7 +726,7 @@ static struct snapshot *get_snapshot(struct packed_ref_store *refs)\n }\n \n static int packed_read_raw_ref(struct ref_store *ref_store, const char *refname,\n-\t\t\t       struct object_id *oid, struct strbuf *UNUSED(referent),\n+\t\t\t       struct object_id *oid, struct strbuf *referent UNUSED,\n \t\t\t       unsigned int *type, int *failure_errno)\n {\n \tstruct packed_ref_store *refs =\n@@ -1078,8 +1078,8 @@ int packed_refs_is_locked(struct ref_store *ref_store)\n static const char PACKED_REFS_HEADER[] =\n \t\"# pack-refs with: peeled fully-peeled sorted \\n\";\n \n-static int packed_init_db(struct ref_store *UNUSED(ref_store),\n-\t\t\t  struct strbuf *UNUSED(err))\n+static int packed_init_db(struct ref_store *ref_store UNUSED,\n+\t\t\t  struct strbuf *err UNUSED)\n {\n \t/* Nothing to do. */\n \treturn 0;\n@@ -1474,7 +1474,7 @@ static int packed_transaction_prepare(struct ref_store *ref_store,\n \n static int packed_transaction_abort(struct ref_store *ref_store,\n \t\t\t\t    struct ref_transaction *transaction,\n-\t\t\t\t    struct strbuf *UNUSED(err))\n+\t\t\t\t    struct strbuf *err UNUSED)\n {\n \tstruct packed_ref_store *refs = packed_downcast(\n \t\t\tref_store,\n@@ -1513,7 +1513,7 @@ static int packed_transaction_finish(struct ref_store *ref_store,\n \treturn ret;\n }\n \n-static int packed_initial_transaction_commit(struct ref_store *UNUSED(ref_store),\n+static int packed_initial_transaction_commit(struct ref_store *ref_store UNUSED,\n \t\t\t\t\t    struct ref_transaction *transaction,\n \t\t\t\t\t    struct strbuf *err)\n {\n@@ -1569,8 +1569,8 @@ static int packed_delete_refs(struct ref_store *ref_store, const char *msg,\n \treturn ret;\n }\n \n-static int packed_pack_refs(struct ref_store *UNUSED(ref_store),\n-\t\t\t    unsigned int UNUSED(flags))\n+static int packed_pack_refs(struct ref_store *ref_store UNUSED,\n+\t\t\t    unsigned int flags UNUSED)\n {\n \t/*\n \t * Packed refs are already packed. It might be that loose refs\n@@ -1580,7 +1580,7 @@ static int packed_pack_refs(struct ref_store *UNUSED(ref_store),\n \treturn 0;\n }\n \n-static struct ref_iterator *packed_reflog_iterator_begin(struct ref_store *UNUSED(ref_store))\n+static struct ref_iterator *packed_reflog_iterator_begin(struct ref_store *ref_store UNUSED)\n {\n \treturn empty_ref_iterator_begin();\n }\ndiff --git a/remote.c b/remote.c\nindex ef12aba91dc..60869beebe7 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -86,7 +86,7 @@ struct remotes_hash_key {\n \tint len;\n };\n \n-static int remotes_hash_cmp(const void *UNUSED(cmp_data),\n+static int remotes_hash_cmp(const void *cmp_data UNUSED,\n \t\t\t    const struct hashmap_entry *eptr,\n \t\t\t    const struct hashmap_entry *entry_or_key,\n \t\t\t    const void *keydata)\n@@ -170,7 +170,7 @@ struct branches_hash_key {\n \tint len;\n };\n \n-static int branches_hash_cmp(const void *UNUSED(cmp_data),\n+static int branches_hash_cmp(const void *cmp_data UNUSED,\n \t\t\t     const struct hashmap_entry *eptr,\n \t\t\t     const struct hashmap_entry *entry_or_key,\n \t\t\t     const void *keydata)\n@@ -2320,7 +2320,7 @@ int format_tracking_info(struct branch *branch, struct strbuf *sb,\n }\n \n static int one_local_ref(const char *refname, const struct object_id *oid,\n-\t\t\t int UNUSED(flag),\n+\t\t\t int flag UNUSED,\n \t\t\t void *cb_data)\n {\n \tstruct ref ***local_tail = cb_data;\n@@ -2577,22 +2577,22 @@ struct check_and_collect_until_cb_data {\n };\n \n /* Get the timestamp of the latest entry. */\n-static int peek_reflog(struct object_id *UNUSED(o_oid),\n-\t\t       struct object_id *UNUSED(n_oid),\n-\t\t       const char *UNUSED(ident),\n-\t\t       timestamp_t timestamp, int UNUSED(tz),\n-\t\t       const char *UNUSED(message), void *cb_data)\n+static int peek_reflog(struct object_id *o_oid UNUSED,\n+\t\t       struct object_id *n_oid UNUSED,\n+\t\t       const char *ident UNUSED,\n+\t\t       timestamp_t timestamp, int tz UNUSED,\n+\t\t       const char *message UNUSED, void *cb_data)\n {\n \ttimestamp_t *ts = cb_data;\n \t*ts = timestamp;\n \treturn 1;\n }\n \n-static int check_and_collect_until(struct object_id *UNUSED(o_oid),\n+static int check_and_collect_until(struct object_id *o_oid UNUSED,\n \t\t\t\t   struct object_id *n_oid,\n-\t\t\t\t   const char *UNUSED(ident),\n-\t\t\t\t   timestamp_t timestamp, int UNUSED(tz),\n-\t\t\t\t   const char *UNUSED(message), void *cb_data)\n+\t\t\t\t   const char *ident UNUSED,\n+\t\t\t\t   timestamp_t timestamp, int tz UNUSED,\n+\t\t\t\t   const char *message UNUSED, void *cb_data)\n {\n \tstruct commit *commit;\n \tstruct check_and_collect_until_cb_data *cb = cb_data;\ndiff --git a/replace-object.c b/replace-object.c\nindex 17810e5a3ac..320be2522d8 100644\n--- a/replace-object.c\n+++ b/replace-object.c\n@@ -9,8 +9,8 @@\n static int register_replace_ref(struct repository *r,\n \t\t\t\tconst char *refname,\n \t\t\t\tconst struct object_id *oid,\n-\t\t\t\tint UNUSED(flag),\n-\t\t\t\tvoid *UNUSED(cb_data))\n+\t\t\t\tint flag UNUSED,\n+\t\t\t\tvoid *cb_data UNUSED)\n {\n \t/* Get sha1 from refname */\n \tconst char *slash = strrchr(refname, '/');\ndiff --git a/revision.c b/revision.c\nindex 5eb71e32d0d..5451a698ec3 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -119,10 +119,10 @@ struct path_and_oids_entry {\n \tstruct oidset trees;\n };\n \n-static int path_and_oids_cmp(const void *UNUSED(hashmap_cmp_fn_data),\n+static int path_and_oids_cmp(const void *hashmap_cmp_fn_data UNUSED,\n \t\t\t     const struct hashmap_entry *eptr,\n \t\t\t     const struct hashmap_entry *entry_or_key,\n-\t\t\t     const void *UNUSED(keydata))\n+\t\t\t     const void *keydata UNUSED)\n {\n \tconst struct path_and_oids_entry *e1, *e2;\n \n@@ -1543,7 +1543,7 @@ int ref_excluded(struct string_list *ref_excludes, const char *path)\n }\n \n static int handle_one_ref(const char *path, const struct object_id *oid,\n-\t\t\t  int UNUSED(flag),\n+\t\t\t  int flag UNUSED,\n \t\t\t  void *cb_data)\n {\n \tstruct all_refs_cb *cb = cb_data;\n@@ -1619,10 +1619,10 @@ static void handle_one_reflog_commit(struct object_id *oid, void *cb_data)\n }\n \n static int handle_one_reflog_ent(struct object_id *ooid, struct object_id *noid,\n-\t\t\t\t const char *UNUSED(email),\n-\t\t\t\t timestamp_t UNUSED(timestamp),\n-\t\t\t\t int UNUSED(tz),\n-\t\t\t\t const char *UNUSED(message),\n+\t\t\t\t const char *email UNUSED,\n+\t\t\t\t timestamp_t timestamp UNUSED,\n+\t\t\t\t int tz UNUSED,\n+\t\t\t\t const char *message UNUSED,\n \t\t\t\t void *cb_data)\n {\n \thandle_one_reflog_commit(ooid, cb_data);\n@@ -1631,8 +1631,8 @@ static int handle_one_reflog_ent(struct object_id *ooid, struct object_id *noid,\n }\n \n static int handle_one_reflog(const char *refname_in_wt,\n-\t\t\t     const struct object_id *UNUSED(oid),\n-\t\t\t     int UNUSED(flag), void *cb_data)\n+\t\t\t     const struct object_id *oid UNUSED,\n+\t\t\t     int flag UNUSED, void *cb_data)\n {\n \tstruct all_refs_cb *cb = cb_data;\n \tstruct strbuf refname = STRBUF_INIT;\ndiff --git a/send-pack.c b/send-pack.c\nindex 7e99c64e6b8..f2e19838c9c 100644\n--- a/send-pack.c\n+++ b/send-pack.c\n@@ -266,7 +266,7 @@ static int receive_status(struct packet_reader *reader, struct ref *refs)\n \treturn ret;\n }\n \n-static int sideband_demux(int UNUSED(in), int out, void *data)\n+static int sideband_demux(int in UNUSED, int out, void *data)\n {\n \tint *fd = data, ret;\n \tif (async_with_fork())\ndiff --git a/sequencer.c b/sequencer.c\nindex e5b52651f88..3ac82f9ebed 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -5254,7 +5254,7 @@ struct labels_entry {\n \tchar label[FLEX_ARRAY];\n };\n \n-static int labels_cmp(const void *UNUSED(fndata),\n+static int labels_cmp(const void *fndata UNUSED,\n \t\t      const struct hashmap_entry *eptr,\n \t\t      const struct hashmap_entry *entry_or_key, const void *key)\n {\n@@ -6132,7 +6132,7 @@ struct subject2item_entry {\n \tchar subject[FLEX_ARRAY];\n };\n \n-static int subject2item_cmp(const void *UNUSED(fndata),\n+static int subject2item_cmp(const void *fndata UNUSED,\n \t\t\t    const struct hashmap_entry *eptr,\n \t\t\t    const struct hashmap_entry *entry_or_key,\n \t\t\t    const void *key)\ndiff --git a/server-info.c b/server-info.c\nindex d99d9d5f619..0ec6c0c1654 100644\n--- a/server-info.c\n+++ b/server-info.c\n@@ -147,7 +147,7 @@ static int update_info_file(char *path,\n }\n \n static int add_info_ref(const char *path, const struct object_id *oid,\n-\t\t\tint UNUSED(flag),\n+\t\t\tint flag UNUSED,\n \t\t\tvoid *cb_data)\n {\n \tstruct update_info_ctx *uic = cb_data;\ndiff --git a/shallow.c b/shallow.c\nindex 71ab04f935c..17f9bcdb5f3 100644\n--- a/shallow.c\n+++ b/shallow.c\n@@ -604,10 +604,10 @@ static void paint_down(struct paint_info *info, const struct object_id *oid,\n \tfree(tmp);\n }\n \n-static int mark_uninteresting(const char *UNUSED(refname),\n+static int mark_uninteresting(const char *refname UNUSED,\n \t\t\t      const struct object_id *oid,\n-\t\t\t      int UNUSED(flags),\n-\t\t\t      void *UNUSED(cb_data))\n+\t\t\t      int flags UNUSED,\n+\t\t\t      void *cb_data UNUSED)\n {\n \tstruct commit *commit = lookup_commit_reference_gently(the_repository,\n \t\t\t\t\t\t\t       oid, 1);\n@@ -717,9 +717,9 @@ struct commit_array {\n \tint nr, alloc;\n };\n \n-static int add_ref(const char *UNUSED(refname),\n+static int add_ref(const char *refname UNUSED,\n \t\t   const struct object_id *oid,\n-\t\t   int UNUSED(flags),\n+\t\t   int flags UNUSED,\n \t\t   void *cb_data)\n {\n \tstruct commit_array *ca = cb_data;\ndiff --git a/strbuf.c b/strbuf.c\nindex dd9eb85527a..0890b1405c5 100644\n--- a/strbuf.c\n+++ b/strbuf.c\n@@ -436,7 +436,7 @@ void strbuf_expand(struct strbuf *sb, const char *format, expand_fn_t fn,\n \n size_t strbuf_expand_literal_cb(struct strbuf *sb,\n \t\t\t\tconst char *placeholder,\n-\t\t\t\tvoid *context)\n+\t\t\t\tvoid *context UNUSED)\n {\n \tint ch;\n \ndiff --git a/streaming.c b/streaming.c\nindex 4b34e2a748d..7b2f8b2b938 100644\n--- a/streaming.c\n+++ b/streaming.c\n@@ -328,9 +328,9 @@ static int close_istream_pack_non_delta(struct git_istream *st)\n }\n \n static int open_istream_pack_non_delta(struct git_istream *st,\n-\t\t\t\t       struct repository *UNUSED(r),\n-\t\t\t\t       const struct object_id *UNUSED(oid),\n-\t\t\t\t       enum object_type *UNUSED(type))\n+\t\t\t\t       struct repository *r UNUSED,\n+\t\t\t\t       const struct object_id *oid UNUSED,\n+\t\t\t\t       enum object_type *type UNUSED)\n {\n \tstruct pack_window *window;\n \tenum object_type in_pack_type;\ndiff --git a/strmap.c b/strmap.c\nindex 4e79734e4f9..c7b9c52174c 100644\n--- a/strmap.c\n+++ b/strmap.c\n@@ -2,10 +2,10 @@\n #include \"strmap.h\"\n #include \"mem-pool.h\"\n \n-int cmp_strmap_entry(const void *UNUSED(hashmap_cmp_fn_data),\n+int cmp_strmap_entry(const void *hashmap_cmp_fn_data UNUSED,\n \t\t     const struct hashmap_entry *entry1,\n \t\t     const struct hashmap_entry *entry2,\n-\t\t     const void *UNUSED(keydata))\n+\t\t     const void *keydata UNUSED)\n {\n \tconst struct strmap_entry *e1, *e2;\n \ndiff --git a/sub-process.c b/sub-process.c\nindex bd6a372a670..6d4232294db 100644\n--- a/sub-process.c\n+++ b/sub-process.c\n@@ -5,10 +5,10 @@\n #include \"sigchain.h\"\n #include \"pkt-line.h\"\n \n-int cmd2process_cmp(const void *UNUSED(cmp_data),\n+int cmd2process_cmp(const void *cmp_data UNUSED,\n \t\t    const struct hashmap_entry *eptr,\n \t\t    const struct hashmap_entry *entry_or_key,\n-\t\t    const void *UNUSED(keydata))\n+\t\t    const void *keydata UNUSED)\n {\n \tconst struct subprocess_entry *e1, *e2;\n \ndiff --git a/submodule-config.c b/submodule-config.c\nindex d7a8ca0269a..cd7ee236a12 100644\n--- a/submodule-config.c\n+++ b/submodule-config.c\n@@ -38,10 +38,10 @@ enum lookup_type {\n \tlookup_path\n };\n \n-static int config_path_cmp(const void *UNUSED(cmp_data),\n+static int config_path_cmp(const void *cmp_data UNUSED,\n \t\t\t   const struct hashmap_entry *eptr,\n \t\t\t   const struct hashmap_entry *entry_or_key,\n-\t\t\t   const void *UNUSED(keydata))\n+\t\t\t   const void *keydata UNUSED)\n {\n \tconst struct submodule_entry *a, *b;\n \n@@ -52,10 +52,10 @@ static int config_path_cmp(const void *UNUSED(cmp_data),\n \t       !oideq(&a->config->gitmodules_oid, &b->config->gitmodules_oid);\n }\n \n-static int config_name_cmp(const void *UNUSED(cmp_data),\n+static int config_name_cmp(const void *cmp_data UNUSED,\n \t\t\t   const struct hashmap_entry *eptr,\n \t\t\t   const struct hashmap_entry *entry_or_key,\n-\t\t\t   const void *UNUSED(keydata))\n+\t\t\t   const void *keydata UNUSED)\n {\n \tconst struct submodule_entry *a, *b;\n \ndiff --git a/submodule.c b/submodule.c\nindex 597a347f859..7455b618ead 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -214,7 +214,7 @@ void set_diffopt_flags_from_submodule_config(struct diff_options *diffopt,\n \n /* Cheap function that only determines if we're interested in submodules at all */\n int git_default_submodule_config(const char *var, const char *value,\n-\t\t\t\t void *UNUSED(cb))\n+\t\t\t\t void *cb UNUSED)\n {\n \tif (!strcmp(var, \"submodule.recurse\")) {\n \t\tint v = git_config_bool(var, value) ?\n@@ -941,9 +941,9 @@ static void free_submodules_data(struct string_list *submodules)\n \tstring_list_clear(submodules, 1);\n }\n \n-static int has_remote(const char *UNUSED(refname),\n-\t\t      const struct object_id *UNUSED(oid),\n-\t\t      int UNUSED(flags), void *UNUSED(cb_data))\n+static int has_remote(const char *refname UNUSED,\n+\t\t      const struct object_id *oid UNUSED,\n+\t\t      int flags UNUSED, void *cb_data UNUSED)\n {\n \treturn 1;\n }\n@@ -1245,9 +1245,9 @@ int push_unpushed_submodules(struct repository *r,\n \treturn ret;\n }\n \n-static int append_oid_to_array(const char *UNUSED(ref),\n+static int append_oid_to_array(const char *ref UNUSED,\n \t\t\t       const struct object_id *oid,\n-\t\t\t       int UNUSED(flags), void *data)\n+\t\t\t       int flags UNUSED, void *data)\n {\n \tstruct oid_array *array = data;\n \toid_array_append(array, oid);\ndiff --git a/t/helper/test-config.c b/t/helper/test-config.c\nindex ddd538b838d..4ba9eb65606 100644\n--- a/t/helper/test-config.c\n+++ b/t/helper/test-config.c\n@@ -37,7 +37,7 @@\n  *\n  */\n \n-static int iterate_cb(const char *var, const char *value, void *UNUSED(data))\n+static int iterate_cb(const char *var, const char *value, void *data UNUSED)\n {\n \tstatic int nr;\n \ndiff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c\nindex 8f930ad358c..ae8a5648daf 100644\n--- a/t/helper/test-ref-store.c\n+++ b/t/helper/test-ref-store.c\n@@ -161,7 +161,7 @@ static int cmd_rename_ref(struct ref_store *refs, const char **argv)\n }\n \n static int each_ref(const char *refname, const struct object_id *oid,\n-\t\t    int flags, void *UNUSED(cb_data))\n+\t\t    int flags, void *cb_data UNUSED)\n {\n \tprintf(\"%s %s 0x%x\\n\", oid_to_hex(oid), refname, flags);\n \treturn 0;\n@@ -207,7 +207,7 @@ static int cmd_for_each_reflog(struct ref_store *refs, const char **argv)\n \n static int each_reflog(struct object_id *old_oid, struct object_id *new_oid,\n \t\t       const char *committer, timestamp_t timestamp,\n-\t\t       int tz, const char *msg, void *UNUSED(cb_data))\n+\t\t       int tz, const char *msg, void *cb_data UNUSED)\n {\n \tprintf(\"%s %s %s %\" PRItime \" %+05d%s%s\", oid_to_hex(old_oid),\n \t       oid_to_hex(new_oid), committer, timestamp, tz,\ndiff --git a/t/helper/test-userdiff.c b/t/helper/test-userdiff.c\nindex 64538a0c203..a2b56b9cae5 100644\n--- a/t/helper/test-userdiff.c\n+++ b/t/helper/test-userdiff.c\n@@ -12,7 +12,7 @@ static int driver_cb(struct userdiff_driver *driver,\n \treturn 0;\n }\n \n-static int cmd__userdiff_config(const char *var, const char *value, void *UNUSED(cb))\n+static int cmd__userdiff_config(const char *var, const char *value, void *cb UNUSED)\n {\n \tif (userdiff_config(var, value) < 0)\n \t\treturn -1;\ndiff --git a/trailer.c b/trailer.c\nindex a1e80478ab0..0fd5b142a37 100644\n--- a/trailer.c\n+++ b/trailer.c\n@@ -479,7 +479,7 @@ static struct {\n };\n \n static int git_trailer_default_config(const char *conf_key, const char *value,\n-\t\t\t\t      void *UNUSED(cb))\n+\t\t\t\t      void *cb UNUSED)\n {\n \tconst char *trailer_item, *variable_name;\n \n@@ -511,7 +511,7 @@ static int git_trailer_default_config(const char *conf_key, const char *value,\n }\n \n static int git_trailer_config(const char *conf_key, const char *value,\n-\t\t\t      void *UNUSED(cb))\n+\t\t\t      void *cb UNUSED)\n {\n \tconst char *trailer_item, *variable_name;\n \tstruct arg_item *item;\ndiff --git a/transport.c b/transport.c\nindex 551cad22dd3..999212df976 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -142,7 +142,7 @@ static void get_refs_from_bundle_inner(struct transport *transport)\n \n static struct ref *get_refs_from_bundle(struct transport *transport,\n \t\t\t\t\tint for_push,\n-\t\t\t\t\tstruct transport_ls_refs_options *UNUSED(transport_options))\n+\t\t\t\t\tstruct transport_ls_refs_options *transport_options UNUSED)\n {\n \tstruct bundle_transport_data *data = transport->data;\n \tstruct ref *result = NULL;\ndiff --git a/upload-pack.c b/upload-pack.c\nindex b2cbca1e8bc..3bdbd142b73 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -1170,7 +1170,7 @@ static int mark_our_ref(const char *refname, const char *refname_full,\n }\n \n static int check_ref(const char *refname_full, const struct object_id *oid,\n-\t\t     int UNUSED(flag), void *UNUSED(cb_data))\n+\t\t     int flag UNUSED, void *cb_data UNUSED)\n {\n \tconst char *refname = strip_namespace(refname_full);\n \n@@ -1194,7 +1194,7 @@ static void format_session_id(struct strbuf *buf, struct upload_pack_data *d) {\n }\n \n static int send_ref(const char *refname, const struct object_id *oid,\n-\t\t    int UNUSED(flag), void *cb_data)\n+\t\t    int flag UNUSED, void *cb_data)\n {\n \tstatic const char *capabilities = \"multi_ack thin-pack side-band\"\n \t\t\" side-band-64k ofs-delta shallow deepen-since deepen-not\"\n@@ -1237,7 +1237,7 @@ static int send_ref(const char *refname, const struct object_id *oid,\n }\n \n static int find_symref(const char *refname,\n-\t\t       const struct object_id *UNUSED(oid),\n+\t\t       const struct object_id *oid UNUSED,\n \t\t       int flag, void *cb_data)\n {\n \tconst char *symref_target;\ndiff --git a/walker.c b/walker.c\nindex f945d021f8c..99d0e0eae04 100644\n--- a/walker.c\n+++ b/walker.c\n@@ -215,10 +215,10 @@ static int interpret_target(struct walker *walker, char *target, struct object_i\n \treturn -1;\n }\n \n-static int mark_complete(const char *UNUSED(path),\n+static int mark_complete(const char *path UNUSED,\n \t\t\t const struct object_id *oid,\n-\t\t\t int UNUSED(flag),\n-\t\t\t void *UNUSED(cb_data))\n+\t\t\t int flag UNUSED,\n+\t\t\t void *cb_data UNUSED)\n {\n \tstruct commit *commit = lookup_commit_reference_gently(the_repository,\n \t\t\t\t\t\t\t       oid, 1);\ndiff --git a/wt-status.c b/wt-status.c\nindex 38d0900aa94..5813174896c 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -947,11 +947,11 @@ static void wt_longstatus_print_changed(struct wt_status *s)\n \twt_longstatus_print_trailer(s);\n }\n \n-static int stash_count_refs(struct object_id *UNUSED(ooid),\n-\t\t\t    struct object_id *UNUSED(noid),\n-\t\t\t    const char *UNUSED(email),\n-\t\t\t    timestamp_t UNUSED(timestamp), int UNUSED(tz),\n-\t\t\t    const char *UNUSED(message), void *cb_data)\n+static int stash_count_refs(struct object_id *ooid UNUSED,\n+\t\t\t    struct object_id *noid UNUSED,\n+\t\t\t    const char *email UNUSED,\n+\t\t\t    timestamp_t timestamp UNUSED, int tz UNUSED,\n+\t\t\t    const char *message UNUSED, void *cb_data)\n {\n \tint *c = cb_data;\n \t(*c)++;\n@@ -1614,10 +1614,10 @@ struct grab_1st_switch_cbdata {\n \tstruct object_id noid;\n };\n \n-static int grab_1st_switch(struct object_id *UNUSED(ooid),\n+static int grab_1st_switch(struct object_id *ooid UNUSED,\n \t\t\t   struct object_id *noid,\n-\t\t\t   const char *UNUSED(email),\n-\t\t\t   timestamp_t UNUSED(timestamp), int UNUSED(tz),\n+\t\t\t   const char *email UNUSED,\n+\t\t\t   timestamp_t timestamp UNUSED, int tz UNUSED,\n \t\t\t   const char *message, void *cb_data)\n {\n \tstruct grab_1st_switch_cbdata *cb = cb_data;\n-- \n2.37.2.1279.g8741a0e3ea3\n\n"},{"id":"461982","messageId":"Ywh6v8oo3nRl/O5h@coredump.intra.peff.net","threadId":"58352","inReplyTo":"220825.86ilmg4mil.gmgdl@evledraar.gmail.com","subject":"Re: [PATCH] ci: update 'static-analysis' to Ubuntu 22.04","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2022-08-26T07:48:15Z","receivedAt":"2022-08-26T07:48:20Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Aug 25, 2022 at 12:47:53PM +0200, Ævar Arnfjörð Bjarmason wrote:\n\n> What's happening here is that coccinelle can no longer properly parse\n> the file after the UNUSED() macros were applied to refs.c.\n\nUgh. Thanks for finding this.\n\nI'm a little disappointed in coccinelle here. I mean, I get that it\nprobably can't just use the output of \"gcc -E\"; it wants to see and\ntransform the code as written (and maybe even translate macros). But\nif it doesn't understand the macros enough to see inside them, there are\na lot of things it is going to get confused by.\n\nA simple example like this shows that it doesn't really see inside them:\n\n  $ cat foo.c\n  #define foo(x) bar(x)\n  static void fun(int x) { foo(x); }\n\n  $ cat foo.cocci\n  expression E;\n  @@\n  - bar(E);\n  + changed(E);\n\nI wonder what it makes of code-generation macros like\nfor_each_string_list_item(). Or all of commit-slab.\n\nLikewise, the manner in which it fails is unexpected. I could see it\ngetting confused about the line in question, but why would that cause it\nto fail to see the of a strbuf in another function entirely?\n\nI realize that pseudo-parsing C is an incredibly hard problem. But I\nalso wonder how robust the tool actually is in practice. We've had a lot\nof mystery \"now why didn't it catch this case\" incidents over the years.\nJust running the tip of master with --verbose-parsing yields quite a few\n\"bad\" and \"parse error\" entries in the log. I wonder how much that\ncontributes.\n\n> We should probably coerce coccinelle into stopping in general if it's\n> encountering \"BAD:!!!!!\" parse errors behind the scenes, as it clearly\n> results in broken logic, but offhand (and from briefly browsing the\n> manpage) I don't know a way to do that.\n\nYou could detect the BAD entries from the log and complain before\nreturning the exit code to make. But since there are several instances\nalready, I suspect it's a losing battle. We need some way to actually\n_fix_ them. And in the meantime, it does seem to _mostly_ work, as it\nclearly has some kind of resync logic.\n\n> But the fix here isn't to delete unused.cocci, but to hold off on the\n> UNUSEwork D() patches until we figure out how to make coccinelle jive with\n> them.\n\nYeah, my general skepticism and disappointment above notwithstanding,\nthis seems like the best path forward from here. I tried a few other\ntricks (like --macro-file and --iso-file), but if its parser chokes, I\ndon't think there's much we can do about it. Even if we wrote a patch to\ncoccinelle itself (and I have no interest in doing that myself), it\nwould take a while to become available.\n\n-Peff\n"},{"id":"461983","messageId":"Ywh7ppVFk6VK1Ybs@coredump.intra.peff.net","threadId":"58352","inReplyTo":"cover-0.2-00000000000-20220825T170709Z-avarab@gmail.com","subject":"Re: [PATCH 0/2] git-compat-util.h: change UNUSED(var) to UNUSED","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2022-08-26T07:52:06Z","receivedAt":"2022-08-26T07:52:10Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Aug 25, 2022 at 07:09:47PM +0200, Ævar Arnfjörð Bjarmason wrote:\n\n> Ævar Arnfjörð Bjarmason (2):\n>   git-compat-util.h: use \"UNUSED\", not \"UNUSED(var)\"\n>   git-compat-util.h: use \"deprecated\" for UNUSED variables\n\nSo I don't love this, as I do find the resulting syntax harder to read.\nBut I don't really see a way around it to keep coccinelle functioning,\nso it seems like the best (only?) path forward.\n\nThe patches themselves look OK to me (though I admit my eyes glazed over\nhalfway through the first one; I assume you used a regex. I'll have to\ndo the same for the other 100+ patches I have in reserve).\n\n-Peff\n"},{"id":"462004","messageId":"xmqqczcnymtd.fsf@gitster.g","threadId":"58352","inReplyTo":"Ywh6v8oo3nRl/O5h@coredump.intra.peff.net","subject":"Re: [PATCH] ci: update 'static-analysis' to Ubuntu 22.04","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-08-26T16:46:54Z","receivedAt":"2022-08-26T16:48:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n>> But the fix here isn't to delete unused.cocci, but to hold off on the\n>> UNUSEwork D() patches until we figure out how to make coccinelle jive with\n>> them.\n>\n> Yeah, my general skepticism and disappointment above notwithstanding,\n> this seems like the best path forward from here. I tried a few other\n> tricks (like --macro-file and --iso-file), but if its parser chokes, I\n> don't think there's much we can do about it. Even if we wrote a patch to\n> coccinelle itself (and I have no interest in doing that myself), it\n> would take a while to become available.\n\nIf it is just a single unused.cocci, I would actually think removing\nit would be a much better path forward.  UNUSED() that renames to\nhelp folks without checking compilers would help noticing bad code\nmuch earlier than unused.cocci many contributors are not running\nthemselves anyway.\n\n"},{"id":"462042","messageId":"YwoVAYTk0EKsAiut@coredump.intra.peff.net","threadId":"58352","inReplyTo":"xmqqczcnymtd.fsf@gitster.g","subject":"Re: [PATCH] ci: update 'static-analysis' to Ubuntu 22.04","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2022-08-27T12:58:41Z","receivedAt":"2022-08-27T12:58:47Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Aug 26, 2022 at 09:46:54AM -0700, Junio C Hamano wrote:\n\n> > Yeah, my general skepticism and disappointment above notwithstanding,\n> > this seems like the best path forward from here. I tried a few other\n> > tricks (like --macro-file and --iso-file), but if its parser chokes, I\n> > don't think there's much we can do about it. Even if we wrote a patch to\n> > coccinelle itself (and I have no interest in doing that myself), it\n> > would take a while to become available.\n> \n> If it is just a single unused.cocci, I would actually think removing\n> it would be a much better path forward.  UNUSED() that renames to\n> help folks without checking compilers would help noticing bad code\n> much earlier than unused.cocci many contributors are not running\n> themselves anyway.\n\nI doubt that it is just unused.cocci. If I understand correctly, the new\nsyntax is choking coccinelle's parser, so it is missing segments of the\ncode from its analysis.\n\nThat shows up as a false positive for unused.cocci, because its patch is\nsomething like \"find me spots that have X followed by Y, with no Z in\nbetween (and then delete X and Y)\". And the breakage is that it doesn't\nnotice Z, so it thinks it has found such a spot.\n\nBut other rules are of the form \"find me X (and turn it into Y)\". If the\ntool fails to parse code that contains X, then we'll get a false\nnegative: it won't generate output when it should. But we don't notice\nany of those, because there are no true positives in the code base right\nnow. But it would presumably fail to find some of them if there were.\nAnd more importantly, it makes the tool just as useless as false\npositives.\n\nIf it were a matter of choosing one static analysis over another (unused\nparameters versus coccinelle), we might have something tricky to decide.\nBut Ævar's non-parenthesized suggestion is a practical workaround. I\ndon't like it as much as what I posted originally, but it's only a\nlittle less ergonomic, and lets us keep using coccinelle (which, despite\nthe headaches I've had tangling with it over the years, has produced\nuseful outcomes).\n\n-Peff\n"},{"id":"462068","messageId":"xmqqy1v7r3so.fsf@gitster.g","threadId":"58352","inReplyTo":"YwoVAYTk0EKsAiut@coredump.intra.peff.net","subject":"Re: [PATCH] ci: update 'static-analysis' to Ubuntu 22.04","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-08-29T05:56:23Z","receivedAt":"2022-08-29T05:57:10Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> If it were a matter of choosing one static analysis over another (unused\n> parameters versus coccinelle), we might have something tricky to decide.\n> But Ævar's non-parenthesized suggestion is a practical workaround.\n\nOK.  Let's go that route, then.\n\nThanks.\n\n"},{"id":"462078","messageId":"220829.86k06r2v6z.gmgdl@evledraar.gmail.com","threadId":"58352","inReplyTo":"xmqqczcnymtd.fsf@gitster.g","subject":"Re: [PATCH] ci: update 'static-analysis' to Ubuntu 22.04","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-08-29T10:29:09Z","receivedAt":"2022-08-29T10:36:13Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Fri, Aug 26 2022, Junio C Hamano wrote:\n\n> Jeff King <peff@peff.net> writes:\n>\n>>> But the fix here isn't to delete unused.cocci, but to hold off on the\n>>> UNUSEwork D() patches until we figure out how to make coccinelle jive with\n>>> them.\n>>\n>> Yeah, my general skepticism and disappointment above notwithstanding,\n>> this seems like the best path forward from here. I tried a few other\n>> tricks (like --macro-file and --iso-file), but if its parser chokes, I\n>> don't think there's much we can do about it. Even if we wrote a patch to\n>> coccinelle itself (and I have no interest in doing that myself), it\n>> would take a while to become available.\n>\n> If it is just a single unused.cocci, I would actually think removing\n> it would be a much better path forward.  UNUSED() that renames to\n> help folks without checking compilers would help noticing bad code\n> much earlier than unused.cocci many contributors are not running\n> themselves anyway.\n\nI think Jeff King's reply covers what I would have said, except one\nthing I'd like to add:\n\nMy reading of this is that you're misimpression that unused.cocci and\nJeff's UNUSED macro are two ways to the same end-goal, and that if we\nkeep the macro we could lose the coccinelle rule.\n\nBut they're doing completely orthogonal checks, the unused.cocci is\nfinding code that's *actually used* accordingn to the compiler, but which\nwe know results in code that's functionally unused.\n\nE.g. doing nothing with a \"struct strbuf\" except to initialize it, and\ncall strbuf_release() on it.\n\nWhereas the UNUSED macro is finding parameters that are truly unused,\nand which we could have expected compilers to optimize out already. It's\njust helping us maintain our own code hygene.\n\nI suspect that we'll also find \"functionally unused\" code with the\nUNUSED macro, but only indirectly. I.e. we might find that all users of\nan interface don't need the Nth parameter, and so we don't need to\nprepare it for them.\n"},{"id":"462268","messageId":"20220831084403.GA13663@szeder.dev","threadId":"58352","inReplyTo":"xmqqczcnymtd.fsf@gitster.g","subject":"Re: [PATCH] ci: update 'static-analysis' to Ubuntu 22.04","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2022-08-31T08:44:03Z","receivedAt":"2022-08-31T08:44:14Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"On Fri, Aug 26, 2022 at 09:46:54AM -0700, Junio C Hamano wrote:\n> Jeff King <peff@peff.net> writes:\n> \n> >> But the fix here isn't to delete unused.cocci, but to hold off on the\n> >> UNUSEwork D() patches until we figure out how to make coccinelle jive with\n> >> them.\n> >\n> > Yeah, my general skepticism and disappointment above notwithstanding,\n> > this seems like the best path forward from here. I tried a few other\n> > tricks (like --macro-file and --iso-file), but if its parser chokes, I\n> > don't think there's much we can do about it. Even if we wrote a patch to\n> > coccinelle itself (and I have no interest in doing that myself), it\n> > would take a while to become available.\n> \n> If it is just a single unused.cocci, I would actually think removing\n> it would be a much better path forward.  UNUSED() that renames to\n> help folks without checking compilers would help noticing bad code\n> much earlier than unused.cocci many contributors are not running\n> themselves anyway.\n\nHere is another reason for the removal of 'unused.cocci': it's very\ncostly to apply that semantic patch to the whole code base.\n\n  make SPATCH_BATCH_SIZE=32 contrib/coccinelle/unused.cocci.patch\n\ntakes 440s on my machine, whereas the second slowest 'object_id.cocci'\ntakes only 56s [1].  Applying 'unused.cocci' to some of our source files\nindividually takes well over a minute:\n\n  $ time spatch --all-includes --sp-file contrib/coccinelle/unused.cocci builtin/log.c\n  warning: Can't find macro file: /usr/local/bin/lib/coccinelle/standard.h\n  warning: Can't find default iso file: /usr/local/bin/lib/coccinelle/standard.iso\n  HANDLING: builtin/log.c\n  Note: processing took    83.1s: builtin/log.c\n  \n  real\t1m23.083s\n  user\t1m22.983s\n  sys\t0m0.033s\n  $ time spatch --all-includes --sp-file contrib/coccinelle/unused.cocci builtin/rebase.c \n  warning: Can't find macro file: /usr/local/bin/lib/coccinelle/standard.h\n  warning: Can't find default iso file: /usr/local/bin/lib/coccinelle/standard.iso\n  HANDLING: builtin/rebase.c\n  Note: processing took    83.2s: builtin/rebase.c\n  \n  real\t1m23.223s\n  user\t1m23.156s\n  sys\t0m0.017s\n\nIn my opinion the benefits of having 'unused.cocci' clearly do not\njustify the costs.\n\n[1] https://public-inbox.org/git/20220824113901.GD1735@szeder.dev/\n\n"},{"id":"462274","messageId":"220831.867d2oa95p.gmgdl@evledraar.gmail.com","threadId":"58352","inReplyTo":"20220831084403.GA13663@szeder.dev","subject":"Re: [PATCH] ci: update 'static-analysis' to Ubuntu 22.04","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-08-31T12:13:51Z","receivedAt":"2022-08-31T12:29:28Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Wed, Aug 31 2022, SZEDER Gábor wrote:\n\n> On Fri, Aug 26, 2022 at 09:46:54AM -0700, Junio C Hamano wrote:\n>> Jeff King <peff@peff.net> writes:\n>> \n>> >> But the fix here isn't to delete unused.cocci, but to hold off on the\n>> >> UNUSEwork D() patches until we figure out how to make coccinelle jive with\n>> >> them.\n>> >\n>> > Yeah, my general skepticism and disappointment above notwithstanding,\n>> > this seems like the best path forward from here. I tried a few other\n>> > tricks (like --macro-file and --iso-file), but if its parser chokes, I\n>> > don't think there's much we can do about it. Even if we wrote a patch to\n>> > coccinelle itself (and I have no interest in doing that myself), it\n>> > would take a while to become available.\n>> \n>> If it is just a single unused.cocci, I would actually think removing\n>> it would be a much better path forward.  UNUSED() that renames to\n>> help folks without checking compilers would help noticing bad code\n>> much earlier than unused.cocci many contributors are not running\n>> themselves anyway.\n>\n> Here is another reason for the removal of 'unused.cocci': it's very\n> costly to apply that semantic patch to the whole code base.\n>\n>   make SPATCH_BATCH_SIZE=32 contrib/coccinelle/unused.cocci.patch\n>\n> takes 440s on my machine, whereas the second slowest 'object_id.cocci'\n> takes only 56s [1].  Applying 'unused.cocci' to some of our source files\n> individually takes well over a minute:\n>\n>   $ time spatch --all-includes --sp-file contrib/coccinelle/unused.cocci builtin/log.c\n>   warning: Can't find macro file: /usr/local/bin/lib/coccinelle/standard.h\n>   warning: Can't find default iso file: /usr/local/bin/lib/coccinelle/standard.iso\n>   HANDLING: builtin/log.c\n>   Note: processing took    83.1s: builtin/log.c\n>   \n>   real\t1m23.083s\n>   user\t1m22.983s\n\nIf you remove the \"done:\" line in cmd_format_patch() buiiltin/log.c runs\nin ~200ms instead of ~40s for me. Perhaps we should be discussing\nremoving or refactoring that one line of code instead? :)\n\nRemoving coccinelle rules because we're seeing slowness somewhere seems\nparticularly short-sighted to me.\n\nMaybe we do run into intractable problems somewhere with it being slow,\nand we'd also like to cater to more \"interactive\" use.\n\nBut we shouldn't do that by removing rules until we get below some\nruntime limit, but rather by creating a \"batch\" category or something\n(just like we have \"pending\") now.\n\nOr, just actually look into why it's slow and fix those issues and/or\nreport them upstream.\n\nThere's nothing in unused.cocci that we either aren't running into\nelsewhere, or wouldn't run into if we had 10x the coccinelle rules we\nhave now (which I think would be a good direction, we should rely on it\nmore heavily).\n\nI've found that being able to have a ccache-like tool for \"spatch\"[1]\nsolved almost all of the practical performance concerns I had with\nit. I.e. I can just run things in a batch, and usually any interactive\nuse will hit things already in cache.\n\nTo the extent it doesn't it's usually some pathological issue in spatch.\n\n>   sys\t0m0.033s\n>   $ time spatch --all-includes --sp-file contrib/coccinelle/unused.cocci builtin/rebase.c \n>   warning: Can't find macro file: /usr/local/bin/lib/coccinelle/standard.h\n>   warning: Can't find default iso file: /usr/local/bin/lib/coccinelle/standard.iso\n>   HANDLING: builtin/rebase.c\n>   Note: processing took    83.2s: builtin/rebase.c\n>   \n>   real\t1m23.223s\n>   user\t1m23.156s\n>   sys\t0m0.017s\n\nI didn't look at this one, but I assume it's some similar (and probably\neasily fixed) pathological issue.\n\n1. https://lore.kernel.org/git/patch-5.5-ce4734e5d79-20220825T141212Z-avarab@gmail.com/\n"},{"id":"462275","messageId":"Yw96ThG8yV4ULROj@coredump.intra.peff.net","threadId":"58352","inReplyTo":"220829.86k06r2v6z.gmgdl@evledraar.gmail.com","subject":"Re: [PATCH] ci: update 'static-analysis' to Ubuntu 22.04","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2022-08-31T15:12:14Z","receivedAt":"2022-08-31T15:12:19Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Aug 29, 2022 at 12:29:09PM +0200, Ævar Arnfjörð Bjarmason wrote:\n\n> My reading of this is that you're misimpression that unused.cocci and\n> Jeff's UNUSED macro are two ways to the same end-goal, and that if we\n> keep the macro we could lose the coccinelle rule.\n\nAh, I didn't think of that, but yeah, that would explain Junio's\nposition a bit more.\n\n> But they're doing completely orthogonal checks, the unused.cocci is\n> finding code that's *actually used* accordingn to the compiler, but which\n> we know results in code that's functionally unused.\n\nRight. They're two separate types of \"unused\", and they should actually\ncomplement each other (e.g., if we drop an unused strbuf parameter, then\na calling function may find that it is now doing nothing but\ninit/release on the strbuf). So we'd want both.\n\n-Peff\n"},{"id":"462276","messageId":"Yw99GwZ/MVaK9D0b@coredump.intra.peff.net","threadId":"58352","inReplyTo":"220831.867d2oa95p.gmgdl@evledraar.gmail.com","subject":"Re: [PATCH] ci: update 'static-analysis' to Ubuntu 22.04","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2022-08-31T15:24:11Z","receivedAt":"2022-08-31T15:24:15Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Aug 31, 2022 at 02:13:51PM +0200, Ævar Arnfjörð Bjarmason wrote:\n\n> Removing coccinelle rules because we're seeing slowness somewhere seems\n> particularly short-sighted to me.\n> \n> Maybe we do run into intractable problems somewhere with it being slow,\n> and we'd also like to cater to more \"interactive\" use.\n\nAgreed. I'm not wild about how long it takes to run either, but if it's\nproducing useful results, it seems worth it to pay the CPU (and I think\nunused.cocci did find some useful results already). There's a point at\nwhich the CPU use becomes intractable, but I don't think we're there\nyet.\n\n> There's nothing in unused.cocci that we either aren't running into\n> elsewhere, or wouldn't run into if we had 10x the coccinelle rules we\n> have now (which I think would be a good direction, we should rely on it\n> more heavily).\n\nFrom past experience, I suspect the \"<... ...>\" operator is what's\nexpensive. I don't see an easy way of avoiding it here, though.\n\nI'm more skeptical on more coccinelle in general, just because I've\nspent so many hours fighting with it for both output and performance\nreasons. But if somebody else is willing to do that work, I'm OK with\nit. I have often wondered if our rules are sufficiently simple that\nlibclang plus some light scripting might get us similar results with\nless hassle. But maybe that's a rabbit hole.\n\n-Peff\n"},{"id":"462300","messageId":"20220831180526.GA1802@szeder.dev","threadId":"58352","inReplyTo":"220831.867d2oa95p.gmgdl@evledraar.gmail.com","subject":"Re: [PATCH] ci: update 'static-analysis' to Ubuntu 22.04","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2022-08-31T18:05:26Z","receivedAt":"2022-08-31T18:05:34Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"On Wed, Aug 31, 2022 at 02:13:51PM +0200, Ævar Arnfjörð Bjarmason wrote:\n> \n> On Wed, Aug 31 2022, SZEDER Gábor wrote:\n> \n> > On Fri, Aug 26, 2022 at 09:46:54AM -0700, Junio C Hamano wrote:\n> >> Jeff King <peff@peff.net> writes:\n> >> \n> >> >> But the fix here isn't to delete unused.cocci, but to hold off on the\n> >> >> UNUSEwork D() patches until we figure out how to make coccinelle jive with\n> >> >> them.\n> >> >\n> >> > Yeah, my general skepticism and disappointment above notwithstanding,\n> >> > this seems like the best path forward from here. I tried a few other\n> >> > tricks (like --macro-file and --iso-file), but if its parser chokes, I\n> >> > don't think there's much we can do about it. Even if we wrote a patch to\n> >> > coccinelle itself (and I have no interest in doing that myself), it\n> >> > would take a while to become available.\n> >> \n> >> If it is just a single unused.cocci, I would actually think removing\n> >> it would be a much better path forward.  UNUSED() that renames to\n> >> help folks without checking compilers would help noticing bad code\n> >> much earlier than unused.cocci many contributors are not running\n> >> themselves anyway.\n> >\n> > Here is another reason for the removal of 'unused.cocci': it's very\n> > costly to apply that semantic patch to the whole code base.\n> >\n> >   make SPATCH_BATCH_SIZE=32 contrib/coccinelle/unused.cocci.patch\n> >\n> > takes 440s on my machine, whereas the second slowest 'object_id.cocci'\n> > takes only 56s [1].  Applying 'unused.cocci' to some of our source files\n> > individually takes well over a minute:\n> >\n> >   $ time spatch --all-includes --sp-file contrib/coccinelle/unused.cocci builtin/log.c\n> >   warning: Can't find macro file: /usr/local/bin/lib/coccinelle/standard.h\n> >   warning: Can't find default iso file: /usr/local/bin/lib/coccinelle/standard.iso\n> >   HANDLING: builtin/log.c\n> >   Note: processing took    83.1s: builtin/log.c\n> >   \n> >   real\t1m23.083s\n> >   user\t1m22.983s\n> \n> If you remove the \"done:\" line in cmd_format_patch() buiiltin/log.c runs\n> in ~200ms instead of ~40s for me. Perhaps we should be discussing\n> removing or refactoring that one line of code instead? :)\n> \n> Removing coccinelle rules because we're seeing slowness somewhere seems\n> particularly short-sighted to me.\n\nIt's not just slowness, it's drastic slowness.  I'm looking at two\n\"from scratch\" 'make coccicheck' runs here, one with 'unused.cocci'\ntaking 9m51s, one without taking 4m56s.  So 'unused.cocci' effectively\ndoubled the runtime, and wastes other developers' time and resources.\n\nI don't see anything wrong with removing a semantic patch that is as\nslow as 'unused.cocci' in its current form on our current codebase.\nWe can always re-add it later, after those interested managed to\nfigure out a way to address its slowness, and updated the semantic\npatch and/or the codebase accordingly.\n\n> Maybe we do run into intractable problems somewhere with it being slow,\n\nLooking at the runtimes I showed above, I think deeming it intractable\nis fully justified.\n\n> and we'd also like to cater to more \"interactive\" use.\n> \n> But we shouldn't do that by removing rules until we get below some\n> runtime limit, but rather by creating a \"batch\" category or something\n> (just like we have \"pending\") now.\n> \n> Or, just actually look into why it's slow and fix those issues and/or\n> report them upstream.\n\nIMO this should be the other way around: if applying a semantic patch\nis this slow, then first look into why it's slow, fix it, and only\nthen submit it for merging.  A semantic patch this slow shouldn't have\nbeen merged in the first place.\n\n> There's nothing in unused.cocci that we either aren't running into\n> elsewhere, or wouldn't run into if we had 10x the coccinelle rules we\n> have now (which I think would be a good direction, we should rely on it\n> more heavily).\n\nSeveral developers have already stated that they might run 'make\ncoccicheck' more often if it weren't so slow.  I think we must keep\nthis in mind when adding new semantic patches, and should aim for a\ngood return of investment between the usefulness of the semantic patch\nand its overhead.  'unused.cocci' doesn't seem to strike a good\nbalance here.\n\nI doubt that I would ever run 'make coccicheck' if we had 10x as many\nsemantic patches.\n\n> I've found that being able to have a ccache-like tool for \"spatch\"[1]\n> solved almost all of the practical performance concerns I had with\n> it. I.e. I can just run things in a batch, and usually any interactive\n> use will hit things already in cache.\n\nWell, perhaps that's why you didn't notice just how slow\n'unused.cocci' can be... :)  Please don't forget about the runtime of\na default \"from scratch\" 'make coccicheck'.\n\n> To the extent it doesn't it's usually some pathological issue in spatch.\n> \n> >   sys\t0m0.033s\n> >   $ time spatch --all-includes --sp-file contrib/coccinelle/unused.cocci builtin/rebase.c \n> >   warning: Can't find macro file: /usr/local/bin/lib/coccinelle/standard.h\n> >   warning: Can't find default iso file: /usr/local/bin/lib/coccinelle/standard.iso\n> >   HANDLING: builtin/rebase.c\n> >   Note: processing took    83.2s: builtin/rebase.c\n> >   \n> >   real\t1m23.223s\n> >   user\t1m23.156s\n> >   sys\t0m0.017s\n> \n> I didn't look at this one, but I assume it's some similar (and probably\n> easily fixed) pathological issue.\n> \n> 1. https://lore.kernel.org/git/patch-5.5-ce4734e5d79-20220825T141212Z-avarab@gmail.com/\n"},{"id":"462302","messageId":"xmqqczcggqzx.fsf@gitster.g","threadId":"58352","inReplyTo":"Yw99GwZ/MVaK9D0b@coredump.intra.peff.net","subject":"Re: [PATCH] ci: update 'static-analysis' to Ubuntu 22.04","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-08-31T19:19:46Z","receivedAt":"2022-08-31T19:20:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Wed, Aug 31, 2022 at 02:13:51PM +0200, Ævar Arnfjörð Bjarmason wrote:\n>\n>> Removing coccinelle rules because we're seeing slowness somewhere seems\n>> particularly short-sighted to me.\n>> \n>> Maybe we do run into intractable problems somewhere with it being slow,\n>> and we'd also like to cater to more \"interactive\" use.\n>\n> Agreed. I'm not wild about how long it takes to run either, but if it's\n> producing useful results, it seems worth it to pay the CPU (and I think\n> unused.cocci did find some useful results already). There's a point at\n> which the CPU use becomes intractable, but I don't think we're there\n> yet.\n\nI am not, either, as it does not look like it is producing all that\nuseful results these days, but of course, we are looking at the end\nresult of previous clean-up triggered by these existing rules, and\ntherefore be biased---we only see cost of running the rules these\ndays without seeing anything new getting caught.\n"},{"id":"462303","messageId":"220831.86pmgg8as3.gmgdl@evledraar.gmail.com","threadId":"58352","inReplyTo":"20220831180526.GA1802@szeder.dev","subject":"Re: [PATCH] ci: update 'static-analysis' to Ubuntu 22.04","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-08-31T19:29:30Z","receivedAt":"2022-08-31T19:37:23Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Wed, Aug 31 2022, SZEDER Gábor wrote:\n\n> On Wed, Aug 31, 2022 at 02:13:51PM +0200, Ævar Arnfjörð Bjarmason wrote:\n>> \n>> On Wed, Aug 31 2022, SZEDER Gábor wrote:\n>>> [...]\n>> If you remove the \"done:\" line in cmd_format_patch() buiiltin/log.c runs\n>> in ~200ms instead of ~40s for me. Perhaps we should be discussing\n>> removing or refactoring that one line of code instead? :)\n>> \n>> Removing coccinelle rules because we're seeing slowness somewhere seems\n>> particularly short-sighted to me.\n>\n> It's not just slowness, it's drastic slowness.  I'm looking at two\n> \"from scratch\" 'make coccicheck' runs here, one with 'unused.cocci'\n> taking 9m51s, one without taking 4m56s.  So 'unused.cocci' effectively\n> doubled the runtime, and wastes other developers' time and resources.\n>\n> I don't see anything wrong with removing a semantic patch that is as\n> slow as 'unused.cocci' in its current form on our current codebase.\n> We can always re-add it later, after those interested managed to\n> figure out a way to address its slowness, and updated the semantic\n> patch and/or the codebase accordingly.\n>\n>> Maybe we do run into intractable problems somewhere with it being slow,\n>\n> Looking at the runtimes I showed above, I think deeming it intractable\n> is fully justified.\n>\n>> and we'd also like to cater to more \"interactive\" use.\n>> \n>> But we shouldn't do that by removing rules until we get below some\n>> runtime limit, but rather by creating a \"batch\" category or something\n>> (just like we have \"pending\") now.\n>> \n>> Or, just actually look into why it's slow and fix those issues and/or\n>> report them upstream.\n>\n> IMO this should be the other way around: if applying a semantic patch\n> is this slow, then first look into why it's slow, fix it, and only\n> then submit it for merging.  A semantic patch this slow shouldn't have\n> been merged in the first place.\n\nIf we're playing hypotheticals then if it hadn't been merged in the\nfirst place we'd have the UNUSED() macro all over the place on master\nnow, and several *other* rules would probably be more broken (but I\nhaven't looked into the cooci guts enough), we just wouldn't notice\nsince \"unused\" is currently the only \"look ahead\" rule that fired &\ncaught it :)\n\n>> There's nothing in unused.cocci that we either aren't running into\n>> elsewhere, or wouldn't run into if we had 10x the coccinelle rules we\n>> have now (which I think would be a good direction, we should rely on it\n>> more heavily).\n>\n> Several developers have already stated that they might run 'make\n> coccicheck' more often if it weren't so slow.  I think we must keep\n> this in mind when adding new semantic patches, and should aim for a\n> good return of investment between the usefulness of the semantic patch\n> and its overhead.  'unused.cocci' doesn't seem to strike a good\n> balance here.\n>\n> I doubt that I would ever run 'make coccicheck' if we had 10x as many\n> semantic patches.\n\nI think we're just describing our workflows by proxy here.\n\nFor me I generally take wasting a computer's time over a person's time\nany day.\n\nWe should always be optimizing for saving people's time over CPUs,\nbecause the latter is relatively cheap.\n\nGranted unused.cocci isn't doing much in the grand scheme of things, but\nif you know it's there it's one more thing you can let your eyes wander\nover in patch review. You don't need to worry if some \"struct strbuf\"\n(or similar) is really being used, or is leftover boilerplate.\n\nYes, it would be useful if coccicheck were currently fast enough to run\nas part of an edit-save-compile-check cycle, but like e.g. -fanalyzer\nit's much too slow for that for most people. So it gets run as some\n\"batch' job.\n\nI think most people who use it in git.git are doing so by pushing to\nCI. There it doesn't really matter that it takes longer now, because as\nlong as it's not slower than the longest running job it won't hold up\nthe total CI runtime, which is in the ~1hr range anyway.\n\nSo that's how I use it (when based off master). I also run it when I\nbuild my local git, but that's a \"kick it off in the background and\nwait\" type of operation. It runs tests, then other tests with other\ncompilers, SANITIZE=address etc. etc.\n\nSo I'm sorry if I tripped up some workflow for you with this change, but\nI do still think it's worth it.\n\n>> I've found that being able to have a ccache-like tool for \"spatch\"[1]\n>> solved almost all of the practical performance concerns I had with\n>> it. I.e. I can just run things in a batch, and usually any interactive\n>> use will hit things already in cache.\n>\n> Well, perhaps that's why you didn't notice just how slow\n> 'unused.cocci' can be... :)  Please don't forget about the runtime of\n> a default \"from scratch\" 'make coccicheck'.\n\nI did notice FWIW, but since I'm mainly looking at CI and other \"batch\"\noperations when looking at \"coccicheck\" I thought the trade-off was\nworth it.\n"}]}