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

Re: [PATCH 0/2] clean up some MAYBE_UNUSED cases

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 29, 2024, 20:46 UTC
Message-ID
<xmqq34mnukff.fsf@gitster.g>
In-Reply-To
<20240829200807.GA430283@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 18 quoted lines
>   - builtin/gc.c's check_crontab_process(). The whole function is marked
>     as MAYBE_UNUSED here, which is a little funny. It's because
>     is_crontab_available() may or may not call us based on __APPLE__.
>     Should we conditionally define the function, too, in that case? It
>     would mean repeating the #ifdef. Alternatively, we could define it
>     like this:
>
>       #ifdef __APPLE__
>       static int check_crontab_process(const char *cmd UNUSED)
>       {
>               return 0;
>       }
>       #else
>       static int check_crontab_process(const char *cmd UNUSED)
>       {
>               [...the real function...]
>       }
>       #endif

Or inline the body of check_crontab_process() at its sole callsite (the other side of "#ifdef APPLE") in is_crontab_available() and get rid of check_crontab_process().

>     But I think we're getting into "well, this is how I would have
>     written it" territory, and it doesn't matter much either way in
>     practice. It's probably better to just leave it alone.
OK.
Previous: Junio C Hamano
Message 7 of 7 in “clean up some MAYBE_UNUSED cases”
  1. 0/2 clean up some MAYBE_UNUSED casesJeff King, Aug 29, 2024
  2. 1/2 gc: drop MAYBE_UNUSED annotation from used parameterJeff King, Aug 29, 2024
  3. 2/2 grep: prefer UNUSED to MAYBE_UNUSED for pcre allocatorsJeff King, Aug 29, 2024
  4. Eric SunshineAug 29, 2024
  5. Patrick SteinhardtAug 30, 2024
  6. Junio C HamanoAug 30, 2024
  7. Junio C HamanoAug 29, 2024

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.