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

Re: Warning message in remote.c when compiling

From
Jeff King <peff@peff.net>
Date
Apr 7, 2024, 01:38 UTC
Message-ID
<20240407013843.GE1085004@coredump.intra.peff.net>
In-Reply-To
<7f0da057773d39add4ede71667e9ff70@manjaro.org>
On Sat, Apr 06, 2024 at 06:12:34PM +0200, Dragan Simic wrote:
Show 16 quoted lines
> Hello,
> 
> On 2024-04-06 16:21, prpr 19xx wrote:
> > I get this warning message when compiling remote.c:
> > 
> > ...
> >     CC remote.o
> > remote.c:596: warning: 'remotes_remote_get' declared inline after being
> > called
> > remote.c:596: warning: previous declaration of 'remotes_remote_get' was
> > here
> >     CC replace-object.o
> > ...
> 
> Could you, please, provide more details about your environment,
> i.e. the operating system and compiler?

I'm also curious about which compiler, but I think it's a reasonable complaint. We forward-declare the static function, use it, and then later declare it inline. I didn't check to see what the standard says, but it seems like a funny thing to do in general.

It has been that way for a while; since 56eed3422c (remote: remove the_repository->remote_state from static methods, 2021-11-17), I think.

I don't really see any need to mark the wrapper as inline. It's one basic function call (on top of an interface which requires a callback anyway!), and I suspect many compilers would consider inlining anyway, since it's a static function.

Ditto for remotes_pushremote_get(), though it doesn't have a forward declaration.

-Peff
Previous: Dragan SimicNext: Dragan Simic
Message 3 of 6 in “Warning message in remote.c when compiling”
  1. prpr 19xxApr 6, 2024
  2. Dragan SimicApr 6, 2024
  3. Jeff KingApr 7, 2024
  4. Dragan SimicApr 7, 2024
  5. Junio C HamanoApr 7, 2024
  6. prpr 19xxApr 7, 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.