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)
Mon, Oct 6, 3:29 AM
Unknown Object (File)
Sun, Sep 14, 11:37 PM
Unknown Object (File)
Sun, Sep 14, 1:08 PM
Unknown Object (File)
Aug 18 2025, 2:07 AM
Unknown Object (File)
Aug 17 2025, 3:39 PM
Unknown Object (File)
Aug 4 2025, 10:47 AM
Unknown Object (File)
Jul 28 2025, 2:16 PM
Unknown Object (File)
Jul 27 2025, 2:22 AM
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.