[PATCHv2] build: find FILE_OFFSET_BITS via array
Andrew Bartlett
abartlet at samba.org
Tue Feb 11 11:11:24 MST 2014
On Sat, 2014-02-08 at 06:57 +1300, Andrew Bartlett wrote:
> On Fri, 2014-01-31 at 06:53 -0300, Gustavo Zacarias wrote:
> > This makes cross-compiling happy, use a trick similar to autoconf's
> > AC_CHECK_SIZEOF macro.
> > Basically we make an array:
> >
> > static int array[1 - 2 * !(((long int)(sizeof(off_t))) < 8)];
> >
> > This gives -1 multiplied by the negation of the condition
> > (sizeof(off_t) < 8) cast to a long int.
> > So if the condition is true it gives array[(-1 * 0)] (remember the
> > condition is cast and negated) thus passing a build test with a 0-sized
> > array.
> > If it's false it gives array[(-1 * 1)] thus failing with a
> > negative-sized array.
> >
> > Signed-off-by: Gustavo Zacarias <gustavo at zacarias.com.ar>
>
> Reviewed-by: Andrew Bartlett <abartlet at samba.org>
>
> David,
>
> Can you give me the second team review on this?
>
> Thanks,
Jeremy,
Can you review this for me? While certainly weird, it looks pretty safe
and useful.
Thanks,
Andrew Bartlett
--
Andrew Bartlett http://samba.org/~abartlet/
Authentication Developer, Samba Team http://samba.org
Samba Developer, Catalyst IT http://catalyst.net.nz/services/samba
More information about the samba-technical
mailing list