Skip to contentSkip to conversation

ssl_common.h: fix "not all control paths return a value" msvc warning

PATCH In review Lev Stipakov 2 participants 2 messages Dec 17, 2020 – Dec 20, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ssl_common.h: fix "not all control paths return a value" msvc warning

From: Lev Stipakov <[email protected]...>

Commit cc5a71637 ("Replace key_scan array of static pointers with inline function") has introduced get_key_scan() routine with switch statement which calls ASSERT in certain case. Even though "this should never happen", this code triggers Level 1 warning "not all control paths return a value" in msvc.

Fix by adding "return NULL; /* NOTREACHED */"" after ASSERT.

---
 src/openvpn/ssl_common.h | 1 +
 1 file changed, 1 insertion(+)
src/openvpn/ssl_common.h +1 -0
index f435089a..a826e37f 100644
@@ -596,6 +596,7 @@ get_key_scan(struct tls_multi *multi, int index)
             return &multi->session[TM_LAME_DUCK].key[KS_LAME_DUCK];
         default:
             ASSERT(false);
+            return NULL; /* NOTREACHED */
     }
 }
 
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw

[Openvpn-devel] [PATCH applied] Re: ssl_common.h: fix 'not all control paths return a value' msvc warning

Your patch has been applied to the master branch.

commit 86d7e9902db7fcbbbc31aaa5b69bee82375caa21

Author: Lev Stipakov
Date:   Fri Dec 18 00:48:34 2020 +0200
     ssl_common.h: fix 'not all control paths return a value' msvc warning

     Signed-off-by: Lev Stipakov <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg21373.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering