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
Unknown Object (File)
Sat, Jun 29, 2:41 AM
Unknown Object (File)
May 1 2024, 1:18 AM
Unknown Object (File)
Dec 23 2023, 1:25 AM
Unknown Object (File)
Oct 20 2023, 7:43 PM
Unknown Object (File)
Oct 19 2023, 1:50 PM
Unknown Object (File)
Oct 13 2023, 5:51 PM
Unknown Object (File)
Oct 13 2023, 4:01 PM
Unknown Object (File)
Oct 12 2023, 10:18 PM
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.