Subject: Re: [PATCH] add definitions for global variables to shell.c

From: Junio C Hamano <[email-masked]>
Date: Tue, 19 Aug 2008 00:53:21 -0700

Robert Schiele <[email-masked]> writes:

> On Mon, Aug 18, 2008 at 05:29:11PM -0700, Junio C Hamano wrote:
>> Haven't looked at the real declarations but if the decl are "extern" and
>> nobody refers to them, why should the resulting object file require them
>> to be defined anywhere?  If the decl are not and in (fortran-ish) "common"
>> section, on the other hand, you shouldn't have to define them yourself
>> like this either.
>> 
>> This sounds like a compiler bug to me.
>
> This was my first thought as well but after more inspection there are two
> things to consider:
>
> 1. I was not really precise enough in my description since I didn't spot that
>    when I looked into the issue first: Actually there are references to these
>    variables in static inline functions in cache.h.  Thus there actually is a
>    reference though one that will never be used since abspath.c (that includes
>    cache.h) is not calling any of these functions.
>
> 2. Since these symbols turn out to be referenced though in dead code only I
>    wouldn't call it a compiler bug.

Ok, as I said, I didn't look.  If they are indeed referenced, that is a
different story.

Even if that is the case, I do not like the prospect of having to maintain
a set of duplicated variable definitions.  If we really wanted to address
this issue, maybe we would want a separate source file that is linked to
both git-shell and to the rest of the system that has nothing but
definitions of these variables?  I thought environment.c was meant to be
something like that -- would linking environment.o pull in too many extra
references these days (again, I didn't try)?