From a37bd5e070a0a11d03522a12b5d2b9a2647f7bbb Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Thu, 1 Feb 2018 23:18:46 -0200 Subject: [PATCH] lib: fix more warnings on *BSD * zebra/kernel_socket.c: include "rt.h" to provide the prototypes of kernel_init() and kernel_terminate(); * lib/prefix.h: remove the deprecation warning whenever ETHER_ADDR_LEN is used. isisd uses the ETHER_HDR_LEN constant which is defined in terms of ETHER_ADDR_LEN in the *BSD system headers. So, when building FRR on *BSD, we were getting several warnings because we were using ETHER_ADDR_LEN indirectly; * lib/command_lex.l, lib/defun_lex.l: ignore other harmless warnings; * lib/spf_backoff.c: cast 'tv->tv_usec' to 'long int' before printing. Signed-off-by: Renato Westphal --- lib/command_lex.l | 3 ++- lib/defun_lex.l | 3 ++- lib/prefix.h | 6 ------ lib/spf_backoff.c | 2 +- zebra/kernel_socket.c | 1 + 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/command_lex.l b/lib/command_lex.l index 436f3a241d..530900659b 100644 --- a/lib/command_lex.l +++ b/lib/command_lex.l @@ -23,8 +23,9 @@ */ %{ -/* ignore harmless bug in old versions of flex */ +/* ignore harmless bugs in old versions of flex */ #pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wmissing-prototypes" #include "command_parse.h" diff --git a/lib/defun_lex.l b/lib/defun_lex.l index 024445be63..87775a0e75 100644 --- a/lib/defun_lex.l +++ b/lib/defun_lex.l @@ -34,8 +34,9 @@ * code documentation in it. */ -/* ignore harmless bug in old versions of flex */ +/* ignore harmless bugs in old versions of flex */ #pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wunused-value" #include "config.h" #include diff --git a/lib/prefix.h b/lib/prefix.h index 7e947ea48a..bcc2230607 100644 --- a/lib/prefix.h +++ b/lib/prefix.h @@ -39,12 +39,6 @@ #define ETH_ALEN 6 #endif -/* for compatibility */ -#ifdef ETHER_ADDR_LEN -#undef ETHER_ADDR_LEN -#endif -#define ETHER_ADDR_LEN 6 CPP_WARN("ETHER_ADDR_LEN is being replaced by ETH_ALEN.\\n") - #define ETHER_ADDR_STRLEN (3*ETH_ALEN) /* * there isn't a portable ethernet address type. We define our diff --git a/lib/spf_backoff.c b/lib/spf_backoff.c index 92b7620eda..d7907fafdf 100644 --- a/lib/spf_backoff.c +++ b/lib/spf_backoff.c @@ -205,7 +205,7 @@ static const char *timeval_format(struct timeval *tv) size_t offset = strlen(timebuf); snprintf(timebuf + offset, sizeof(timebuf) - offset, ".%ld", - tv->tv_usec); + (long int)tv->tv_usec); return timebuf; } diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c index ba028ed09c..2a3b95058e 100644 --- a/zebra/kernel_socket.c +++ b/zebra/kernel_socket.c @@ -40,6 +40,7 @@ #include "privs.h" #include "vrf.h" +#include "zebra/rt.h" #include "zebra/interface.h" #include "zebra/zserv.h" #include "zebra/debug.h"