git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
* [PATCH] oidset: don't return value from oidset_init
@ 2018-01-07 23:04 Thomas Gummerer
  2018-01-08 23:26 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Gummerer @ 2018-01-07 23:04 UTC (permalink / raw)
  To: git; +Cc: Jeff Hostetler, Thomas Gummerer

c3a9ad3117 ("oidset: add iterator methods to oidset", 2017-11-21)
introduced a 'oidset_init()' function in oidset.h, which has void as
return type, but returns an expression.

This makes the solaris compiler fail with:

    "oidset.h", line 30: void function cannot return value

As the return type is void, and even the return type of the expression
we're trying to return (oidmap_init) is void just remove the return
statement to fix the compiler error.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
---
 oidset.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/oidset.h b/oidset.h
index 783abceccd..40ec5f87fe 100644
--- a/oidset.h
+++ b/oidset.h
@@ -27,7 +27,7 @@ struct oidset {
 
 static inline void oidset_init(struct oidset *set, size_t initial_size)
 {
-	return oidmap_init(&set->map, initial_size);
+	oidmap_init(&set->map, initial_size);
 }
 
 /**
-- 
2.16.0.rc1.238.g530d649a79


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

* Re: [PATCH] oidset: don't return value from oidset_init
  2018-01-07 23:04 [PATCH] oidset: don't return value from oidset_init Thomas Gummerer
@ 2018-01-08 23:26 ` Junio C Hamano
  2018-01-09  7:33   ` Johannes Sixt
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2018-01-08 23:26 UTC (permalink / raw)
  To: Thomas Gummerer; +Cc: git, Jeff Hostetler

Thomas Gummerer <t.gummerer@gmail.com> writes:

> c3a9ad3117 ("oidset: add iterator methods to oidset", 2017-11-21)
> introduced a 'oidset_init()' function in oidset.h, which has void as
> return type, but returns an expression.
> ...
> diff --git a/oidset.h b/oidset.h
> index 783abceccd..40ec5f87fe 100644
> --- a/oidset.h
> +++ b/oidset.h
> @@ -27,7 +27,7 @@ struct oidset {
>  
>  static inline void oidset_init(struct oidset *set, size_t initial_size)
>  {
> -	return oidmap_init(&set->map, initial_size);
> +	oidmap_init(&set->map, initial_size);
>  }

Makes sense.  Perhaps "inline" hids this from error-checking
compilers, I wonder?


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

* Re: [PATCH] oidset: don't return value from oidset_init
  2018-01-08 23:26 ` Junio C Hamano
@ 2018-01-09  7:33   ` Johannes Sixt
  0 siblings, 0 replies; 3+ messages in thread
From: Johannes Sixt @ 2018-01-09  7:33 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Thomas Gummerer, git, Jeff Hostetler

Am 09.01.2018 um 00:26 schrieb Junio C Hamano:
> Thomas Gummerer <t.gummerer@gmail.com> writes:
> 
>> c3a9ad3117 ("oidset: add iterator methods to oidset", 2017-11-21)
>> introduced a 'oidset_init()' function in oidset.h, which has void as
>> return type, but returns an expression.
>> ...
>> diff --git a/oidset.h b/oidset.h
>> index 783abceccd..40ec5f87fe 100644
>> --- a/oidset.h
>> +++ b/oidset.h
>> @@ -27,7 +27,7 @@ struct oidset {
>>   
>>   static inline void oidset_init(struct oidset *set, size_t initial_size)
>>   {
>> -	return oidmap_init(&set->map, initial_size);
>> +	oidmap_init(&set->map, initial_size);
>>   }
> 
> Makes sense.  Perhaps "inline" hids this from error-checking
> compilers, I wonder?

outmap_init returns void itself. It is a modern language feature, I 
guess, that this void "value" can be forwarded in a return statement.

-- Hannes

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

end of thread, other threads:[~2018-01-09  7:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-07 23:04 [PATCH] oidset: don't return value from oidset_init Thomas Gummerer
2018-01-08 23:26 ` Junio C Hamano
2018-01-09  7:33   ` Johannes Sixt

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

This inbox may be cloned and mirrored by anyone:

	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

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.version-control.git
	nntp://ie5yzdi7fg72h7s4sdcztq5evakq23rdt33mfyfcddc5u3ndnw24ogqd.onion/inbox.comp.version-control.git
	nntp://4uok3hntl7oi7b4uf4rtfwefqeexfzil2w6kgk2jn5z2f764irre7byd.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

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

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