# [PATCH] avoid "defined but not used" warning for fetch_objs_via_walker

3 messages from 2007-11-18 to 2007-11-21. Participants: Jeff King, Junio C Hamano, Daniel Barkalow.
Thread: https://gitlist.dev/t/10912

## Jeff King, 2007-11-18 08:17

Subject: [PATCH] avoid "defined but not used" warning for fetch_objs_via_walker
Message-ID: <20071118081722.GA31563@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20071118081722.GA31563%40sigill.intra.peff.net

```
Because this function is static and used only by the
http-walker, when NO_CURL is defined, gcc emits a "defined
but not used" warning.

Signed-off-by: Jeff King <peff@peff.net>
---
On master. I like to compile with -Werror to make sure I don't miss
warnings as the compile scrolls by.

This fix feels a little wrong, since the function isn't specific to http
support, but hopefully the comment should be obvious if we ever add
another similar commit walker that needs it.

 transport.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/transport.c b/transport.c
index e8a2608..43b9e7c 100644
--- a/transport.c
+++ b/transport.c
@@ -344,6 +344,7 @@ static int rsync_transport_push(struct transport *transport,
 
 /* Generic functions for using commit walkers */
 
+#ifndef NO_CURL /* http fetch is the only user */
 static int fetch_objs_via_walker(struct transport *transport,
 				 int nr_objs, struct ref **to_fetch)
 {
@@ -370,6 +371,7 @@ static int fetch_objs_via_walker(struct transport *transport,
 	free(dest);
 	return 0;
 }
+#endif /* NO_CURL */
 
 static int disconnect_walker(struct transport *transport)
 {
-- 
1.5.3.5.1817.gd2b4b-dirty

```

## Junio C Hamano, 2007-11-21 07:10

Subject: Re: [PATCH] avoid "defined but not used" warning for fetch_objs_via_walker
Message-ID: <7v63zwhy4i.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v63zwhy4i.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <20071118081722.GA31563@sigill.intra.peff.net>

```
Jeff King <peff@peff.net> writes:

> Because this function is static and used only by the
> http-walker, when NO_CURL is defined, gcc emits a "defined
> but not used" warning.
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> On master. I like to compile with -Werror to make sure I don't miss
> warnings as the compile scrolls by.
>
> This fix feels a little wrong, since the function isn't specific to http
> support, but hopefully the comment should be obvious if we ever add
> another similar commit walker that needs it.

Yeah, while I share your -Werror desire it sure feels a bit
dirty.  As it does not look like we will be taking any new
walkers, I think your patch is reasonable, though.

```

## Daniel Barkalow, 2007-11-21 18:05

Subject: Re: [PATCH] avoid "defined but not used" warning for fetch_objs_via_walker
Message-ID: <Pine.LNX.4.64.0711211303460.32410@iabervon.org>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0711211303460.32410%40iabervon.org
In-Reply-To: <7v63zwhy4i.fsf@gitster.siamese.dyndns.org>

```
On Tue, 20 Nov 2007, Junio C Hamano wrote:

> Jeff King <peff@peff.net> writes:
> 
> > Because this function is static and used only by the
> > http-walker, when NO_CURL is defined, gcc emits a "defined
> > but not used" warning.
> >
> > Signed-off-by: Jeff King <peff@peff.net>
> > ---
> > On master. I like to compile with -Werror to make sure I don't miss
> > warnings as the compile scrolls by.
> >
> > This fix feels a little wrong, since the function isn't specific to http
> > support, but hopefully the comment should be obvious if we ever add
> > another similar commit walker that needs it.
> 
> Yeah, while I share your -Werror desire it sure feels a bit
> dirty.  As it does not look like we will be taking any new
> walkers, I think your patch is reasonable, though.

I think we're likely to do sftp someday, but everything is likely to get 
reorganized before that anyway.

	-Daniel
*This .sig left intentionally blank*

```
