[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wiEXm3y7BrFnymC_6icE7seicGyyML+Oxd_BP9t=ztNKg@mail.gmail.com>
Date: Fri, 28 Oct 2022 13:29:08 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Alexey Dobriyan <adobriyan@...il.com>
Cc: akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
catalin.marinas@....com, will@...nel.org,
rafael.j.wysocki@...el.com, masahiroy@...nel.org
Subject: Re: [PATCH] kbuild: drop -Wdeclaration-after-statement
On Fri, Oct 28, 2022 at 1:00 PM Alexey Dobriyan <adobriyan@...il.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
Powered by blists - more mailing lists