Page MenuHomeFreeBSD

Fix build of ocs_fs with base gcc on i386
ClosedPublic

Authored by dim on Jun 10 2018, 8:41 PM.
Tags
None
Referenced Files
F106140133: D15747.diff
Thu, Dec 26, 1:41 AM
Unknown Object (File)
Nov 22 2024, 8:00 AM
Unknown Object (File)
Nov 22 2024, 7:59 AM
Unknown Object (File)
Nov 22 2024, 7:59 AM
Unknown Object (File)
Nov 22 2024, 7:36 AM
Unknown Object (File)
Nov 13 2024, 9:45 AM
Unknown Object (File)
Oct 19 2024, 3:59 AM
Unknown Object (File)
Oct 2 2024, 3:19 AM
Subscribers

Details

Summary

Base gcc fails to compile sys/dev/ocs_fc/ocs_ioctl.c and
sys/dev/ocs_fc/ocs_sport.c for i386, with the following -Werror
warnings:

cc1: warnings being treated as errors
/usr/src/sys/dev/ocs_fc/ocs_ioctl.c: In function 'ocs_process_sli_config':
/usr/src/sys/dev/ocs_fc/ocs_ioctl.c:143: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/usr/src/sys/dev/ocs_fc/ocs_ioctl.c:172: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/usr/src/sys/dev/ocs_fc/ocs_ioctl.c:173: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/usr/src/sys/dev/ocs_fc/ocs_ioctl.c:187: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
/usr/src/sys/dev/ocs_fc/ocs_ioctl.c: In function 'ocs_process_mbx_ioctl':
/usr/src/sys/dev/ocs_fc/ocs_ioctl.c:253: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
cc1: warnings being treated as errors
/usr/src/sys/dev/ocs_fc/ocs_sport.c: In function '__ocs_sport_attached':
/usr/src/sys/dev/ocs_fc/ocs_sport.c:784: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
/usr/src/sys/dev/ocs_fc/ocs_sport.c:808: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]

This is because on i386, the casts from in_addr and out_addr (aka
uint64_t) to a pointer reduce the value from 64 bit to 32 bit.

For gcc, this can be fixed by an intermediate cast to uintptr_t. Note
that I am assuming the incoming values will always fit into 32 bit!

For ocs_sport.c, the problem is different, because it tries to print
the display_name field as a string, but first tries to cast it to
unsigned long long. These casts can be removed.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 17152
Build 17005: arc lint + arc unit

Event Timeline

Thanks Ken. Changes look good.

This revision is now accepted and ready to land.Jun 11 2018, 5:37 AM
This revision was automatically updated to reflect the committed changes.