Changeset c07e238 in rtems

Timestamp:
06/18/21 17:20:27 (3 years ago)
Author:
Andre Przywara <andre.przywara@…>
Branches:
master
Children:
4c05a91
Parents:
21351a2
git-author:
Andre Przywara <andre.przywara@…> (06/18/21 17:20:27)
git-committer:
Sebastian Huber <sebastian.huber@…> (12/14/21 15:00:44)
Message:

fdtget: Fix signedness comparisons warnings

With -Wsign-compare, compilers warn about a mismatching signedness in
the different legs of the conditional operator, in fdtget.c.

In the questionable expression, we are constructing a 16-bit value out of
two unsigned 8-bit values, however are relying on the compiler's
automatic expansion of the uint8_t to a larger type, to survive the left
shift. This larger type happens to be an "int", so this part of the
expression becomes signed.

Fix this by explicitly blowing up the uint8_t to a larger *unsigned* type,
before doing the left shift. And while we are at it, convert the hardly
readable conditional operator usage into a sane switch/case expression.

This fixes "make fdtget", when compiled with -Wsign-compare.

Signed-off-by: Andre Przywara <andre.przywara@…>
Message-Id: <20210618172030.9684-3-andre.przywara@…>
Signed-off-by: David Gibson <david@…>

(No files)

Note: See TracChangeset for help on using the changeset viewer.