git@vger.kernel.org mailing list mirror (one of many)
 help / Atom feed
* [PATCH] refspec.h: reinstate 'extern' to fix sparse warning
@ 2018-05-16 21:35 Ramsay Jones
  2018-05-16 21:42 ` Brandon Williams
  0 siblings, 1 reply; 4+ messages in thread
From: Ramsay Jones @ 2018-05-16 21:35 UTC (permalink / raw)
  To: Brandon Williams; +Cc: Junio C Hamano, GIT Mailing-list


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

Hi Brandon,

If you need to re-roll your 'bw/refspec-api' branch, could you please
squash this, or the equivalent change before the 'struct refname' to
'struct refname_item' name change, into the relevant patch. (which
would be patch #1, commit 8999381ed).

This patch was built on top of 'pu', but as I said above, patch #1
is where the original 'extern' keyword was dropped. (see first hunk
of the diff to 'remote.h').

Thanks!

ATB,
Ramsay Jones

 refspec.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/refspec.h b/refspec.h
index 374f8ea63..7e1ff94ac 100644
--- a/refspec.h
+++ b/refspec.h
@@ -2,7 +2,7 @@
 #define REFSPEC_H
 
 #define TAG_REFSPEC "refs/tags/*:refs/tags/*"
-const struct refspec_item *tag_refspec;
+extern const struct refspec_item *tag_refspec;
 
 struct refspec_item {
 	unsigned force : 1;
-- 
2.17.0

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

* Re: [PATCH] refspec.h: reinstate 'extern' to fix sparse warning
  2018-05-16 21:35 [PATCH] refspec.h: reinstate 'extern' to fix sparse warning Ramsay Jones
@ 2018-05-16 21:42 ` Brandon Williams
  2018-05-16 21:47   ` Stefan Beller
  0 siblings, 1 reply; 4+ messages in thread
From: Brandon Williams @ 2018-05-16 21:42 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: Junio C Hamano, GIT Mailing-list

On 05/16, Ramsay Jones wrote:
> 
> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
> ---
> 
> Hi Brandon,
> 
> If you need to re-roll your 'bw/refspec-api' branch, could you please
> squash this, or the equivalent change before the 'struct refname' to
> 'struct refname_item' name change, into the relevant patch. (which
> would be patch #1, commit 8999381ed).
> 
> This patch was built on top of 'pu', but as I said above, patch #1
> is where the original 'extern' keyword was dropped. (see first hunk
> of the diff to 'remote.h').

Of course I'll do that, I'm planning on sending out a v2 by the end of
the day and I'll incorporate that.

Though now I'm confused, I thought we were going towards eliminating
using the extern keyword? ...of course I guess it means something
_slightly_ different when using with a variable vs a function :)

> 
> Thanks!
> 
> ATB,
> Ramsay Jones
> 
>  refspec.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/refspec.h b/refspec.h
> index 374f8ea63..7e1ff94ac 100644
> --- a/refspec.h
> +++ b/refspec.h
> @@ -2,7 +2,7 @@
>  #define REFSPEC_H
>  
>  #define TAG_REFSPEC "refs/tags/*:refs/tags/*"
> -const struct refspec_item *tag_refspec;
> +extern const struct refspec_item *tag_refspec;
>  
>  struct refspec_item {
>  	unsigned force : 1;
> -- 
> 2.17.0

-- 
Brandon Williams

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

* Re: [PATCH] refspec.h: reinstate 'extern' to fix sparse warning
  2018-05-16 21:42 ` Brandon Williams
@ 2018-05-16 21:47   ` Stefan Beller
  2018-05-16 21:52     ` Johannes Schindelin
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Beller @ 2018-05-16 21:47 UTC (permalink / raw)
  To: Brandon Williams; +Cc: Ramsay Jones, Junio C Hamano, GIT Mailing-list

On Wed, May 16, 2018 at 2:42 PM, Brandon Williams <bmwill@google.com> wrote:
> On 05/16, Ramsay Jones wrote:
>>
>> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
>> ---
>>
>> Hi Brandon,
>>
>> If you need to re-roll your 'bw/refspec-api' branch, could you please
>> squash this, or the equivalent change before the 'struct refname' to
>> 'struct refname_item' name change, into the relevant patch. (which
>> would be patch #1, commit 8999381ed).
>>
>> This patch was built on top of 'pu', but as I said above, patch #1
>> is where the original 'extern' keyword was dropped. (see first hunk
>> of the diff to 'remote.h').
>
> Of course I'll do that, I'm planning on sending out a v2 by the end of
> the day and I'll incorporate that.
>
> Though now I'm confused, I thought we were going towards eliminating
> using the extern keyword? ...of course I guess it means something
> _slightly_ different when using with a variable vs a function :)

We're only eliminating it when it is redundant. :-)

For variables this is not redundant as we need it to tell apart the
declaration and definition of it, so we have to keep it.

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

* Re: [PATCH] refspec.h: reinstate 'extern' to fix sparse warning
  2018-05-16 21:47   ` Stefan Beller
@ 2018-05-16 21:52     ` Johannes Schindelin
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Schindelin @ 2018-05-16 21:52 UTC (permalink / raw)
  To: Stefan Beller
  Cc: Brandon Williams, Ramsay Jones, Junio C Hamano, GIT Mailing-list

On Wed, 16 May 2018, Stefan Beller wrote:

> On Wed, May 16, 2018 at 2:42 PM, Brandon Williams <bmwill@google.com> wrote:
>
> > Though now I'm confused, I thought we were going towards eliminating
> > using the extern keyword? ...of course I guess it means something
> > _slightly_ different when using with a variable vs a function :)
> 
> We're only eliminating it when it is redundant. :-)
> 
> For variables this is not redundant as we need it to tell apart the
> declaration and definition of it, so we have to keep it.

Otherwise we will end up with the variable *defined* for every file that
includes that header. And of course those different versions of the same
variable would have possibly different values...

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

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-16 21:35 [PATCH] refspec.h: reinstate 'extern' to fix sparse warning Ramsay Jones
2018-05-16 21:42 ` Brandon Williams
2018-05-16 21:47   ` Stefan Beller
2018-05-16 21:52     ` Johannes Schindelin

git@vger.kernel.org mailing list mirror (one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.org/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox