Welcome! Log In Create A New Profile

Advanced

Re: Patch to fix compile errors for Windows CL compiler

Maxim Dounin
March 07, 2019 11:52AM
Hello!

On Wed, Mar 06, 2019 at 02:01:57PM -0600, Steve Stevenson wrote:

> We are seeing build issues due to the flag -WX Warnings as Errors. Doing
> the analysis we see redundant declarations of *pkey in
> `src\event\ngx_event_openssl.c` . I have made the changes and validated
> the compile finishes properly. See the below changeset patch.
>
> # HG changeset patch
> # User Steve Stevenson <sstevenson72@gmail.com>
> # Date 1551891444 21600
> # Wed Mar 06 10:57:24 2019 -0600
> # Node ID 6f818d1f3dc795ce3b8a84d3a720a89fcba7a1e5
> # Parent 49f9d2f7d8877cf7d86fc43c07ef86fc494175bc
> removed redundant *pkey definition leading to Compile errors (Warnings as
> Errors) in windows compilation
>
> diff -r 49f9d2f7d887 -r 6f818d1f3dc7 src/event/ngx_event_openssl.c
> --- a/src/event/ngx_event_openssl.c Tue Mar 05 16:34:19 2019 +0300
> +++ b/src/event/ngx_event_openssl.c Wed Mar 06 10:57:24 2019 -0600
> @@ -703,7 +703,6 @@
>
> u_char *p, *last;
> ENGINE *engine;
> - EVP_PKEY *pkey;
>
> p = key->data + sizeof("engine:") - 1;
> last = (u_char *) ngx_strchr(p, ':');

Thanks. The code compiles fine with cl 16.00.40219.01 (MSVC 2010)
as used for official win32 builds, but fails with lastest cl
19.16.27027.1 from Visual Studio 2017 build tools. Looks like the
warning was introduced in MSVC 2015.

Here are the patch which clarifies these details, and also fixes
style of the variables block:

# HG changeset patch
# User Maxim Dounin <mdounin@mdounin.ru>
# Date 1551976881 -10800
# Thu Mar 07 19:41:21 2019 +0300
# Node ID 97904e5d7f844295412d15aa9bfe2f97b795f352
# Parent 49f9d2f7d8877cf7d86fc43c07ef86fc494175bc
SSL: removed redundant "pkey" variable.

It was accidentally introduced in 77436d9951a1 (1.15.10). In MSVC 2015
and more recent MSVC versions it triggers warning C4456 (declaration of
'pkey' hides previous local declaration), seen with cl 19.16.27027.1
from Visual Studio 2017 build tools.

Reported by Steve Stevenson.

diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c
--- a/src/event/ngx_event_openssl.c
+++ b/src/event/ngx_event_openssl.c
@@ -701,9 +701,8 @@ ngx_ssl_load_certificate_key(ngx_pool_t

#ifndef OPENSSL_NO_ENGINE

- u_char *p, *last;
- ENGINE *engine;
- EVP_PKEY *pkey;
+ u_char *p, *last;
+ ENGINE *engine;

p = key->data + sizeof("engine:") - 1;
last = (u_char *) ngx_strchr(p, ':');

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Patch to fix compile errors for Windows CL compiler

Steve Stevenson 84 March 06, 2019 03:04PM

Re: Patch to fix compile errors for Windows CL compiler

Maxim Dounin 45 March 07, 2019 11:52AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 75
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready