chiark / gitweb /
build system: Add warning suppressions for GCC9
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 19 Nov 2019 00:42:31 +0000 (00:42 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 19 Nov 2019 20:41:40 +0000 (20:41 +0000)
We suppress 4 instances like:

  udp.c:113:45: error: increment of a boolean expression [-Werror=bool-operation]
    113 |     if (us->experienced[!!dest][af][success]++)
|                                             ^~

This is a very convenient idiom (using the saturating property of
boolean addition) and there is no sensible replacement.

And we suppress 6 instances like:

  tun.c:322:6: error: 'strncpy' specified bound 16 equals destination size [-Werror=stringop-truncation]
    322 |      strncpy(ifr.ifr_name,st->interface_name,IFNAMSIZ);
|      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

All write to ifr_name.  strncpy is precisely right for this, since the
API supports non-null-terminated names of length IFNAMSIZ.  That is
why I used strncpy.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
common.make.in

index b772704..7c073b1 100644 (file)
@@ -31,4 +31,5 @@ CFLAGS:=-Wall @WRITESTRINGS@ @CFLAGS@ -Werror \
        -Wmissing-declarations -Wnested-externs -Wredundant-decls \
        -Wpointer-arith -Wformat=2 -Winit-self \
        -Wswitch-enum -Wunused-variable -Wunused-function -Wbad-function-cast \
-       -Wno-strict-aliasing -fno-strict-aliasing
+       -Wno-strict-aliasing -fno-strict-aliasing \
+       -Wno-bool-operation -Wno-stringop-truncation