]> git.ipfire.org Git - thirdparty/coreutils.git/commit
build: avoid false -Wmaybe-uninitialized warnings
authorPádraig Brady <P@draigBrady.com>
Thu, 18 May 2023 09:38:11 +0000 (10:38 +0100)
committerPádraig Brady <P@draigBrady.com>
Thu, 18 May 2023 11:13:47 +0000 (12:13 +0100)
commit800c86d5fa6ed32026e33d9db56739b0c696c40e
tree588d1729df9adcdda3fbb5a701fef66ce75c3ae8
parentaed3b8190aca198ac4ef7f7951ee67da61569598
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/copy.c
src/cp.c
src/digest.c
src/head.c
src/ln.c
src/paste.c
src/pr.c
src/sort.c
src/tee.c