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)
Sun, Nov 24, 6:04 AM
Unknown Object (File)
Oct 2 2024, 9:43 AM
Unknown Object (File)
Oct 1 2024, 10:49 PM
Unknown Object (File)
Sep 23 2024, 10:11 PM
Unknown Object (File)
Sep 23 2024, 3:05 PM
Unknown Object (File)
Sep 23 2024, 3:05 PM
Unknown Object (File)
Sep 23 2024, 3:05 PM
Unknown Object (File)
Sep 23 2024, 2:56 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.