Reported by: GCC -Warray-parameter
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped - Build Status
Buildable 48641 Build 45527: arc lint + arc unit
Event Timeline
Hmmm, maybe be a little more expansive on the commit message. Why do we need to do this?
GCC warns when the function definition and prototype do not agree on array bounds. Here the function prototype in vport.h is:
int mlx5_modify_nic_vport_mac_address(struct mlx5_core_dev *dev, u16 vport, u8 mac[ETH_ALEN]);
Now, it may be that the prototype should be fixed instead because in the surrounding context, the other functions use pointers:
int mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev, u16 vport, u8 *addr); int mlx5_modify_nic_vport_mac_address(struct mlx5_core_dev *dev, u16 vport, u8 mac[ETH_ALEN]); int mlx5_set_nic_vport_current_mac(struct mlx5_core_dev *mdev, int vport, bool other_vport, u8 *addr);
I think the reason the compiler cares is that the compiler can make optimization assumptions based on explicit array bounds. I think that the danger there is more the opposite case though where the function has a fixed bound and the prototype is missing the bounds, but GCC warns about any mismatch. It's easier to just fix these nits than to shut up the warning IMO.
But I will probably wait to see what Hans thinks though as in this case it's probably more consistent to patch the prototype in vport.h to use a pointer I think,
Just make sure the prototype and the implementation are identical. Also MFC this to 13 and 12 stable.