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
F151886272: D15747.diff
Sat, Apr 11, 8:46 AM
F151868139: D15747.diff
Sat, Apr 11, 5:39 AM
Unknown Object (File)
Tue, Apr 7, 1:29 AM
Unknown Object (File)
Mon, Apr 6, 7:27 PM
Unknown Object (File)
Sun, Apr 5, 6:58 PM
Unknown Object (File)
Sun, Apr 5, 5:41 PM
Unknown Object (File)
Sun, Apr 5, 11:22 AM
Unknown Object (File)
Sat, Apr 4, 9:23 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 Not Applicable
Unit
Tests Not Applicable

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.