From: Bart Van Assche <bvanassche@acm.org>
To: James Bottomley <James.Bottomley@HansenPartnership.com>,
ksummit@lists.linux.dev, Dan Williams <dan.j.williams@intel.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
Dan Carpenter <dan.carpenter@linaro.org>
Subject: Re: Clarifying confusion of our variable placement rules caused by cleanup.h
Date: Tue, 18 Nov 2025 09:18:50 -0800 [thread overview]
Message-ID: <f63891cb-13e7-443f-bf02-5a357aa2a70b@acm.org> (raw)
In-Reply-To: <58fd478f408a34b578ee8d949c5c4b4da4d4f41d.camel@HansenPartnership.com>
On 11/18/25 8:39 AM, James Bottomley wrote:
> The problem specifically is this added comment in cleanup.h:
>
>> * That bug is fixed by changing init() to call guard() and define +
>> * initialize @obj in this order::
>> *
>> * guard(mutex)(&lock);
>> * struct object *obj __free(remove_free) = alloc_add();
>
> Which is recommending mixing declarations and code contrary to our
> prior rule. I note the rule against mixing variables and code was
> relaxed in the C99 standard (and in a lot of other languages), but
> we've never formally changed our coding rules.
>
> I'm not saying we have to stick with C89, just that if we change
> adherence to it, we should do so globally and document it because
> having incosistency for __free vs other variables really isn't a good
> idea.
A related question is whether or not to allow declarations in the
initialization expression of for-statements. Although some maintainers
reject patches that use this C99 feature, apparently this feature is
already used extensively:
$ git grep -nH 'for (int ' | grep -vE '^Documentation/|^tools/' | wc -l
1239
Thanks,
Bart.
next prev parent reply other threads:[~2025-11-18 17:19 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-18 16:39 James Bottomley
2025-11-18 17:18 ` Bart Van Assche [this message]
2025-11-18 18:38 ` Linus Torvalds
2025-11-18 19:04 ` Bart Van Assche
2025-11-18 19:14 ` Linus Torvalds
2025-11-18 20:43 ` Al Viro
2025-11-18 19:15 ` H. Peter Anvin
2025-11-18 19:11 ` H. Peter Anvin
2025-11-18 19:16 ` Linus Torvalds
2025-11-18 19:19 ` H. Peter Anvin
2025-11-18 19:17 ` Steven Rostedt
2025-11-18 19:22 ` Linus Torvalds
2025-11-18 19:56 ` Steven Rostedt
2025-11-18 20:23 ` Linus Torvalds
2025-11-18 21:05 ` Linus Torvalds
2025-11-18 20:21 ` James Bottomley
2025-11-18 20:30 ` Linus Torvalds
2025-11-18 20:51 ` Steven Rostedt
2025-11-18 21:10 ` James Bottomley
2025-11-18 22:34 ` Steven Rostedt
2025-11-18 23:32 ` James Bottomley
2025-11-18 19:23 ` H. Peter Anvin
2025-11-18 20:28 ` James Bottomley
2025-11-25 13:09 ` Jani Nikula
2025-11-25 14:25 ` Alexey Dobriyan
2025-11-25 15:32 ` Stephen Hemminger
2025-11-25 16:04 ` Steven Rostedt
2025-11-25 17:57 ` H. Peter Anvin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f63891cb-13e7-443f-bf02-5a357aa2a70b@acm.org \
--to=bvanassche@acm.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=dan.carpenter@linaro.org \
--cc=dan.j.williams@intel.com \
--cc=ksummit@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox