]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Fix compiler warnings about not used dummy() functions
authorDavid Sommerseth <dazo@users.sourceforge.net>
Mon, 15 Nov 2010 07:48:57 +0000 (08:48 +0100)
committerDavid Sommerseth <dazo@users.sourceforge.net>
Thu, 18 Nov 2010 17:54:49 +0000 (18:54 +0100)
It has been reported that the Microsoft Visual C compiler complains if
a .c file do not contain any compilable code, which can happen if the
code has been #ifdef'ed out.  To avoid this, these #ifdef sections have
a #else section which adds a static dummy() function which does nothing.

On the other hand, the GNU C compiler complains about unused functions when
it discovers this situation.

This patch tries to only add these dummy() functions if the Microsoft Visual C
compiler is detected, via the _MSC_VER macro.

Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
Acked-by: Peter Stuge <peter@stuge.se>
cryptoapi.c
ieproxy.c
perf.c
pkcs11.c

index 8fb538713ba37543e6ad44bb326294f2c81446c4..3365cd7acad0d6fd35b39ca3fd4174174148be77 100644 (file)
@@ -470,5 +470,7 @@ int SSL_CTX_use_CryptoAPI_certificate(SSL_CTX *ssl_ctx, const char *cert_prop)
 }
 
 #else
+#ifdef _MSC_VER  /* Dummy function needed to avoid empty file compiler warning in Microsoft VC */
 static void dummy (void) {}
+#endif
 #endif                         /* WIN32 */
index 89977a821aca72c114403edcaf87facdf5e36dc5..30998704313807d98bc9be0001581030404549de 100644 (file)
--- a/ieproxy.c
+++ b/ieproxy.c
@@ -139,7 +139,8 @@ LPCTSTR getIeHttpProxy()
     return(NULL);
   }
 }
-
 #else
+#ifdef _MSC_VER  /* Dummy function needed to avoid empty file compiler warning in Microsoft VC */
 static void dummy (void) {}
+#endif
 #endif                         /* WIN32 */
diff --git a/perf.c b/perf.c
index a149c07d236c95e0babdc2d3b416a0c500d666d9..67ea9580426d0573c2cf57582ae46b73441d9b8c 100644 (file)
--- a/perf.c
+++ b/perf.c
@@ -287,5 +287,7 @@ perf_print_state (int lev)
 }
 
 #else
+#ifdef _MSC_VER  /* Dummy function needed to avoid empty file compiler warning in Microsoft VC */
 static void dummy(void) {}
 #endif
+#endif
index e06a2ed7dbc321ba2b89d040af43d074496e5578..d90ac9681f6c434148384d424370eaf85f740e82 100644 (file)
--- a/pkcs11.c
+++ b/pkcs11.c
@@ -982,5 +982,7 @@ cleanup:
 }
 
 #else
+#ifdef _MSC_VER  /* Dummy function needed to avoid empty file compiler warning in Microsoft VC */
 static void dummy (void) {}
+#endif
 #endif /* ENABLE_PKCS11 */