git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] repository.c: fix sparse warning
@ 2019-01-17  1:07 Ramsay Jones
  2019-01-17 10:06 ` Duy Nguyen
  0 siblings, 1 reply; 3+ messages in thread
From: Ramsay Jones @ 2019-01-17  1:07 UTC (permalink / raw)
  To: Nguyen Thai Ngoc Duy; +Cc: Junio C Hamano, GIT Mailing-list


Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---

Hi Duy,

If you need to re-roll your 'nd/the-index-final' branch, could you
please squash this into the relevant patch (commit 4478671442,
"cache.h: flip NO_THE_INDEX_COMPATIBILITY_MACROS switch", 2019-01-12).

[the warning is caused by the lack of the extern declaration of the
'the_index' symbol.]

Thanks!

ATB,
Ramsay Jones

 repository.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/repository.c b/repository.c
index 0c6814627e..3ecbb1b6e3 100644
--- a/repository.c
+++ b/repository.c
@@ -1,3 +1,4 @@
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
 #include "cache.h"
 #include "repository.h"
 #include "object-store.h"
-- 
2.20.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] repository.c: fix sparse warning
  2019-01-17  1:07 [PATCH] repository.c: fix sparse warning Ramsay Jones
@ 2019-01-17 10:06 ` Duy Nguyen
  2019-01-17 16:51   ` Ramsay Jones
  0 siblings, 1 reply; 3+ messages in thread
From: Duy Nguyen @ 2019-01-17 10:06 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: Junio C Hamano, GIT Mailing-list

On Thu, Jan 17, 2019 at 8:21 AM Ramsay Jones
<ramsay@ramsayjones.plus.com> wrote:
>
>
> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
> ---
>
> Hi Duy,
>
> If you need to re-roll your 'nd/the-index-final' branch, could you
> please squash this into the relevant patch (commit 4478671442,
> "cache.h: flip NO_THE_INDEX_COMPATIBILITY_MACROS switch", 2019-01-12).
>
> [the warning is caused by the lack of the extern declaration of the
> 'the_index' symbol.]

Is it a false alarm? The variable is actually defined in this file now
which should also function as a declaration, yes?

>
> Thanks!
>
> ATB,
> Ramsay Jones
>
>  repository.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/repository.c b/repository.c
> index 0c6814627e..3ecbb1b6e3 100644
> --- a/repository.c
> +++ b/repository.c
> @@ -1,3 +1,4 @@
> +#define USE_THE_INDEX_COMPATIBILITY_MACROS
>  #include "cache.h"
>  #include "repository.h"
>  #include "object-store.h"
> --
> 2.20.0



-- 
Duy

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] repository.c: fix sparse warning
  2019-01-17 10:06 ` Duy Nguyen
@ 2019-01-17 16:51   ` Ramsay Jones
  0 siblings, 0 replies; 3+ messages in thread
From: Ramsay Jones @ 2019-01-17 16:51 UTC (permalink / raw)
  To: Duy Nguyen; +Cc: Junio C Hamano, GIT Mailing-list



On 17/01/2019 10:06, Duy Nguyen wrote:
> On Thu, Jan 17, 2019 at 8:21 AM Ramsay Jones
> <ramsay@ramsayjones.plus.com> wrote:
>>
>>
>> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
>> ---
>>
>> Hi Duy,
>>
>> If you need to re-roll your 'nd/the-index-final' branch, could you
>> please squash this into the relevant patch (commit 4478671442,
>> "cache.h: flip NO_THE_INDEX_COMPATIBILITY_MACROS switch", 2019-01-12).
>>
>> [the warning is caused by the lack of the extern declaration of the
>> 'the_index' symbol.]
> 
> Is it a false alarm? The variable is actually defined in this file now
> which should also function as a declaration, yes?

Ah, no, absolutely not! :( (er, well yes, but no! :-D ).

I hope you agree that _all_ uses of a symbol should be within
the scope of the same declaration of that symbol (by #include-ing
the same header/interface file). This is _especially_ true of
the file which has the definition of that symbol - how else do
you expect the compiler to detect a mismatch between the declaration
and definition?

ATB,
Ramsay Jones

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-01-17 16:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-17  1:07 [PATCH] repository.c: fix sparse warning Ramsay Jones
2019-01-17 10:06 ` Duy Nguyen
2019-01-17 16:51   ` Ramsay Jones

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).