compilation warning --with-mini-gmp
Pablo Neira Ayuso
maintainerWe hit this since conversion to library:
mini-gmp.c: In function ‘mpn_get_str_bits’:
mini-gmp.c:1176:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (shift >= GMP_LIMB_BITS && ++i < un)
^
mini-gmp.c: In function ‘mpz_and’:
mini-gmp.c:1406:31: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
#define MPZ_REALLOC(z,n) ((n) > (z)->_mp_alloc \
^
mini-gmp.c:3650:8: note: in expansion of macro ‘MPZ_REALLOC’
rp = MPZ_REALLOC (r, rn + rc);
^
mini-gmp.c: In function ‘mpz_ior’:
mini-gmp.c:1406:31: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
#define MPZ_REALLOC(z,n) ((n) > (z)->_mp_alloc \
^
mini-gmp.c:3723:8: note: in expansion of macro ‘MPZ_REALLOC’
rp = MPZ_REALLOC (r, rn + rc);
^
mini-gmp.c: In function ‘mpz_xor’:
mini-gmp.c:1406:31: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
#define MPZ_REALLOC(z,n) ((n) > (z)->_mp_alloc \
^
mini-gmp.c:3792:8: note: in expansion of macro ‘MPZ_REALLOC’
rp = MPZ_REALLOC (r, un + rc);
^mini-gmp.c: In function ‘mpz_set_str’:
mini-gmp.c:4167:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
There is a knob that removes -Wsign-compare for this file, which is a cached copy from libgmp that we don't want to modify.
If you have some spare cycles, I'd appreciate.
Thanks Phil.
Phil Sutter
reviewerPATCH 1/1 src/Makefile: Restore per object CFLAGS
As per the automake manual, create internal libraries for parser and mini-gmp sources so per-object flags can be set.
--- src/Makefile.am | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-)
src/Makefile.am +17 -10
@@ -22,9 +22,6 @@ AM_CFLAGS = -Wall \ AM_YFLAGS = -d -# yacc and lex generate dirty code -parser_bison.o scanner.o: AM_CFLAGS += -Wno-missing-prototypes -Wno-missing-declarations -Wno-implicit-function-declaration -Wno-nested-externs -Wno-undef -Wno-redundant-decls - BUILT_SOURCES = parser_bison.h noinst_LTLIBRARIES = libnftables.la
@@ -56,19 +53,29 @@ libnftables_la_SOURCES = \ iface.c \ services.c \ mergesort.c \ - scanner.l \ tcpopt.c \ - parser_bison.y \ libnftables.c -if BUILD_MINIGMP -mini-gmp.o: AM_CFLAGS += -Wno-sign-compare +# yacc and lex generate dirty code +noinst_LTLIBRARIES += libparser.la +libparser_la_SOURCES = parser_bison.y scanner.l +libparser_la_CFLAGS = ${AM_CFLAGS} \ + -Wno-missing-prototypes \ + -Wno-missing-declarations \ + -Wno-implicit-function-declaration \ + -Wno-nested-externs \ + -Wno-undef \ + -Wno-redundant-decls + +libnftables_la_LIBADD = ${LIBMNL_LIBS} ${LIBNFTNL_LIBS} libparser.la -libnftables_la_SOURCES += mini-gmp.c +if BUILD_MINIGMP +noinst_LTLIBRARIES += libminigmp.la +libminigmp_la_SOURCES = mini-gmp.c +libminigmp_la_CFLAGS = ${AM_CFLAGS} -Wno-sign-compare +libnftables_la_LIBADD += libminigmp.la endif -libnftables_la_LIBADD = ${LIBMNL_LIBS} ${LIBNFTNL_LIBS} - if BUILD_XTABLES libnftables_la_SOURCES += xt.c libnftables_la_LIBADD += ${XTABLES_LIBS}
Signature · 1 line
2.13.1
Re: [nft PATCH] src/Makefile: Restore per object CFLAGS
Quoted 2 lines · Phil Sutter
As per the automake manual, create internal libraries for parser and mini-gmp sources so per-object flags can be set.
Applied, thanks Phil.