[liboping] [PATCH] Remove -Werror

Ladislav Michl ladis at linux-mips.org
Thu Apr 11 14:47:50 CEST 2019


Specifying both -Wall and -Werror for gcc is not futureproof as gcc adds
more warnings over time and that could lead to build failure over time.

Signed-off-by: Ladislav Michl <ladis at linux-mips.org>
---
 Sorry, no pull request. I'm cosidering strange to ask people to
 create github account just to be able to contribute.

 This patch is a quick fix to following compilation error using 
 gcc (Debian 8.3.0-6) 8.3.0:

 make[3]: Entering directory '/home/ladis/src/liboping/src'
 gcc -DHAVE_CONFIG_H -I.    -Wall -Werror -g -O2 -c -o oping.o oping.c
 /bin/bash ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I.    -Wall -Werror -g -O2 -c -o liboping_la-liboping.lo `test -f 'liboping.c' || echo './'`liboping.c
 libtool: compile:  gcc -DHAVE_CONFIG_H -I. -Wall -Werror -g -O2 -c liboping.c  -fPIC -DPIC -o .libs/liboping_la-liboping.o
 liboping.c: In function ‘ping_host_add’:
 liboping.c:207:9: error: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 243 [-Werror=format-truncation=]
     "%s: %s", function, message);
         ^~
 liboping.c:1645:40:
     ping_set_error (obj, "getaddrinfo", errmsg);
                                        ~~~~~~
 liboping.c:206:2: note: ‘snprintf’ output between 14 and 269 bytes into a destination of size 256
   snprintf (obj->errmsg, sizeof (obj->errmsg),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     "%s: %s", function, message);
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 cc1: all warnings being treated as errors

 I'm considering this warning pretty stupid in this particular case, hence
 this patch

 src/Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index b8571aa..79d957c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,7 +3,7 @@ AUTOMAKE_OPTIONS = foreign no-dependencies
 SUBDIRS = mans
 
 if COMPILER_IS_GCC
-AM_CFLAGS = -Wall -Werror
+AM_CFLAGS = -Wall
 endif
 
 include_HEADERS = oping.h
-- 
2.20.1



More information about the liboping mailing list