ccan code breaks older build farm systems
Rusty Russell
rusty at samba.org
Tue Jul 5 23:24:09 MDT 2011
On Tue, 5 Jul 2011 13:28:39 +0200, Michael Adam <obnox at samba.org> wrote:
> Rusty Russell wrote:
> > On Mon, 4 Jul 2011 22:44:38 +0200, Michael Adam <obnox at samba.org> wrote:
> > > the recent addition of the ccan code has broken several builds
> > > on the build farm:
> >
> > Thanks for this report. Looks like I screwed up the configure tests :(
> >
> > > There are configure checks but they don't seem to work:
> > >
> > > ...
> > > configure:6867: checking whether we have __builtin_clzl
> > > configure:6879: ccache gcc -c -Wall conftest.c >&5
> > > conftest.c: In function `main':
> > > conftest.c:50: warning: implicit declaration of function `__builtin_clzl'
> > > configure:6879: $? = 0
> > > configure:6885: result: yes
> >
> > How annoying... OK, I think I need AC_LINK_IFELSE rather than
> > AC_COMPILE_IFELSE. I'll test that now.
>
> This has fixed the build on that host - thanks!
>
>
> There is another error:
>
> http://build.samba.org/build.cgi/build/31c1b786335db8c4d8283717a92c118cc01ebdc2
>
> SIZE_MAX not declared.
Thanks!
I never knew SIZE_MAX wasn't portable. And it's not in replace.h
either... Getting rid of it makes code neater anyway.
Pushed to autobuild now.
Rusty.
commit 727ce5b9c3888f5603b3fc95a641a1e15cc1b95b
Author: Rusty Russell <rusty at rustcorp.com.au>
Date: Wed Jul 6 14:47:44 2011 +0930
ccan/tally: don't use SIZE_MAX.
Michael Adam points out this broke the build farm (ie. OSF1 axp V5.1 2650 alpha)
so fixed in CCAN and imported from af7a902d74a7926693f55da9e21a67dde46931d4:
Turns out it's not standard (thanks Samba build farm!)
And the previous test had a hole in it anyway. This one is more conservative.
Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>
diff --git a/lib/ccan/tally/tally.c b/lib/ccan/tally/tally.c
index b1839be..396474b 100644
--- a/lib/ccan/tally/tally.c
+++ b/lib/ccan/tally/tally.c
@@ -27,8 +27,8 @@ struct tally *tally_new(unsigned buckets)
if (buckets == 0)
buckets = 1;
- /* Check for overflow. */
- if (buckets && SIZE_MAX / buckets < sizeof(tally->counts[0]))
+ /* Overly cautious check for overflow. */
+ if (sizeof(*tally) * buckets / sizeof(*tally) != buckets)
return NULL;
tally = malloc(sizeof(*tally) + sizeof(tally->counts[0])*(buckets-1));
if (tally) {
More information about the samba-technical
mailing list