Re: [PATCH] Various pages: SYNOPSIS: Use VLA syntax in function parameters

Alejandro Colomar
2022-11-10T00:06:49Z

[-- Attachment #1.1: Type: text/plain, Size: 1792 bytes --]

Hi Martin,

On 9/3/22 17:31, Martin Uecker wrote:
> My experience is that if one wants to see something fixed,
> one has to push for it. Standardization is meant
> to standardize existing practice, so if we want to see
> this improved, we can not wait for this.

I fully agree with you. I've been ruminating these patches for some time, for
having some more time to think about them. Now, I like them enough to push.
So, after a few minor cosmetic issues detected by some linters, I've pushed the
changes to document all of man2 and man3 with hypothetical VLA syntax.

Now, I've released man-pages-6.01 very recently (just a few weeks ago), and I
don't plan to release again in a year or two, so there's time to do the
implementation in GCC. From my side, please consider this an ACK or even
somewhat of a push to get things done in the compiler side of things :)

I'll show here an excerpt of what kind of syntax has been pushed. Of course,
there's room for improving/fixing, since it's not seen an official release, but
for now, this is what's up there:

int strncmp(const char s1[.n], const char s2[.n], size_t n);

long mbind(void addr[.len], unsigned long len, int mode,
const unsigned long nodemask[(.maxnode + ULONG_WIDTH ‐ 1)
/ ULONG_WIDTH],
unsigned long maxnode, unsigned int flags);

int cacheflush(void addr[.nbytes], int nbytes, int cache);

I've shown the three kinds of prototypes that have been changed:

- Normal VLA; nothing fancy except for the '.'.
- Complex size expressions.
- 'void *' VLAs (assuming GNU conventions: sizeof(void *)==1).

Cheers,

Alex