Re: declarations after a case statement

Derek M Jones <[email protected]> Thu, 4 Jun 2026 15:21:00 +0100
Newsgroups org.kernel.vger.linux-sparse
Organization Knowledge Software, Ltd
Message-ID <[email protected]>
Dan

> Same thing for declaration after after a label.

Sparse is correct.  The usage you describe is a syntax error.

A label may only appear on a statement, not a
declaration
https://c0x.shape-of-code.com/6.8.1.html

> $ ./smatch test.c
> test.c:5:9: error: typename in expression
> test.c:5:14: error: Expected ; at end of statement
> test.c:5:14: error: got b
> test.c:5 func() warn: statement has no effect 'char'
> 
> void func(int a)
> {
>          goto out;
> out:
>          char b;
>          b = 1;
> }

-- 
Derek M. Jones           Evidence-based software engineering
blog:https://shape-of-code.com