On 04/01/2026 03:23, correctmost wrote:
Hi,
I recently started seeing the following warnings when compiling sed from its
master branch:
---
lib/quotearg.c:479:11: warning: code will never be executed [-Wunreachable-code]
479 | unsigned char esc;
| ^~~~~~~~~~~~~~~~~~
1 warning generated.
coverity warned about something similar for this line,
though since there is no initialization on that line it should be fine.
lib/getdelim.c:90:11: warning: jump from this goto statement to its label is
incompatible with C++ [-Wjump-misses-init]
90 | goto unlock_return;
| ^
lib/getdelim.c:95:10: note: jump bypasses variable initialization
95 | size_t cur_len = 0;
| ^
1 warning generated.
---
The warnings seem to be related to commit 6edf6dbacf1, "lib: Reduce scope of local
variables". I don't think the warnings are visible when using -Wall or -Wextra, so
I thought I'd report them in case they are worth addressing.
I am compiling with clang 21.1.6 on Arch Linux (using most of the warnings
included by -Weverything).
This is also fine as the goto doesn't need the initialization.
However there is a cognitive load to determine that in general.
IMHO any code with gotos should have all variables declared/initialized
before any gotos.
cheers,
Padraig