Skip to contentSkip to conversation

build: don't suppress various warnings

PATCH New Pablo Neira Ayuso 1 participant 3 messages Nov 24, 2022 netfilter

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/3 build: don't suppress various warnings

From: Sam James <[email protected]>

These will become fatal with Clang 16 and GCC 14 anyway, but let's address the real problem (followup commit).

We do have to keep one wrt yyerror() & const char * though, but the issue is contained to the code Bison generates.

---
posted via https://bugzilla.netfilter.org/show_bug.cgi?id=1637

 src/Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/Makefile.am +1 -1
index a1a91a0c8df6..2986ab3b4d4f 100644
@@ -61,7 +61,7 @@ conntrackd_SOURCES += systemd.c
 endif
 
 # yacc and lex generate dirty code
-read_config_yy.o read_config_lex.o: AM_CFLAGS += -Wno-missing-prototypes -Wno-missing-declarations -Wno-implicit-function-declaration -Wno-nested-externs -Wno-undef -Wno-redundant-decls -Wno-sign-compare
+read_config_yy.o read_config_lex.o: AM_CFLAGS += -Wno-incompatible-pointer-types -Wno-discarded-qualifiers
 
 conntrackd_LDADD = ${LIBMNL_LIBS} ${LIBNETFILTER_CONNTRACK_LIBS} \
 		   ${libdl_LIBS} ${LIBNFNETLINK_LIBS}
Signature · 1 line
2.30.2
author maintainer
#1 lore raw

PATCH 2/3 network: Fix -Wstrict-prototypes

From: Sam James <[email protected]>

---
posted via https://bugzilla.netfilter.org/show_bug.cgi?id=1637

 src/network.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/network.c +1 -1
index 13db37c96bb0..2560d97bab06 100644
@@ -113,7 +113,7 @@ void nethdr_track_update_seq(uint32_t seq)
 	STATE_SYNC(last_seq_recv) = seq;
 }
 
-int nethdr_track_is_seq_set()
+int nethdr_track_is_seq_set(void)
 {
 	return local_seq_set;
 }
Signature · 1 line
2.30.2
author maintainer
#2 lore raw

PATCH 3/3 Fix -Wimplicit-function-declaration

In reply to Pablo Neira Ayuso

From: Sam James <[email protected]>

read_config_yy.c: In function ‘yyparse’:
read_config_yy.c:1765:16: warning: implicit declaration of function ‘yylex’ [-Wimplicit-function-declaration]

 1765 |       yychar = yylex ();
      |                ^~~~~
read_config_yy.c:1765:16: warning: nested extern declaration of ‘yylex’ [-Wnested-externs]
read_config_yy.y:120:17: warning: implicit declaration of function ‘dlog’ [-Wimplicit-function-declaration]
  120 |                 dlog(LOG_ERR, "LogFile path is longer than %u characters",
      |                 ^~~~
read_config_yy.y:120:17: warning: nested extern declaration of ‘dlog’ [-Wnested-externs]
read_config_yy.y:240:14: warning: implicit declaration of function ‘inet_aton’; did you mean ‘in6_pton’? [-Wimplicit-function-declaration]
  240 |         if (!inet_aton($2, &conf.channel[conf.channel_num].u.mcast.in)) {
      |              ^~~~~~~~~
      |              in6_pton

---
posted via https://bugzilla.netfilter.org/show_bug.cgi?id=1637

 src/read_config_lex.l |  3 ++-
 src/read_config_yy.y  | 11 +++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)
src/read_config_lex.l +2 -1
index 7dc400a3a9b5..27084329d185 100644
@@ -21,6 +21,7 @@
 
 #include <string.h>
 
+#include "log.h"
 #include "conntrackd.h"
 #include "read_config_yy.h"
 %}
@@ -174,7 +175,7 @@ notrack		[N|n][O|o][T|t][R|r][A|a][C|c][K|k]
 %%
 
 int
-yywrap()
+yywrap(void)
 {
 	return 1;
 }
src/read_config_yy.y +11 -0
index a2154be3733e..f06c6afff7cb 100644
@@ -31,14 +31,25 @@
 #include "cidr.h"
 #include "helper.h"
 #include "stack.h"
+#include "log.h"
+
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
 #include <sched.h>
 #include <dlfcn.h>
+
 #include <libnetfilter_conntrack/libnetfilter_conntrack.h>
 #include <libnetfilter_conntrack/libnetfilter_conntrack_tcp.h>
 
 extern char *yytext;
 extern int   yylineno;
 
+int yylex (void);
+int yyerror (char *msg);
+void yyrestart (FILE *input_file);
+
 struct ct_conf conf;
 
 static void __kernel_filter_start(void);
Signature · 1 line
2.30.2