Re: declarations after a case statement

Dan Carpenter <[email protected]> Fri, 5 Jun 2026 08:50:37 +0300
Newsgroups org.kernel.vger.linux-sparse
Message-ID <[email protected]>
On Thu, Jun 04, 2026 at 03:21:00PM +0100, Derek M Jones wrote:
> 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
> 

That's an awkward thing because GCC allows it and the kernel is
doing it.

net/mac80211/mesh_hwmp.c +373
        switch (action) {
        case MPATH_PREQ:
                struct ieee80211_mesh_hwmp_preq_top *preq_elem_top =
                        (void *)hwmp_ie;
                struct ieee80211_mesh_hwmp_preq_bottom *preq_elem_bottom =
                        ieee80211_mesh_hwmp_preq_get_bottom(hwmp_ie);

                orig_addr = preq_elem_top->orig_addr;

regards,
dan carpenter