Re: [gnet-dev] amd64 fixes



On Sun, 2005-09-18 at 19:02 +0100, Tim M�wrote:
> On Mon, 2005-09-12 at 22:24 -0400, Daniel Gryniewicz wrote:
> 
> Hi Daniel,
>         
> > I'm an amd64 dev for Gentoo, and we had a bug submitted that gnet 2.0.7
> > didn't build with --enable-debug (which of course enables -Werror).  As
> > a result, I went through and fixed all the build errors with
> > --enable-debug, and here's the patch.  Most of these are changes of
> > guint to gsize, because gsize is a long, which is 64-bits on amd64.  
> 
> Thanks for the patch. I've committed most of it as is, with the
> exception of the last chunk (see below) and the conn-http part
> (G_GSIZE_FORMAT only exists since GLib 2.6 and it doesn't really seem
> sensible to bump the requirement just for that; casting to guint should
> work fine as well in practice).

This is, of course, up to you.  It's not an int on amd64, it's a long,
which is 64-bit, but I don't know what value you're storing there, so it
may fit into 32-bits in practice.  My only concern here is that it
compiles with -Werror, which means it has to be cast to the type that's
being printed.   Bumping the required glib version for that define may
be a bit extreme.

> > The only part I'm leary about is the hunk at the end.  It obviously deals
> > with other arches than Linux, so the define check might have to be
> > changed to accommodate other Unix variations.
> 
> -#ifndef socklen_t
> +#ifndef __socklen_t_defined
>  #  ifdef GNET_APPLE_DARWIN
>  #    define socklen_t int      /* socklen_t is int in Darwin */
>  #  else
> 
> in src/gnet-private.h doesn't really look right to me.
> __socklen_t_defined is a private define, isn't it? I don't think we
> should be using that. Why is that necessary in the first place, and why
> does linux/amd64 differ here from linux/other-arches?

On all my linux systems, both amd64 and x86, that type (socklen_t) is
protected by __socklen_t_defined, not by socklen_t, and they're
typedefs, not defines, so that ifndef will always succeed, so a
redefinition error will occur on both amd64 and x86, with the result
that -Werror will fail.  Maybe it changes based on glibc version?  Here,
I have 2.3.5 on both x86 and amd64.   Maybe a good assumption is that
socklen_t is always defined on Linux?

Daniel




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]