freebsd-src icon indicating copy to clipboard operation
freebsd-src copied to clipboard

Use C99 flexible array

Open ElyesH opened this issue 2 years ago • 6 comments

zero-length arrays have been deprecated since last millennium. https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html

ElyesH avatar Oct 17 '23 17:10 ElyesH

Typically we don't use a full path in the commit subject - e.g., it could be just bhyve: Use C99 flexible array instead of GNU extension. https://docs.freebsd.org/en/articles/committers-guide/#commit-log-message hints at this but is not explicit about what a "component" is

If the change relates to a specific component the subject line may be prefixed with that component name and a colon (:).

I can bring these changes in and update the commit message while doing so (but if you happen to update this pull request for other reasons you can roll that in). I would also add Pull Request: https://github.com/freebsd/freebsd-src/pull/869; we don't expect that in general in the submitted patch of course because the pull request number is not known a priori.

I can also take a look at updating the committer's guide with advice on what to use for a "component."

emaste avatar Oct 18 '23 15:10 emaste

@ElyesH could you do a rebase on this branch so we get a fresh CI build? None of the CI failures are related to your patch.

igalic avatar Dec 18 '23 11:12 igalic

see also dc0b4094abf6784bf1a9492c2fea3fb91116b014

igalic avatar Dec 22 '23 20:12 igalic

ping

ElyesH avatar Jan 12 '24 08:01 ElyesH

This doesn't actually build. Flexible arrays are only allowed in the outermost aggregate, yet there are cases where these aggregates are embedded in others and therefore are invalid. Please build test your patches.

jrtc27 avatar Feb 23 '24 21:02 jrtc27

This kind of conversion shouldn't also be done blindly. Each field should be audited to check it actually is being used as a pre-C99 flexible array and not something else, as I have pointed out is the case for rdma, but may also be true for others.

jrtc27 avatar Feb 23 '24 21:02 jrtc27

I'm going to close this. It's scope is too large. As @jrtc27 said, this needs to be done more carefully. Many of these changes are good, but separating the wheat from the chaff is too hard. This means this is not a good candidate for a pull request.

bsdimp avatar Apr 11 '24 17:04 bsdimp