netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* compilation warning --with-mini-gmp
@ 2018-01-09 13:26 Pablo Neira Ayuso
  2018-01-10 12:43 ` [nft PATCH] src/Makefile: Restore per object CFLAGS Phil Sutter
  0 siblings, 1 reply; 3+ messages in thread
From: Pablo Neira Ayuso @ 2018-01-09 13:26 UTC (permalink / raw)
  To: Phil Sutter; +Cc: netfilter-devel

We 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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [nft PATCH] src/Makefile: Restore per object CFLAGS
  2018-01-09 13:26 compilation warning --with-mini-gmp Pablo Neira Ayuso
@ 2018-01-10 12:43 ` Phil Sutter
  2018-01-10 14:23   ` Pablo Neira Ayuso
  0 siblings, 1 reply; 3+ messages in thread
From: Phil Sutter @ 2018-01-10 12:43 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: netfilter-devel

As per the automake manual, create internal libraries for parser and
mini-gmp sources so per-object flags can be set.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 src/Makefile.am | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 7581ec2090092..7fa72a8ea5bc2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -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}
-- 
2.13.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [nft PATCH] src/Makefile: Restore per object CFLAGS
  2018-01-10 12:43 ` [nft PATCH] src/Makefile: Restore per object CFLAGS Phil Sutter
@ 2018-01-10 14:23   ` Pablo Neira Ayuso
  0 siblings, 0 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2018-01-10 14:23 UTC (permalink / raw)
  To: Phil Sutter; +Cc: netfilter-devel

On Wed, Jan 10, 2018 at 01:43:21PM +0100, Phil Sutter wrote:
> As per the automake manual, create internal libraries for parser and
> mini-gmp sources so per-object flags can be set.

Applied, thanks Phil.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-01-10 14:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-09 13:26 compilation warning --with-mini-gmp Pablo Neira Ayuso
2018-01-10 12:43 ` [nft PATCH] src/Makefile: Restore per object CFLAGS Phil Sutter
2018-01-10 14:23   ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).