git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 0/2] git-compat-util.h: change UNUSED(var) to UNUSED

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Aug 25, 2022, 17:09 UTC
Message-ID
<cover-0.2-00000000000-20220825T170709Z-avarab@gmail.com>
In-Reply-To
<xmqq1qt4486e.fsf@gitster.g>
On Thu, Aug 25 2022, Junio C Hamano wrote:
Show 31 quoted lines
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>
>> What's happening here is that coccinelle can no longer properly parse
>> the file after the UNUSED() macros were applied to refs.c.
>
> Sigh.
>
>>      diff --git a/refs.c b/refs.c
>>      index 607694c2662..37e7d88920c 100644
>>      --- a/refs.c
>>      +++ b/refs.c
>>      @@ -442,7 +442,7 @@ struct warn_if_dangling_data {
>>       };
>>
>>       static int warn_if_dangling_symref(const char *refname,
>>      -                                  const struct object_id *UNUSED(oid),
>>      +                                  const struct object_id *oid UNUSED2,
>>                                         int flags, void *cb_data)
>>       {
>>              struct warn_if_dangling_data *d = cb_data;
>
> This is almost "the most simple and stupid and nobody would get
> confused" version, which I may actually be able to live with.
>
> Unfortunately it will not get the "somebody by mistake uses 'oid'
> and we can break the build no matter what compiler is used by them
> before sending the patch out to the list".
>
> Doing s/oid UNUSED2/oid_UNUSED/ without any __attribute__((unused))
> would give that benefit to us, but that won't squelch compilation
> with -Wunused which makes it a non-starter.

I think per the 2/2 that it should be OK, but if you still think it's a non-starter we'll need some other approach.

When I merge this with "seen" it suggests no "unused.cocci" changes to refs.c anymore, i.e. it unbroke the interaction between the UNUSED topic in next and the change that happened to reveal it.

Ævar Arnfjörð Bjarmason (2):
  git-compat-util.h: use "UNUSED", not "UNUSED(var)"
  git-compat-util.h: use "deprecated" for UNUSED variables
 add-interactive.c           |  2 +-
 archive-tar.c               |  4 ++--
 archive-zip.c               |  4 ++--
 archive.c                   |  2 +-
 attr.c                      |  4 ++--
 bisect.c                    |  6 +++---
 bloom.c                     |  4 ++--
 builtin/am.c                |  2 +-
 builtin/bisect--helper.c    | 12 ++++++------
 builtin/checkout.c          |  4 ++--
 builtin/commit-graph.c      |  2 +-
 builtin/config.c            |  6 +++---
 builtin/describe.c          |  4 ++--
 builtin/difftool.c          | 10 +++++-----
 builtin/fast-export.c       |  2 +-
 builtin/fast-import.c       |  2 +-
 builtin/fetch.c             |  8 ++++----
 builtin/fsck.c              | 12 ++++++------
 builtin/gc.c                |  4 ++--
 builtin/log.c               |  4 ++--
 builtin/ls-tree.c           | 10 +++++-----
 builtin/multi-pack-index.c  |  2 +-
 builtin/name-rev.c          |  2 +-
 builtin/pack-objects.c      | 12 ++++++------
 builtin/receive-pack.c      |  4 ++--
 builtin/reflog.c            |  4 ++--
 builtin/remote.c            | 14 +++++++-------
 builtin/repack.c            |  4 ++--
 builtin/rev-parse.c         |  4 ++--
 builtin/show-branch.c       |  6 +++---
 builtin/show-ref.c          |  6 +++---
 builtin/stash.c             | 12 ++++++------
 builtin/submodule--helper.c |  4 ++--
 color.c                     |  2 +-
 commit-graph.c              |  4 ++--
 commit.c                    |  6 +++---
 compat/terminal.c           |  2 +-
 config.c                    |  8 ++++----
 convert.c                   |  4 ++--
 delta-islands.c             |  4 ++--
 diff.c                      |  4 ++--
 dir.c                       |  4 ++--
 environment.c               |  4 ++--
 fetch-pack.c                | 12 ++++++------
 git-compat-util.h           | 13 +++++++------
 gpg-interface.c             |  2 +-
 hashmap.c                   | 10 +++++-----
 help.c                      |  4 ++--
 http-backend.c              |  2 +-
 ident.c                     |  2 +-
 ll-merge.c                  |  2 +-
 log-tree.c                  |  2 +-
 ls-refs.c                   |  2 +-
 merge-recursive.c           | 12 ++++++------
 name-hash.c                 |  4 ++--
 negotiator/default.c        |  4 ++--
 negotiator/skipping.c       |  4 ++--
 notes.c                     |  4 ++--
 object-name.c               | 12 ++++++------
 object-store.h              |  2 +-
 oidmap.c                    |  2 +-
 packfile.c                  |  2 +-
 pager.c                     |  2 +-
 patch-ids.c                 |  2 +-
 pretty.c                    |  2 +-
 range-diff.c                |  2 +-
 ref-filter.c                |  2 +-
 reflog.c                    | 18 +++++++++---------
 refs.c                      | 12 ++++++------
 refs/files-backend.c        | 14 +++++++-------
 refs/iterator.c             |  6 +++---
 refs/packed-backend.c       | 16 ++++++++--------
 remote.c                    | 24 ++++++++++++------------
 replace-object.c            |  4 ++--
 revision.c                  | 18 +++++++++---------
 send-pack.c                 |  2 +-
 sequencer.c                 |  4 ++--
 server-info.c               |  2 +-
 shallow.c                   | 10 +++++-----
 strbuf.c                    |  2 +-
 streaming.c                 |  6 +++---
 strmap.c                    |  4 ++--
 sub-process.c               |  4 ++--
 submodule-config.c          |  8 ++++----
 submodule.c                 | 12 ++++++------
 t/helper/test-config.c      |  2 +-
 t/helper/test-ref-store.c   |  4 ++--
 t/helper/test-userdiff.c    |  2 +-
 trailer.c                   |  4 ++--
 transport.c                 |  2 +-
 upload-pack.c               |  6 +++---
 walker.c                    |  6 +++---
 wt-status.c                 | 16 ++++++++--------
 93 files changed, 270 insertions(+), 269 deletions(-)
-- 
2.37.2.1279.g8741a0e3ea3
Previous: Junio C HamanoNext: Ævar Arnfjörð Bjarmason
Message 9 of 26 in “ci: update 'static-analysis' to Ubuntu 22.04”
  1. ci: update 'static-analysis' to Ubuntu 22.04Derrick Stolee via GitGitGadget, Aug 23, 2022
  2. Johannes SchindelinAug 24, 2022
  3. Junio C HamanoAug 24, 2022
  4. Junio C HamanoAug 24, 2022
  5. Derrick StoleeAug 25, 2022
  6. Junio C HamanoAug 25, 2022
  7. Ævar Arnfjörð BjarmasonAug 25, 2022
  8. Junio C HamanoAug 25, 2022
  9. 0/2 git-compat-util.h: change UNUSED(var) to UNUSEDÆvar Arnfjörð Bjarmason, Aug 25, 2022
  10. 2/2 git-compat-util.h: use "deprecated" for UNUSED variablesÆvar Arnfjörð Bjarmason, Aug 25, 2022
  11. 1/2 git-compat-util.h: use "UNUSED", not "UNUSED(var)"Ævar Arnfjörð Bjarmason, Aug 25, 2022
  12. Jeff KingAug 26, 2022
  13. Jeff KingAug 26, 2022
  14. Junio C HamanoAug 26, 2022
  15. Jeff KingAug 27, 2022
  16. Junio C HamanoAug 29, 2022
  17. Ævar Arnfjörð BjarmasonAug 29, 2022
  18. Jeff KingAug 31, 2022
  19. SZEDER GáborAug 31, 2022
  20. Ævar Arnfjörð BjarmasonAug 31, 2022
  21. Jeff KingAug 31, 2022
  22. Junio C HamanoAug 31, 2022
  23. SZEDER GáborAug 31, 2022
  24. Ævar Arnfjörð BjarmasonAug 31, 2022
  25. Ævar Arnfjörð BjarmasonAug 25, 2022
  26. Junio C HamanoAug 25, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.