git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Ramsay Jones <ramsay@ramsayjones.plus.com>
To: Duy Nguyen <pclouds@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	GIT Mailing-list <git@vger.kernel.org>
Subject: Re: [PATCH] repository.c: fix sparse warning
Date: Thu, 17 Jan 2019 16:51:13 +0000	[thread overview]
Message-ID: <b6aaaa72-03cd-2b3d-7328-f7a2fb0d85a2@ramsayjones.plus.com> (raw)
In-Reply-To: <CACsJy8BWfdCwFwhfKku-AqP5sGpB7CN4O-Qu0b1cm3iTbW8Z_Q@mail.gmail.com>



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

      reply	other threads:[~2019-01-17 16:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b6aaaa72-03cd-2b3d-7328-f7a2fb0d85a2@ramsayjones.plus.com \
    --to=ramsay@ramsayjones.plus.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).