{"thread":{"id":"50246","subject":"[PATCH] repository.c: fix sparse warning","startedAt":"2019-01-17T01:16:37Z","lastAt":"2019-01-17T16:51:19Z","messageCount":3,"participants":["Ramsay Jones","Duy Nguyen"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"366893","messageId":"419519f9-1b48-93bb-eead-eacf6b383f70@ramsayjones.plus.com","threadId":"50246","inReplyTo":null,"subject":"[PATCH] repository.c: fix sparse warning","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsayjones.plus.com","sentAt":"2019-01-17T01:07:00Z","receivedAt":"2019-01-17T01:16:37Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nSigned-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>\n---\n\nHi Duy,\n\nIf you need to re-roll your 'nd/the-index-final' branch, could you\nplease squash this into the relevant patch (commit 4478671442,\n\"cache.h: flip NO_THE_INDEX_COMPATIBILITY_MACROS switch\", 2019-01-12).\n\n[the warning is caused by the lack of the extern declaration of the\n'the_index' symbol.]\n\nThanks!\n\nATB,\nRamsay Jones\n\n repository.c | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/repository.c b/repository.c\nindex 0c6814627e..3ecbb1b6e3 100644\n--- a/repository.c\n+++ b/repository.c\n@@ -1,3 +1,4 @@\n+#define USE_THE_INDEX_COMPATIBILITY_MACROS\n #include \"cache.h\"\n #include \"repository.h\"\n #include \"object-store.h\"\n-- \n2.20.0\n"},{"id":"366906","messageId":"CACsJy8BWfdCwFwhfKku-AqP5sGpB7CN4O-Qu0b1cm3iTbW8Z_Q@mail.gmail.com","threadId":"50246","inReplyTo":"419519f9-1b48-93bb-eead-eacf6b383f70@ramsayjones.plus.com","subject":"Re: [PATCH] repository.c: fix sparse warning","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2019-01-17T10:06:03Z","receivedAt":"2019-01-17T10:06:32Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Thu, Jan 17, 2019 at 8:21 AM Ramsay Jones\n<ramsay@ramsayjones.plus.com> wrote:\n>\n>\n> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>\n> ---\n>\n> Hi Duy,\n>\n> If you need to re-roll your 'nd/the-index-final' branch, could you\n> please squash this into the relevant patch (commit 4478671442,\n> \"cache.h: flip NO_THE_INDEX_COMPATIBILITY_MACROS switch\", 2019-01-12).\n>\n> [the warning is caused by the lack of the extern declaration of the\n> 'the_index' symbol.]\n\nIs it a false alarm? The variable is actually defined in this file now\nwhich should also function as a declaration, yes?\n\n>\n> Thanks!\n>\n> ATB,\n> Ramsay Jones\n>\n>  repository.c | 1 +\n>  1 file changed, 1 insertion(+)\n>\n> diff --git a/repository.c b/repository.c\n> index 0c6814627e..3ecbb1b6e3 100644\n> --- a/repository.c\n> +++ b/repository.c\n> @@ -1,3 +1,4 @@\n> +#define USE_THE_INDEX_COMPATIBILITY_MACROS\n>  #include \"cache.h\"\n>  #include \"repository.h\"\n>  #include \"object-store.h\"\n> --\n> 2.20.0\n\n\n\n-- \nDuy\n"},{"id":"367003","messageId":"b6aaaa72-03cd-2b3d-7328-f7a2fb0d85a2@ramsayjones.plus.com","threadId":"50246","inReplyTo":"CACsJy8BWfdCwFwhfKku-AqP5sGpB7CN4O-Qu0b1cm3iTbW8Z_Q@mail.gmail.com","subject":"Re: [PATCH] repository.c: fix sparse warning","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsayjones.plus.com","sentAt":"2019-01-17T16:51:13Z","receivedAt":"2019-01-17T16:51:19Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\n\nOn 17/01/2019 10:06, Duy Nguyen wrote:\n> On Thu, Jan 17, 2019 at 8:21 AM Ramsay Jones\n> <ramsay@ramsayjones.plus.com> wrote:\n>>\n>>\n>> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>\n>> ---\n>>\n>> Hi Duy,\n>>\n>> If you need to re-roll your 'nd/the-index-final' branch, could you\n>> please squash this into the relevant patch (commit 4478671442,\n>> \"cache.h: flip NO_THE_INDEX_COMPATIBILITY_MACROS switch\", 2019-01-12).\n>>\n>> [the warning is caused by the lack of the extern declaration of the\n>> 'the_index' symbol.]\n> \n> Is it a false alarm? The variable is actually defined in this file now\n> which should also function as a declaration, yes?\n\nAh, no, absolutely not! :( (er, well yes, but no! :-D ).\n\nI hope you agree that _all_ uses of a symbol should be within\nthe scope of the same declaration of that symbol (by #include-ing\nthe same header/interface file). This is _especially_ true of\nthe file which has the definition of that symbol - how else do\nyou expect the compiler to detect a mismatch between the declaration\nand definition?\n\nATB,\nRamsay Jones\n"}]}