Page MenuHomeFreeBSD

Fix constant conversion warning in cxgb(4)
ClosedPublic

Authored by dim on Sep 3 2016, 6:50 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Mar 28, 8:19 AM
Unknown Object (File)
Dec 19 2023, 11:32 PM
Unknown Object (File)
Dec 8 2023, 9:56 PM
Unknown Object (File)
Nov 29 2023, 5:26 PM
Unknown Object (File)
Oct 27 2023, 11:19 PM
Unknown Object (File)
Oct 25 2023, 5:38 PM
Unknown Object (File)
Oct 3 2023, 2:42 PM
Unknown Object (File)
Aug 30 2023, 8:41 PM
Subscribers

Details

Summary

With clang 3.9.0, compiling cxgb results in the following warning:

sys/dev/cxgb/cxgb_sge.c:2873:44: error: implicit conversion from 'int' to 'char' changes value from 128 to -128 [-Werror,-Wconstant-conversion]
                        *mtod(m, char *) = CPL_ASYNC_NOTIF;
                                         ~ ^~~~~~~~~~~~~~~

This is because CPL_ASYNC_NOTIF is 0x80, so the plain char argument is
wrapped to a negative value. While this should not effect the eventual
bits in the destination (which still end up as 0x80), it is better to
use uint8_t instead.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dim retitled this revision from to Fix constant conversion warning in cxgb(4).
dim updated this object.
dim edited the test plan for this revision. (Show Details)
dim added reviewers: kmacy, np, emaste.
np edited edge metadata.
This revision is now accepted and ready to land.Sep 3 2016, 6:55 PM
kmacy edited edge metadata.
This revision was automatically updated to reflect the committed changes.