Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#1546 closed defect (fixed)

nginx/1.14.0 compilation with gcc 8.1.0 fails

Reported by: Dariusz Bogdanski Owned by: Sergey Kandaurov <pluknet@…>
Priority: minor Milestone:
Component: other Version: 1.13.x
Keywords: Cc:
uname -a: Linux MHRPi01UK 4.14.39-v7+ #1112 SMP Sat May 5 12:01:33 BST 2018 armv7l GNU/Linux
nginx -V: N/A

Description

nginx/1.14.0 compilation with gcc 8.1.0 fails - it works perfectly with gcc 7.3.0.

result:

src/http/ngx_http_script.c:698:18: error: cast between incompatible function types from ‘size_t (*)(ngx_http_script_engine_t *)’ {aka ‘unsigned int (*)(struct <anonymous> *)’} to ‘
void (*)(ngx_http_script_engine_t *)’ {aka ‘void (*)(struct <anonymous> *)’} [-Werror=cast-function-type]

code->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;


src/http/ngx_http_script.c: In function ‘ngx_http_script_add_var_code’:
src/http/ngx_http_script.c:787:18: error: cast between incompatible function types from ‘size_t (*)(ngx_http_script_engine_t *)’ {aka ‘unsigned int (*)(struct <anonymous> *)’} to ‘
void (*)(ngx_http_script_engine_t *)’ {aka ‘void (*)(struct <anonymous> *)’} [-Werror=cast-function-type]

code->code = (ngx_http_script_code_pt) ngx_http_script_copy_var_len_code;


src/http/ngx_http_script.c: In function ‘ngx_http_script_add_capture_code’:
src/http/ngx_http_script.c:1181:18: error: cast between incompatible function types from ‘size_t (*)(ngx_http_script_engine_t *)’ {aka ‘unsigned int (*)(struct <anonymous> *)’} to
‘void (*)(ngx_http_script_engine_t *)’ {aka ‘void (*)(struct <anonymous> *)’} [-Werror=cast-function-type]

code->code = (ngx_http_script_code_pt)


src/http/ngx_http_script.c: In function ‘ngx_http_script_add_full_name_code’:
src/http/ngx_http_script.c:1296:18: error: cast between incompatible function types from ‘size_t (*)(ngx_http_script_engine_t *)’ {aka ‘unsigned int (*)(struct <anonymous> *)’} to
‘void (*)(ngx_http_script_engine_t *)’ {aka ‘void (*)(struct <anonymous> *)’} [-Werror=cast-function-type]

code->code = (ngx_http_script_code_pt) ngx_http_script_full_name_len_code;


cc1: all warnings being treated as errors
objs/Makefile:945: recipe for target 'objs/src/http/ngx_http_script.o' failed
make[1]: * [objs/src/http/ngx_http_script.o] Error 1
make[1]:
* Waiting for unfinished jobs....
make[1]: Leaving directory '/home/pi/Sources/nginx-1.14.0'
Makefile:8: recipe for target 'build' failed
make: * [build] Error 2

Change History (3)

comment:1 by Sergey Kandaurov, 7 years ago

Status: newaccepted

comment:2 by Sergey Kandaurov <pluknet@…>, 7 years ago

Owner: set to Sergey Kandaurov <pluknet@…>
Resolution: fixed
Status: acceptedclosed

In 7271:9e25a5380a21/nginx:

Silenced -Wcast-function-type warnings (closes #1546).

Cast to intermediate "void *" to lose compiler knowledge about the original
type and pass the warning. This is not a real fix but rather a workaround.

Found by gcc8.

comment:3 by Sergey Kandaurov <pluknet@…>, 6 years ago

In 7406:ed5b3c4c1284/nginx:

Silenced -Wcast-function-type warnings (closes #1546).

Cast to intermediate "void *" to lose compiler knowledge about the original
type and pass the warning. This is not a real fix but rather a workaround.

Found by gcc8.

Note: See TracTickets for help on using tickets.