From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2586FC3F6B0 for ; Fri, 29 Jul 2022 08:05:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234027AbiG2IFB (ORCPT ); Fri, 29 Jul 2022 04:05:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229784AbiG2IFB (ORCPT ); Fri, 29 Jul 2022 04:05:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83D8319C0E; Fri, 29 Jul 2022 01:04:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1ECB261B7A; Fri, 29 Jul 2022 08:04:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02DCBC433C1; Fri, 29 Jul 2022 08:04:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1659081898; bh=x5iwixgmr+VlHTq5scaZuKlrBeunluPiau3t1p/QL+s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=z29jy6PIELGGQT8XQSEzLMZZ5GLdTrUTDj7XQovl+Q/4gaRXiykfo/ePYeA1z/GN8 G8zBCFz0o/lX+RMFz6y6kP+HgOkPMf2cbgt713Nki676wrHFLvjWsTQPk5hmrgT7H/ g1nv7G+mLKURrlGg0ixEZOAWfgYbIFgAZyA/IZiM= Date: Fri, 29 Jul 2022 10:04:55 +0200 From: Greg Kroah-Hartman To: Olliver Schinagl Cc: Gary Guo , Miguel Ojeda , Miguel Ojeda , Linus Torvalds , rust-for-linux , Linux Kbuild mailing list , Linux Doc Mailing List , linux-kernel Subject: Re: [PATCH 00/13] [RFC] Rust support Message-ID: References: <20210414184604.23473-1-ojeda@kernel.org> <5c0bb1db-5589-32ca-ac22-4aafb3c15751@schinagl.nl> <20220728112114.0000003a@garyguo.net> <5bd688b0-7694-0a96-67e6-7137c018c9a5@schinagl.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5bd688b0-7694-0a96-67e6-7137c018c9a5@schinagl.nl> Precedence: bulk List-ID: X-Mailing-List: rust-for-linux@vger.kernel.org On Thu, Jul 28, 2022 at 10:45:08PM +0200, Olliver Schinagl wrote: > Hey Greg, > > On 28-07-2022 14:09, Greg Kroah-Hartman wrote: > > On Thu, Jul 28, 2022 at 11:21:14AM +0100, Gary Guo wrote: > > > Rust requires braces around branches of if expression, and C doesn't. > > > So in kernel coding style you often have: > > > > > > if (condition) do_something(); > > > > That is not a valid kernel coding style, and our tools should catch this > > and prevent it from being added to the kernel tree. > Are you sure? I'm not sure if this isn't true today, but I've certainly seen > old code where this definitely was done. Was all of this cleaned up in the > last 2+ years? Given that I wrote about this back in 2002, and it was true then: https://www.linuxjournal.com/article/5780 and: https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.2.8887&rep=rep1&type=pdf that is not anything new at all. Yes, old code still survives that might not be correct, and some subsystems might have added code over time without the proper style, but our tools check that the above is not correct, you can check it yourself: $ cat foo.c // SPDX-License-Identifier: GPL-2.0 int foo(int baz) { if (baz == 1) do_something(); } $ ./scripts/checkpatch.pl --file --terse foo.c foo.c:4: ERROR: trailing statements should be on next line total: 1 errors, 0 warnings, 6 lines checked thanks, greg k-h