Re: Warning message in remote.c when compiling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux