From: "Fish Wang" Date: Wed, 1 Jul 2015 12:47:56 -0700 Message-ID: <015601d0b436$d555ad60$80010820$@gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0157_01D0B3FC.28F771A0" Content-Language: zh-cn Subject: [Openvpn-devel] Compiling issue on Visual Studio 2010 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: openvpn-devel@lists.sourceforge.net This is a multipart message in MIME format. ------=_NextPart_000_0157_01D0B3FC.28F771A0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 7bit Hi, Visual Studio 2010 refuses to compile the latest code on branch release/2.3 because __func__ is not supported. Microsoft supports __FUNCTION__ instead of __func__ in their compiler. VS 2013 complains the same. The following patch resolves this issue. diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c index aa93a7b..c4fda84 100644 --- a/src/openvpn/crypto.c +++ b/src/openvpn/crypto.c @@ -423,7 +423,7 @@ crypto_adjust_frame_parameters(struct frame *frame, frame_add_to_extra_frame (frame, crypto_overhead); msg(D_MTU_DEBUG, "%s: Adjusting frame parameters for crypto by %zu bytes", - __func__, crypto_overhead); + CURRENT_FUNCTION, crypto_overhead); } /* diff --git a/src/openvpn/crypto.h b/src/openvpn/crypto.h index e489827..66704ba 100644 --- a/src/openvpn/crypto.h +++ b/src/openvpn/crypto.h @@ -459,6 +459,15 @@ key_ctx_bi_defined(const struct key_ctx_bi* key) return key->encrypt.cipher || key->encrypt.hmac || key->decrypt.cipher || key->decrypt.hmac; } +/* + * __func__ is not yet supported on Visual Studio 2013 + */ + +#ifdef _MSC_VER + #define CURRENT_FUNCTION __FUNCTION__ +#else + #define CURRENT_FUNCTION __func__ +#endif #endif /* ENABLE_CRYPTO */ #endif /* CRYPTO_H */ Best, Fish ------=_NextPart_000_0157_01D0B3FC.28F771A0 Content-Type: text/html; charset="gb2312" Content-Transfer-Encoding: quoted-printable

Hi,

 

Visual Studio 2010 refuses to compile the= latest code on branch release/2.3 because __func__ is not supported. Micro= soft supports __FUNCTION__ instead of __func__ in their compiler. VS 2013 c= omplains the same.

 

Th= e following patch resolves this issue.

 

<= span lang=3DEN-US> 

diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c

index aa93a7b..c4fda8= 4 100644

--- a= /src/openvpn/crypto.c

+++ b/src/openvpn/crypto.c

@@ -423,7 +423,7 @@ crypto_adjust_frame_parameters(st= ruct frame *frame,

   frame_add_to_extra_frame (frame, crypto_overhead);

 

   msg(D_MTU_DEBU= G, "%s: Adjusting frame parameters for crypto by %zu bytes",=

-   = ;   __func__, crypto_overhead);

+      CURRENT_FUNCTIO= N, crypto_overhead);

}

 

/*<= /o:p>

diff --git a/src/op= envpn/crypto.h b/src/openvpn/crypto.h

index e489827..66704ba 100644

=

--- a/src/openvpn/crypto.h

+++ b/src/openvpn/cryp= to.h

@@ -459,6= +459,15 @@ key_ctx_bi_defined(const struct key_ctx_bi* key)

   return key->= encrypt.cipher || key->encrypt.hmac || key->decrypt.cipher || key->= ;decrypt.hmac;

}

 = ;

+/*

+ * __func__ is not yet sup= ported on Visual Studio 2013

+ */

+

+#ifde= f _MSC_VER

+&n= bsp;   #define CURRENT_FUNCTION __FUNCTION__

+#else

+    #define CURRENT_FUNCT= ION __func__

+= #endif

&n= bsp;

#endif /* ENA= BLE_CRYPTO */

= #endif /* CRYPTO_H */

 

Best,

Fish

= ------=_NextPart_000_0157_01D0B3FC.28F771A0--