Skip to contentSkip to conversation

oidset: don't return value from oidset_init

PATCH In review Thomas Gummerer 3 participants 3 messages Jan 7, 2018 – Jan 9, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 oidset: don't return value from oidset_init

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.

---
 oidset.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
oidset.h +1 -1
index 783abceccd..40ec5f87fe 100644
@@ -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);
 }
 
 /**
Signature · 1 line
2.16.0.rc1.238.g530d649a79
#1 lore raw
Quoted 9 lines · 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.
...

oidset.h +0 -0
index 783abceccd..40ec5f87fe 100644

oidset.h struct oidset { · line 31

Quoted 6 lines
oidset.h +1 -1
@@ -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?

#2 lore raw

Am 09.01.2018 um 00:26 schrieb Junio C Hamano:

Quoted 12 lines
Quoted 10 lines · 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.
...

oidset.h +0 -0
index 783abceccd..40ec5f87fe 100644
@@ -27,7 +27,7 @@ struct oidset {
 
Quoted 8 lines

oidset.h struct oidset { · line 31

Quoted 5 lines
oidset.h +1 -1
  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