Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Nov 2015 08:08:03 -0700
From:      Ian Lepore <ian@freebsd.org>
To:        Hans Petter Selasky <hps@selasky.org>, Bruce Evans <brde@optusnet.com.au>, "Conrad E. Meyer" <cem@freebsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r290613 - head/sys/compat/linuxkpi/common/include/linux
Message-ID:  <1447168083.91061.2.camel@freebsd.org>
In-Reply-To: <5641A056.2040805@selasky.org>
References:  <201511091650.tA9Gog7d061645@repo.freebsd.org> <20151110080516.M4088@besplex.bde.org> <5641A056.2040805@selasky.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 2015-11-10 at 08:44 +0100, Hans Petter Selasky wrote:
> On 11/09/15 22:17, Bruce Evans wrote:
> > On Mon, 9 Nov 2015, Conrad E. Meyer wrote:
> > 
> > > Log:
> > >  linuxkpi/sysfs.h: Cast arg2 through intptr_t to avoid GCC
> > > warning
> > > 
> > >  The code compiles fine under Clang, but GCC on PPC is less
> > > permissive
> > > about
> > >  integer and pointer sizes.  (An intmax_t is clearly *large
> > > enough* to
> > > hold a
> > >  pointer value.)
> > > 
> > >  Another follow-up to r290475.
> > 
> > This shouldn't compile either.
> > 
> 
> Hi Conrad,
> 
> 
> >  static int
> > -sysctl_root_handler_locked(struct sysctl_oid *oid, void *arg1,
> > intptr_t arg2,
> > +sysctl_root_handler_locked(struct sysctl_oid *oid, void *arg1,
> > intmax_t arg2,
> >      struct sysctl_req *req, struct rm_priotracker *tracker)
> 
> Given that the second argument is sometimes used for pointers, maybe
> we 
> should keep it intptr_t. Or add a compile time assert that 
> sizeof(intmax) >= sizeof(intptr_t) which I think doesn't hold?
> 
> --HPS
> 

If intmax_t is the "maximum width integer type" and intptr_t is
"integer type capable of holding a pointer", I think by definition
sizeof(intmax_t) must be >= sizeof(intptr_t).  On the other hand, given
the perverse way standards-writers think, I'm not sure "big enough" is
all it takes to qualify as "capable of holding a pointer".  But I think
in reality it'll work out right anyway.

-- Ian




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1447168083.91061.2.camel>