git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dragan Simic <dsimic@manjaro.org>
To: Jeff King <peff@peff.net>
Cc: prpr 19xx <prpr19xx@gmail.com>, git@vger.kernel.org
Subject: Re: Warning message in remote.c when compiling
Date: Sun, 07 Apr 2024 07:10:27 +0200	[thread overview]
Message-ID: <0d8660bd28ea10d062a3bf71d5d66b8f@manjaro.org> (raw)
In-Reply-To: <20240407013843.GE1085004@coredump.intra.peff.net>

Hello Jeff,

On 2024-04-07 03:38, Jeff King wrote:
> On Sat, Apr 06, 2024 at 06:12:34PM +0200, Dragan Simic wrote:
> 
>> 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.

The link below seems to provide more details.  The way I see it,
declarations and definitions should match, and the standard seems
to support that.  Though, not all compilers (or not all versions)
complain in this particular case.

https://stackoverflow.com/a/62390378/22330192

> 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

  reply	other threads:[~2024-04-07  5:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-06 14:21 Warning message in remote.c when compiling prpr 19xx
2024-04-06 16:12 ` Dragan Simic
2024-04-07  1:38   ` Jeff King
2024-04-07  5:10     ` Dragan Simic [this message]
2024-04-07  5:40     ` Junio C Hamano
2024-04-07 16:47       ` prpr 19xx

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0d8660bd28ea10d062a3bf71d5d66b8f@manjaro.org \
    --to=dsimic@manjaro.org \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=prpr19xx@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).