Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang does not like flexible array in the struct #14763

Closed
wants to merge 2 commits into from

Conversation

youzhongyang
Copy link
Contributor

Signed-off-by: Youzhong Yang yyang@mathworks.com

Motivation and Context

#14737 breaks FreeBSD build when clang is used, we need to make both Linux and FreeBSD happy.

Description

Add flexible array union member in struct dnode_phys_t for gcc only.

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

Youzhong Yang added 2 commits April 17, 2023 22:34
Signed-off-by: Youzhong Yang <yyang@mathworks.com>
Signed-off-by: Youzhong Yang <yyang@mathworks.com>
@lundman
Copy link
Contributor

lundman commented Apr 18, 2023

There is also -Wno-gnu-variable-sized-type-not-at-end in that, we know they are flexible but we aren't to use them that way, in this struct :) (perhaps with a #pragma clang diagnostic ignored "-Wno-gnu-variable-sized-type-not-at-end")
Similar to how we handle zfs_notreached or noreturn ?

@behlendorf
Copy link
Contributor

@lundman's suggestion seems preferable to me since it'd be nice to keep this code consistent across platforms.

@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label Apr 18, 2023
@behlendorf
Copy link
Contributor

Closing in favor of #14764 .

@behlendorf behlendorf closed this Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Code Review Needed Ready for review and testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants