os: Fix clang constant warning in Port_allocator.

Clang 11 produces the following warning when building port_allocator.cc:

port_allocator.cc:27:21: error: result of comparison of constant 65536 with
expression of type 'const Genode::uint16_t' (aka 'const unsigned short') is
always true [-Werror,-Wtautological-constant-out-of-range-compare]
               (port.value <  (unsigned)(Port_allocator::FIRST +

Basically the code compares Port::value (uint16_t) against a constant
65536 which is larger than UINT16_MAX (65535). This comparison will always
be true.

Issue #3984
This commit is contained in:
Piotr Tworek 2020-11-16 01:48:58 +01:00 committed by Norman Feske
parent ffc2a2f306
commit 05c36d67ce

View File

@ -18,12 +18,8 @@ using namespace Net;
using namespace Genode;
bool Net::dynamic_port(Port const port)
{
return port.value >= (unsigned)Port_allocator::FIRST &&
port.value < (unsigned)Port_allocator::FIRST +
Port_allocator::COUNT;
}
bool Net::dynamic_port(Port const port) {
return port.value >= Port_allocator::FIRST; }
/********************