From: Alexey Dobriyan <adobriyan@gmail.com>
To: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: corbet@lwn.net, workflows@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/9] CodingStyle: mention "typedef struct S {} S;" if typedef is used
Date: Tue, 13 May 2025 21:37:31 +0300 [thread overview]
Message-ID: <6513ce31-bb0f-4692-bc98-75232ce2ee70@p183> (raw)
In-Reply-To: <20250510124711.6b5d8b9a@foz.lan>
On Sat, May 10, 2025 at 12:47:19PM +0200, Mauro Carvalho Chehab wrote:
> Em Fri, 9 May 2025 23:34:25 +0300
> Alexey Dobriyan <adobriyan@gmail.com> escreveu:
>
> > Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> > ---
> > Documentation/process/coding-style.rst | 14 ++++++++++++++
> > 1 file changed, 14 insertions(+)
> >
> > diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst
> > index ac9c1dbe00b7..5c5902a0f897 100644
> > --- a/Documentation/process/coding-style.rst
> > +++ b/Documentation/process/coding-style.rst
> > @@ -443,6 +443,20 @@ EVER use a typedef unless you can clearly match one of those rules.
> > In general, a pointer, or a struct that has elements that can reasonably
> > be directly accessed should **never** be a typedef.
> >
> > +If you must use ``typedef`` consider using identical names for both the type
> > +and its alias so that the type can be forward declared if necessary:
>
> Better not, as symbols with duplicated names will generate a Sphinx warning (*).
>
> (*) It shouldn't, but there is a pending issue on Sphinx since version 3.1
> still not addressed:
>
> https://github.com/sphinx-doc/sphinx/pull/8313
OMG, so we are at mercy of static checkers _and_ documentation system? now
I've realised, changelog is bady worded:
Some people invent styles when typedef'ing struct/union:
typedef struct xxx_s {} xxx;
typedef struct _xxx {} xxx;
There is no reason to do that, just typedef to exact same name.
next prev parent reply other threads:[~2025-05-13 18:37 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-09 20:34 [PATCH 1/9] CodingStyle: make Documentation/CodingStyle into symlink Alexey Dobriyan
2025-05-09 20:34 ` [PATCH 2/9] CodingStyle: delete explicit numbering Alexey Dobriyan
2025-05-12 9:06 ` Jani Nikula
2025-05-09 20:34 ` [PATCH 3/9] CodingStyle: advise on using "sysctl" in sysctl variables Alexey Dobriyan
2025-05-09 20:34 ` [PATCH 4/9] CodingStyle: mention "typedef struct S {} S;" if typedef is used Alexey Dobriyan
2025-05-10 6:18 ` Greg KH
2025-05-13 18:34 ` Alexey Dobriyan
2025-05-10 10:47 ` Mauro Carvalho Chehab
2025-05-10 10:47 ` Mauro Carvalho Chehab
2025-05-13 18:37 ` Alexey Dobriyan [this message]
2025-05-09 20:34 ` [PATCH 5/9] CodingStyle: institute better inline assembly formatting Alexey Dobriyan
2025-05-13 19:41 ` David Laight
2025-05-09 20:34 ` [PATCH 6/9] CodingStyle: recommend static_assert/_Static_assert Alexey Dobriyan
2025-05-10 6:21 ` Greg KH
2025-05-13 18:41 ` Alexey Dobriyan
2025-05-13 19:40 ` David Laight
2025-05-09 20:34 ` [PATCH 7/9] CodingStyle: new variable declaration placement rule Alexey Dobriyan
2025-05-09 20:34 ` [PATCH 8/9] CodingStyle: tell people how to split long "for" loops Alexey Dobriyan
2025-05-10 18:56 ` David Laight
2025-05-12 16:20 ` Alexey Dobriyan
2025-05-12 16:59 ` Greg KH
2025-05-12 19:09 ` David Laight
2025-05-09 20:34 ` [PATCH 9/9] CodingStyle: flip the rule about curlies Alexey Dobriyan
2025-05-09 21:44 ` Randy Dunlap
2025-05-10 6:18 ` Greg KH
2025-05-12 16:43 ` Jeff Johnson
2025-05-12 16:56 ` Greg KH
2025-05-13 19:06 ` Alexey Dobriyan
2025-05-15 16:33 ` Jeff Johnson
2025-05-09 20:40 ` [PATCH 1/9] CodingStyle: make Documentation/CodingStyle into symlink Ozgur Kara
2025-05-10 10:05 ` Jonathan Corbet
2025-05-12 16:08 ` Alexey Dobriyan
2025-05-12 16:57 ` Greg KH
2025-05-13 18:32 ` Alexey Dobriyan
2025-05-14 18:55 ` Jonathan Corbet
2025-05-13 4:12 ` Al Viro
2025-05-13 18:33 ` Alexey Dobriyan
2025-05-13 19:04 ` Al Viro
2025-05-13 19:26 ` Alexey Dobriyan
2025-05-13 19:50 ` Al Viro
2025-05-19 16:21 ` Pavel Machek
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=6513ce31-bb0f-4692-bc98-75232ce2ee70@p183 \
--to=adobriyan@gmail.com \
--cc=corbet@lwn.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab+huawei@kernel.org \
--cc=workflows@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