Re: Warnings from latest HEAD (zsh-5.9.0.3-test-357-g599af46) build
Mikael Magnusson <[email protected]> Mon, 15 Jun 2026 01:54:02 +0200
| Newsgroups | gmane.comp.shells.zsh.devel |
|---|---|
| Message-ID | <CAHYJk3SBzsidh+cPxg-Sjoc1fC4YdxNxAp=MOnjwu8zmRAs2aA@mail.gmail.com> |
On Mon, Jun 15, 2026 at 1:38 AM Bart Schaefer <[email protected]> wrote: > > Apple clang version 17.0.0 (clang-1700.6.4.2) > Target: arm64-apple-darwin24.6.0 > Thread model: posix > > These are all from "54710: handle multibyte arguments in error messages" > > gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -I/opt/local/include > -DHAVE_CONFIG_H -Wall -Wmissing-prototypes -ggdb -o exec.o exec.c > exec.c:3303:8: warning: label followed by a declaration is a C23 > extension [-Wc23-extensions] > 3303 | convchar_t opt = unmeta_one(cmdopt, NULL); > | ^ > 1 warning generated.compctl.c:544:4: warning: label followed by a > declaration is a C23 extension [-Wc23-extensions] > 544 | convchar_t s = unmeta_one(p, NULL); > | ^ > 1 warning generated.complete.c:800:3: warning: label followed by a > declaration is a C23 extension [-Wc23-extensions] > 800 | convchar_t c = unmeta_one(p, NULL); > | ^ > complete.c:1168:2: warning: label followed by a declaration is a C23 > extension [-Wc23-extensions] > 1168 | convchar_t c = unmeta_one(&argv[0][1], NULL); > | ^ > 2 warnings generated. > > I'm surprised glob.c doesn't produce a similar error from > > default: > untokenize(--s); > - zerr("unknown file attribute: %c", *s); > + convchar_t attr = unmeta_one(s, NULL); > + zerr("unknown file attribute: %c", attr); > restore_globstate(saved); > return; > > IIRC we've been trying to stick to the "declarations only at the start > of a block" convention. I think we gave up on that a while ago, the problem here is actually the opposite. The untokenize(--s); statement being between the label and the variable declaration makes the glob.c instance ok. Of course, the warning was intended to protect against jumping past the initialization of the variable, but it's insufficient exactly because it doesn't fire in this case. It's also not a problem in these instances because they're all in the final label so you can't jump past them, but I'll change them to either declare convchar_t earlier or add braces on the default case, whichever seems nicer. -- Mikael Magnusson