From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 27DBE21C16A; Thu, 29 May 2025 22:28:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748557731; cv=none; b=sE5O5EcYNcKAr/ujSykowYh1GD012JOmzzkGV/D7vIqRoRfYLzmAWh+2lUolVsHHnmZqJWASts/NGsQubW+K1Y9SFenQ34rJBoKeCBu8M7EV+/HHiUXUtJkXeeeom5OgCegfk5TBTRtKCzWby+x+ObGkrDU1uhg/G2WenLxMoWA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748557731; c=relaxed/simple; bh=e8TEEjSp0s5O/t4hPJKOBKjjl39Qm/MlC3Px+bz4X6M=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=ENOh+dClhhwED90+EUBH23gT+d1XpTVu44TB1nTKQ/4qmvLVURQBWGBkGYktslBkmecWB2mZg3na+Hzf+TMZ2CabhTPIJkcxOXN9dUNhvJQiERboDOPY8u8YXhp5h0tvKSO58mFV3SQx9JsNzRXmO8IlLwvMIxhTO/XGlvICYxM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LSE+Qogj; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LSE+Qogj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3D1BC4CEE7; Thu, 29 May 2025 22:28:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1748557730; bh=e8TEEjSp0s5O/t4hPJKOBKjjl39Qm/MlC3Px+bz4X6M=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=LSE+QogjEYxkiI3sLL/2EWF227oOpNqqRoZADdjan2fcCNc9UUQS4OdWtWVe/ergC 1R1Sx85xFvZXUEYlIzWn1sSyL0FVVMn5ur0w5vTebKCYhUrnk9ONcxoYZssfGFTZc1 jdV+lxkgQI9JODNCb7eV6uxeVlFJxq2wk9EGxpXI7JmY0dhMsy+fFiUZM5Rs+2Zhmz 0Hy2mfoLEHBR0TkPikAF4nJBe4f0f+E2nKvjJx5CG3V5vJSePFppIjZpm0Rsc5IDB7 Pw1TBBR2VABrd6+Goqd0O2vhvtFoR+IlRcGCQHedBRhDomXoDHAAiG1KvUPKMx/JJq pktQJ6hgr2jUA== Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 30 May 2025 00:28:37 +0200 Message-Id: Cc: "Alice Ryhl" , "Michal Rostecki" , "Miguel Ojeda" , "Alex Gaynor" , "Boqun Feng" , "Gary Guo" , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , "Andreas Hindborg" , "Trevor Gross" , "Brendan Higgins" , "David Gow" , "Rae Moar" , "Danilo Krummrich" , "Maarten Lankhorst" , "Maxime Ripard" , "Thomas Zimmermann" , "David Airlie" , "Simona Vetter" , "Greg Kroah-Hartman" , "Rafael J. Wysocki" , "Luis Chamberlain" , "Russ Weight" , "FUJITA Tomonori" , "Rob Herring" , "Saravana Kannan" , "Peter Zijlstra" , "Ingo Molnar" , "Will Deacon" , "Waiman Long" , "Nathan Chancellor" , "Nick Desaulniers" , "Bill Wendling" , "Justin Stitt" , "Andrew Lunn" , "Heiner Kallweit" , "Russell King" , "David S. Miller" , "Eric Dumazet" , "Jakub Kicinski" , "Paolo Abeni" , "Bjorn Helgaas" , "Arnd Bergmann" , "Jens Axboe" , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , , , , , , , , , , , Subject: Re: [PATCH v10 4/5] rust: replace `kernel::c_str!` with C-Strings From: "Benno Lossin" To: "Tamir Duberstein" X-Mailer: aerc 0.20.1 References: <20250524-cstr-core-v10-0-6412a94d9d75@gmail.com> <20250524-cstr-core-v10-4-6412a94d9d75@gmail.com> In-Reply-To: On Fri May 30, 2025 at 12:21 AM CEST, Tamir Duberstein wrote: > On Wed, May 28, 2025 at 11:35=E2=80=AFAM Benno Lossin = wrote: >> On Wed May 28, 2025 at 12:36 PM CEST, Alice Ryhl wrote: >> > On Mon, May 26, 2025 at 06:29:46PM -0400, Tamir Duberstein wrote: >> >> On Mon, May 26, 2025 at 11:04=E2=80=AFAM Benno Lossin wrote: >> >> > >> >> > On Sat May 24, 2025 at 10:33 PM CEST, Tamir Duberstein wrote: >> >> > > +macro_rules! c_str_avoid_literals { >> >> > >> >> > I don't like this name, how about `concat_to_c_str` or >> >> > `concat_with_nul`? >> >> > >> >> > This macro also is useful from macros that have a normal string lit= eral, >> >> > but can't turn it into a `c""` one. >> >> >> >> Uh, can you give an example? I'm not attached to the name. >> > >> > I also think it should be renamed. Right now it sounds like it creates= a >> > c string while avoiding literals in the input ... whatever that means. >> >> Yeah that's a good way to put why the name is weird. >> >> > I like Benno's suggestions, but str_to_cstr! could also work? >> >> Hmm, I think then people won't know that it can also concat? I don't >> think it matters too much, the macro probably won't be used that often >> and if someone needs to use it, they probably wouldn't fine it by name >> alone. > > What do you mean by "it can also concat"? This macro by itself doesn't > concat, it takes only a single expr. Oh right, seems like I thought it took `$($t:tt)*`... > The example in the docs illustrates: > > const MY_CSTR: &CStr =3D c_str_avoid_literals!(concat!(...)); > > I think str_to_cstr is ok - I'll do that in v11. Sounds good! --- Cheers, Benno