From 415b2d46a39302b21b51758e83f81e5439ab487c Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Thu, 29 Jul 2021 09:13:19 +0200 Subject: axconfig.c, nrconfig.c, roseconfig.c: Fix GCC 11 warnings. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GCC 11's overyealously throws below warnings. Fixed by giving GCC a hint that the string actually is short enough to fit. libtool: compile: gcc -DHAVE_CONFIG_H -I. -DAX25_SYSCONFDIR=\"/usr/local/etc/ax25/\" -DAX25_LOCALSTATEDIR=\"/usr/local/var/ax25/\" -g -O2 -Wall -MT axconfig.lo -MD -MP -MF .deps/axconfig.Tpo -c axconfig.c -fPIC -DPIC -o .libs/axconfig.o axconfig.c: In function ‘ax25_config_load_ports’: axconfig.c:315:25: warning: ‘strncpy’ output may be truncated copying 15 bytes from a string of length 255 [-Wstringop-truncation] 315 | strncpy(ifr.ifr_name, s, IFNAMSIZ-1); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [...] libtool: compile: gcc -DHAVE_CONFIG_H -I. -DAX25_SYSCONFDIR=\"/usr/local/etc/ax25/\" -DAX25_LOCALSTATEDIR=\"/usr/local/var/ax25/\" -g -O2 -Wall -MT nrconfig.lo -MD -MP -MF .deps/nrconfig.Tpo -c nrconfig.c -fPIC -DPIC -o .libs/nrconfig.o nrconfig.c: In function ‘nr_config_load_ports’: nrconfig.c:294:25: warning: ‘strncpy’ output may be truncated copying 15 bytes from a string of length 255 [-Wstringop-truncation] 294 | strncpy(ifr.ifr_name, s, IFNAMSIZ-1); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [...] libtool: compile: gcc -DHAVE_CONFIG_H -I. -DAX25_SYSCONFDIR=\"/usr/local/etc/ax25/\" -DAX25_LOCALSTATEDIR=\"/usr/local/var/ax25/\" -g -O2 -Wall -MT rsconfig.lo -MD -MP -MF .deps/rsconfig.Tpo -c rsconfig.c -fPIC -DPIC -o .libs/rsconfig.o rsconfig.c: In function ‘rs_config_load_ports’: rsconfig.c:240:25: warning: ‘strncpy’ output may be truncated copying 15 bytes from a string of length 255 [-Wstringop-truncation] 240 | strncpy(ifr.ifr_name, s, IFNAMSIZ-1); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Ralf Baechle --- util.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 util.h (limited to 'util.h') diff --git a/util.h b/util.h new file mode 100644 index 0000000..2d2c252 --- /dev/null +++ b/util.h @@ -0,0 +1,12 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + */ +#ifndef __LIBAX25_UTIL_H +#define __LIBAX25_UTIL_H + +#define unreachable() \ + do { __builtin_unreachable(); } while (0) + +#endif /* __LIBAX25_UTIL_H */ -- cgit v1.2.3