This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [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: Fri, 13 Nov 2015 09:42:27 +1100
- Subject: Re: [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;
- References: <1447301487 dot 1005 dot 12 dot camel at anu dot edu dot au> <1447301650 dot 1005 dot 14 dot camel at anu dot edu dot au> <20151112125702 dot GD17435 at calimero dot vinschen dot de>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:23
On Thu, 2015-11-12 at 13:57 +0100, Corinna Vinschen wrote:
> On Nov 12 15:14, Nick Withers wrote:
> > Sorry, let's try that again...
> >
> > On Thu, 2015-11-12 at 15:11 +1100, Nick Withers wrote:
> > > 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.
>
> Sorry if I'm dense, but... all these macros (NBBY, FD_SETSIZE,
> howmany)
> are defined using int values, not unsigned int values, in glibc and
> everywhere else, e.g. X11/Xpoll.h, python2.7/pyport.h, etc. I don't
> think we should use different definitions which potentially collide.
Righto, I'll submit a new version which does not modify these elements.
Can I kill howmany() entirely within sys/types.h or is it intended to
be exposed to userland after the header's included?
Should I provide a patch to the linux / winsup FD_ code?
> Corinna