lkml.org 
[lkml]   [2022]   [Oct]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] kbuild: drop -Wdeclaration-after-statement
On Fri, Oct 28, 2022 at 1:00 PM Alexey Dobriyan <adobriyan@gmail.com> wrote:
>
> Putting declarations in the beginning of the block is an afterfact from
> single pass compiler era. Compiler would parse all declarations, layout
> stack frame and proceed to generate code.

No, putting declarations at the beginning is still kernel syntax.

Don't declare variables in multiple places. It gets really confusing.
Put all declarations at the top of the block they are contained in.

IOW, -Wdeclaration-after-statement does exactly the right thing, and stays.

This is not about "old compilers", this is about coding rules.

Linus

\
 
 \ /
  Last update: 2022-10-28 22:30    [W:0.044 / U:0.324 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site