Open simonhf opened 6 years ago
Made these errors go away by adding these compiler attributes to the above file and several others:
$ diff src/core/ngx_murmurhash.c.orig src/core/ngx_murmurhash.c
37a38
> __attribute__((fallthrough));
39a41
> __attribute__((fallthrough));
Also run into these compiler errors:
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused -Werror -g -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/lib/x86_64-linux-gnu/perl/5.26/CORE -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules -I src/http/modules/perl \
-o objs/src/http/modules/perl/ngx_http_perl_module.o \
src/http/modules/perl/ngx_http_perl_module.c
In file included from src/http/modules/perl/ngx_http_perl_module.h:18:0,
from src/http/modules/perl/ngx_http_perl_module.c:22:
src/http/modules/perl/ngx_http_perl_module.c: In function ‘ngx_perl_resolver_handler’:
/usr/lib/x86_64-linux-gnu/perl/5.26/CORE/pp.h:338:41: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
# define _EXTEND_NEEDS_GROW(p,n) ( (n) < 0 || PL_stack_max - p < (n))
^
/usr/lib/x86_64-linux-gnu/perl/5.26/CORE/perl.h:3684:62: note: in definition of macro ‘EXPECT’
# define EXPECT(expr,val) __builtin_expect(expr,val)
^~~~
/usr/lib/x86_64-linux-gnu/perl/5.26/CORE/perl.h:3689:52: note: in expansion of macro ‘cBOOL’
#define UNLIKELY(cond) EXPECT(cBOOL(cond),FALSE)
^~~~~
/usr/lib/x86_64-linux-gnu/perl/5.26/CORE/pp.h:341:30: note: in expansion of macro ‘UNLIKELY’
if (UNLIKELY(_EXTEND_NEEDS_GROW(p,n))) { \
^~~~~~~~
/usr/lib/x86_64-linux-gnu/perl/5.26/CORE/pp.h:341:39: note: in expansion of macro ‘_EXTEND_NEEDS_GROW’
if (UNLIKELY(_EXTEND_NEEDS_GROW(p,n))) { \
^~~~~~~~~~~~~~~~~~
src/http/modules/perl/ngx_http_perl_module.c:1767:9: note: in expansion of macro ‘EXTEND’
EXTEND(SP, ctx->naddrs);
^~~~~~
/usr/lib/x86_64-linux-gnu/perl/5.26/CORE/pp.h:338:65: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
# define _EXTEND_NEEDS_GROW(p,n) ( (n) < 0 || PL_stack_max - p < (n))
^
/usr/lib/x86_64-linux-gnu/perl/5.26/CORE/perl.h:3684:62: note: in definition of macro ‘EXPECT’
# define EXPECT(expr,val) __builtin_expect(expr,val)
^~~~
/usr/lib/x86_64-linux-gnu/perl/5.26/CORE/perl.h:3689:52: note: in expansion of macro ‘cBOOL’
#define UNLIKELY(cond) EXPECT(cBOOL(cond),FALSE)
^~~~~
/usr/lib/x86_64-linux-gnu/perl/5.26/CORE/pp.h:341:30: note: in expansion of macro ‘UNLIKELY’
if (UNLIKELY(_EXTEND_NEEDS_GROW(p,n))) { \
^~~~~~~~
/usr/lib/x86_64-linux-gnu/perl/5.26/CORE/pp.h:341:39: note: in expansion of macro ‘_EXTEND_NEEDS_GROW’
if (UNLIKELY(_EXTEND_NEEDS_GROW(p,n))) { \
^~~~~~~~~~~~~~~~~~
src/http/modules/perl/ngx_http_perl_module.c:1767:9: note: in expansion of macro ‘EXTEND’
EXTEND(SP, ctx->naddrs);
^~~~~~
In file included from /usr/lib/x86_64-linux-gnu/perl/5.26/CORE/perl.h:5644:0,
from src/http/modules/perl/ngx_http_perl_module.h:18,
from src/http/modules/perl/ngx_http_perl_module.c:22:
/usr/lib/x86_64-linux-gnu/perl/5.26/CORE/pp.h:306:68: error: signed and unsigned type in conditional expression [-Werror=sign-compare]
(sizeof(n) > sizeof(SSize_t) && ((SSize_t)(n) != (n)) ? -1 : (n))
^
/usr/lib/x86_64-linux-gnu/perl/5.26/CORE/embed.h:589:53: note: in definition of macro ‘stack_grow’
#define stack_grow(a,b,c) Perl_stack_grow(aTHX_ a,b,c)
^
/usr/lib/x86_64-linux-gnu/perl/5.26/CORE/pp.h:342:49: note: in expansion of macro ‘_EXTEND_SAFE_N’
sp = stack_grow(sp,p,_EXTEND_SAFE_N(n)); \
^~~~~~~~~~~~~~
src/http/modules/perl/ngx_http_perl_module.c:1767:9: note: in expansion of macro ‘EXTEND’
EXTEND(SP, ctx->naddrs);
^~~~~~
cc1: all warnings being treated as errors
objs/Makefile:1078: recipe for target 'objs/src/http/modules/perl/ngx_http_perl_module.o' failed
make[1]: *** [objs/src/http/modules/perl/ngx_http_perl_module.o] Error 1
make[1]: Leaving directory '/home/simon/20180226-swoole-proxy/nginx-perl'
Makefile:9: recipe for target 'build' failed
make: *** [build] Error 2
Fixed these by turning the compiler warning off and on around that particular macro:
$ diff src/http/modules/perl/ngx_http_perl_module.c.orig src/http/modules/perl/ngx_http_perl_module.c
1766a1767,1768
> #pragma GCC diagnostic ignored "-Wtype-limits"
> #pragma GCC diagnostic ignored "-Wsign-compare"
1767a1770,1771
> #pragma GCC diagnostic warning "-Wtype-limits"
> #pragma GCC diagnostic warning "-Wsign-compare"