From 800c86d5fa6ed32026e33d9db56739b0c696c40e Mon Sep 17 00:00:00 2001 From: Pádraig Brady
Date: Thu, 18 May 2023 10:38:11 +0100 Subject: build: avoid false -Wmaybe-uninitialized warnings Allow easily building a debug build for example with: make CFLAGS='-O0 -ggdb' False -Wmaybe-uninitialized warnings hit in different places depending on the compiler passes used. These changes were tested with gcc 10.2.1, 12.2.1, and 13.1.1 like: for o in g s z fast 0 1 2 3; do make clean && make -j$(nproc) CFLAGS="-O$o" || break done * src/digest.c: Disable -Wmaybe-uninitialized that gives false positive here at -O0. * src/ln.c: Avoid -Wmaybe-uninitialized that gives false positive here at -O1. * src/pr.c: Likewise. * src/sort.c: Likewise. * src/tee.c: Avoid -Wmaybe-uninitialized that gives false positive here at -O3 on gcc 13.1.1 at least. * src/cp.c: Avoid -Wmaybe-uninitialized that gives false positive here at -Os on gcc 13.1.1 at least. * src/copy.c: Avoid -Wmaybe-uninitialized that gives false positive here at -Og on gcc 13.1.1 at least. * src/head.c: Likewise. * src/paste.c: Likewise. --- src/paste.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/paste.c') diff --git a/src/paste.c b/src/paste.c index 5c194d8fe..468ef3ab0 100644 --- a/src/paste.c +++ b/src/paste.c @@ -233,7 +233,7 @@ paste_parallel (size_t nfiles, char **fnamptr) for (size_t i = 0; i < nfiles && files_open; i++) { - int chr; /* Input character. */ + int chr IF_LINT ( = -1); /* Input character. */ int err; /* Input errno value. */ bool sometodo = false; /* Input chars to process. */ -- cgit v1.2.3