Re: termios constants should be unsigned
From: Alejandro Colomar <alx@kernel.org>
Date: 2024-06-12 16:28:54
Also in:
linux-man
Attachments
- signature.asc [application/pgp-signature] 833 bytes
From: Alejandro Colomar <alx@kernel.org>
Date: 2024-06-12 16:28:54
Also in:
linux-man
Hi Paul, On Wed, Jun 12, 2024 at 07:55:14AM GMT, Paul Eggert wrote:
On 2024-06-12 05:16, Alejandro Colomar wrote:quoted
tcgets.c:53:24: error: implicit conversion changes signedness: 'int' to 'tcflag_t' (aka 'unsigned int') [clang-diagnostic-sign-conversion,-warnings-as-errors]This is a bug in Clang not glibc, and if you're worried about it I suggest sending a bug report to the Clang folks about the false positive. Even GCC's -Wsign-conversion, which is at least smart enough to not warn about benign conversions like that, is too often so chatty that it's best avoided. A lot of this stuff is pedanticism that dates back to the bad old days when the C standard allowed ones' complement and signed magnitude representations of signed integers. Although it can be amusing to worry about that possibility (I know I've done it) it's never been a practical worry, and even the motivation of pedanticism is going away now that C23 requires two's complement.
I know; I think I have -Weverything enabled in that run, which is known for its pedanticity. I usually disable it when it triggers a warning, since they are usually nonsense. But in this case, adding U is a net improvement, without downsides (or I can't see them). So, while the kernel and glibc are just fine with this implicit conversion, they would be equally fine and even better without the conversion. Not a bug, but rather a slight improvement. Have a lovely day! Alex -- <https://www.alejandro-colomar.es/>