Skip to contentSkip to conversation

tun: move print_windows_driver() out of tun.h

PATCH In review Lev Stipakov 2 participants 2 messages Jan 9, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tun: move print_windows_driver() out of tun.h

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

We got warnings from MinGW about function being defined but not used when compiling modules which include tun.h.

This function is not defined as inline, so its definition should not be in header. Since this is not a performance critical, no need to make it inline.

Leave declaration in tun.h and move definition to tun.c.

---
 src/openvpn/tun.c | 19 +++++++++++++++++++
 src/openvpn/tun.h | 20 ++------------------
 2 files changed, 21 insertions(+), 18 deletions(-)
src/openvpn/tun.c +19 -0
index a83ec9e6..6947312e 100644
@@ -7028,6 +7028,25 @@ ipset2ascii_all(struct gc_arena *gc)
     return BSTR(&out);
 }
 
+const char *
+print_windows_driver(enum windows_driver_type windows_driver)
+{
+    switch (windows_driver)
+    {
+        case WINDOWS_DRIVER_TAP_WINDOWS6:
+            return "tap-windows6";
+
+        case WINDOWS_DRIVER_WINTUN:
+            return "wintun";
+
+        case WINDOWS_DRIVER_DCO:
+            return "ovpn-dco";
+
+        default:
+            return "unspecified";
+    }
+}
+
 #else /* generic */
 
 void
src/openvpn/tun.h +2 -18
index 24d52670..ed22770a 100644
@@ -661,24 +661,8 @@ tuntap_is_dco_win_timeout(struct tuntap *tt, int status)
     return tuntap_is_dco_win(tt) && (status < 0) && (openvpn_errno() == ERROR_NETNAME_DELETED);
 }
 
-static const char *
-print_windows_driver(enum windows_driver_type windows_driver)
-{
-    switch (windows_driver)
-    {
-        case WINDOWS_DRIVER_TAP_WINDOWS6:
-            return "tap-windows6";
-
-        case WINDOWS_DRIVER_WINTUN:
-            return "wintun";
-
-        case WINDOWS_DRIVER_DCO:
-            return "ovpn-dco";
-
-        default:
-            return "unspecified";
-    }
-}
+const char *
+print_windows_driver(enum windows_driver_type windows_driver);
 
 #else  /* ifdef _WIN32 */
 
Signature · 1 line
2.38.1.windows.1
Acked-by on v1 1/1
#1 lore raw

Thanks. Compile-tested on MinGW, it compiles and the warnings are gone.

Your patch has been applied to the master and release/2.6 branch.

commit a0eb1f764df39d9447b666e5a2cbd3aa01b41983 (master) commit 9dd0bfb5983fdfbbb9e1fe2195642fbc4cc5f200 (release/2.6)

Author: Lev Stipakov
Date:   Mon Jan 9 13:30:46 2023 +0200
     tun: move print_windows_driver() out of tun.h

     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]/msg25923.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering