This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
[PATCH] sys/types.h: Avoid bit-manipulation of signed values
- From: Nick Withers <nick dot withers at anu dot edu dot au>
- To: <newlib at sourceware dot org>
- Date: Thu, 12 Nov 2015 15:11:27 +1100
- Subject: [PATCH] sys/types.h: Avoid bit-manipulation of signed values
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp dot mailfrom=nick dot withers at anu dot edu dot au;
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:23
Hi all,
The patch below attempts to resolve potential undefined behaviour in
bit-manipulation in the FD_* macros, also clearing up the GCC warning
"conversion to 'unsigned int' from 'int' may change the sign of the
result" with -Wsign-conversion and an int FD parameter.
If folk're happy with this, should I make similar changes to
"newlib/libc/sys/linux/sys/types.h"? Not sure I want to touch
"winsup/cygwin/include/sys/param.h"... :-P
Ta!
--
Nick Withers
Embedded Systems Programmer
Department of Nuclear Physics, Research School of Physics and Engineering
The Australian National University (CRICOS: 00120C)