[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YzRoZwhxE4182cm2@liuwe-devbox-debian-v2>
Date: Wed, 28 Sep 2022 15:29:43 +0000
From: Wei Liu <wei.liu@...nel.org>
To: Miguel Ojeda <ojeda@...nel.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org, patches@...ts.linux.dev,
Jarkko Sakkinen <jarkko@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Finn Behrens <me@...enk.de>,
Adam Bratschi-Kaye <ark.email@...il.com>,
Wedson Almeida Filho <wedsonaf@...gle.com>,
Sumera Priyadarsini <sylphrenadin@...il.com>,
Gary Guo <gary@...yguo.net>, Matthew Bakhtiari <dev@...k.me>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Boqun Feng <boqun.feng@...il.com>, Wei Liu <wei.liu@...nel.org>
Subject: Re: [PATCH v10 10/27] rust: add `macros` crate
On Tue, Sep 27, 2022 at 03:14:41PM +0200, Miguel Ojeda wrote:
> This crate contains all the procedural macros ("proc macros")
> shared by all the kernel.
>
> Procedural macros allow to create syntax extensions. They run at
> compile-time and can consume as well as produce Rust syntax.
>
> For instance, the `module!` macro that is used by Rust modules
> is implemented here. It allows to easily declare the equivalent
> information to the `MODULE_*` macros in C modules, e.g.:
>
> module! {
> type: RustMinimal,
> name: b"rust_minimal",
> author: b"Rust for Linux Contributors",
> description: b"Rust minimal sample",
> license: b"GPL",
> }
I don't use / know much of procedural macros, so I don't feel like I'm
qualified to review this patch.
Just a general question: what is the house rule for adding new proc
macros? They are powerful tools. I can see their value in `module!`
because writing all that boilerplate by hand is just painful. Yet they
are not straightforward to understand. It is difficult, just by looking
at the macro, to fully grasp what the final code looks like (though the
rsi target will help). Is there a concern that proc macro gets abused?
Thanks,
Wei.
Powered by blists - more mailing lists