From: Alejandro Colomar <alx+linux-man@kernel.org>
To: Christopher Bazley <chris.bazley.wg14@gmail.com>
Cc: Martin Uecker <uecker@tugraz.at>,
"Michael Kerrisk (man7.org)" <mtk@man7.org>,
linux-man@vger.kernel.org,
Michael Kerrisk <mtk.manpages@gmail.com>,
Sam James <sam@gentoo.org>, Carlos O'Donell <carlos@redhat.com>,
"Joseph S. Myers" <josmyers@redhat.com>,
corbet@lwn.net
Subject: Re: [PATCH] man/: SYNOPSIS: Remove GNU forward-declarations of parameters for lengths of array parameters
Date: Thu, 29 Oct 2026 23:57:10 +0100 [thread overview]
Message-ID: <auPMgtCvcPOooOYU@devuan> (raw)
In-Reply-To: <CAEHU8x_+Lyf=K+pNzG0SWPRkQrb5AtqjYdkehV-fwX3ahsPrQQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3192 bytes --]
Hi Chris,
> Date: 2026-10-29 21:24:14+0000
> From: Christopher Bazley <chris.bazley.wg14@gmail.com>
>
[...]
> I don't want anything like this (fictitious) syntax:
>
> bool ObjEditSelection_for_each_changed(ObjEditSelection const *a,
> ObjEditSelection const *b,
> _Optional MapArea const *map_area,
> void callback[static](MapPoint, void *), void *cb_arg);
Indeed, me neither. Just to clarify, this will still be disallowed by
my paper.
> What C actually needs is a standard extension to the direct declarator
> syntax to allow pointers to functions of qualified type. Even
> disregarding _Optional, SDCC's __reentrant and __banked keywords would
> benefit from such standard syntax. SDCC currently has inconsistencies
> in this area, for example https://sourceforge.net/p/sdcc/bugs/3989/
> and https://sourceforge.net/p/sdcc/bugs/4027/
Also agree. In fact, I believe [[reproducible]] should actually be a
_Reproducible function qualifier (actually, an anti-qualifier). I plan
to work on a paper for that, but I need several things to happen first:
- Non-access qualifiers to be standardized. Several function
qualifiers, to avoid annotating most functions, should be
anti-qualifiers.
I believe the paper about address-space qualifiers will help in this
regard.
- Type variance. This is essential for backwards compatiblity.
> Although the keywords __reentrant and __banked appear syntactically in
> the position of a C23 attribute, I consider them type qualifiers
> rather than attributes because ignoring them can change the calling
> convention and make calls incorrect. They also participate in type
> checking:
>
> int reentrant(int *) __reentrant;
> int banked(int *) __banked;
> int plain(int *);
>
> int main(void)
> {
> int (*r)(int *) __reentrant = reentrant;
> r = plain; // how is this safe?
> r = banked; // error
>
> int (*b)(int *) __banked = banked;
> b = plain; // error
> b = reentrant; // error
>
> int (*p)(int *) = plain;
> p = reentrant;
> p = banked; // error
>
> return 0;
> }
> https://godbolt.org/z/hPsxWe6Ga
>
> I increasingly think this is also the right position for the qualifier
> in a declaration of a pointer to
> an optional function, e.g.
>
> int (*o)(int *) _Optional = fn;
>
> as a possible alternative to
>
> _Optional typeof(int (int *)) *o = fn;
Also agree. My idea was to have this:
size_t strlen(const char *s) _Reproducible;
and collapse both attributes into a single qualifier. We don't need
a tri-state, IMO.
Have a lovely night!
Alex
> Currently, type-qualifier-list appears after
> attribute-specifier-sequence in both alternatives for 'pointer'
> but not elsewhere it would be needed, such as after
> function-declarator in one of the alternatives for direct-declarator,
> nor after function-abstract-declarator in one of the alternatives for
> direct-abstract-declarator (which is where it would need to be
> permitted to allow qualified function type names to appear in casts).
>
> Best regards,
> Christopher
--
<https://www.alejandro-colomar.es>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2026-10-29 22:57 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-22 16:44 [PATCH] man/: SYNOPSIS: Remove GNU forward-declarations of parameters for lengths of array parameters Alejandro Colomar
2026-10-22 17:11 ` Martin Uecker
2026-10-22 20:01 ` Alejandro Colomar
2026-10-22 20:27 ` Alejandro Colomar
2026-10-22 17:37 ` Christopher Bazley
[not found] ` <CAEHU8x9jET+vcrR0NpDz6t57egQG8TZqx5XtV52srH9ZRvdxSQ@mail.gmail.com>
2026-10-22 19:54 ` Alejandro Colomar
2026-10-23 11:53 ` Michael Kerrisk (man7.org)
2026-10-23 12:42 ` Alejandro Colomar
2026-11-17 19:17 ` Alejandro Colomar
2026-10-23 15:51 ` Christopher Bazley
2026-10-24 12:45 ` Michael Kerrisk (man7.org)
2026-10-24 13:38 ` Alejandro Colomar
2026-10-24 16:16 ` Christopher Bazley
2026-10-24 16:37 ` Alejandro Colomar
2026-10-24 18:11 ` Martin Uecker
2026-10-25 6:59 ` Alejandro Colomar
2026-10-25 7:22 ` Martin Uecker
2026-10-25 7:38 ` Alejandro Colomar
2026-10-25 8:29 ` G. Branden Robinson
2026-10-25 8:40 ` Martin Uecker
2026-10-25 8:57 ` Alejandro Colomar
2026-10-25 9:05 ` Martin Uecker
2026-10-29 21:24 ` Christopher Bazley
2026-10-29 22:57 ` Alejandro Colomar [this message]
2026-10-23 12:11 ` Alejandro Colomar
2026-10-22 22:03 ` Mark Harris
2026-10-23 9:43 ` Alejandro Colomar
2026-10-23 19:32 ` Mark Harris
2026-10-23 20:06 ` Alejandro Colomar
2026-10-24 7:53 ` Martin Uecker
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=auPMgtCvcPOooOYU@devuan \
--to=alx+linux-man@kernel.org \
--cc=carlos@redhat.com \
--cc=chris.bazley.wg14@gmail.com \
--cc=corbet@lwn.net \
--cc=josmyers@redhat.com \
--cc=linux-man@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
--cc=mtk@man7.org \
--cc=sam@gentoo.org \
--cc=uecker@tugraz.at \
/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