Re: Gist does not build with VC++ anymore

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Magnus Hagander <mha(at)sollentuna(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org, Hiroshi Saito <z-saito(at)guitar(dot)ocn(dot)ne(dot)jp>
Subject: Re: Gist does not build with VC++ anymore
Date: 2006-06-25 01:03:09
Message-ID: 200606250103.k5P139p17054@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Patch applied. It seems offsetof() can only find structure members in
MSVC, not the offset of array elements in structures. Anyway,
offsetof() was finding the first element, so the "[0]" is not needed.

---------------------------------------------------------------------------

Magnus Hagander wrote:
> > > I've updated my VC++ build env with latest CVS, and it no longer
> > > builds because of changes to GIST:
> > >
> > > src\backend\access\gist\gistutil.c(237) : error C2057:
> > > expected constant expression
> > > src\backend\access\gist\gistutil.c(237) : error C2466:
> > cannot allocate
> > > an array of constant size 0
> > > src\backend\access\gist\gistutil.c(237) : error C2133: 'storage' :
> > > unknown size
> > >
> > >
> > > The problem appears to come from:
> > > #define GEVHDRSZ (offsetof(GistEntryVector, vector[0]))
> > >
> > > Which can't be used in this context.
> > >
> > > What would be the proper fix for that?
> >
> > Hmm. Now that I look at it more clearly, it seems Hiroshi has
> > a fix for this in his submitted patch (that still had a lot
> > of other problems in the rest of it). I'm not sure if it's
> > the proper fix, but it's there.
>
> While I'm spamming everybody anyway, here's another thing that might fix
> it? This one compiles and tests, and I *think* it does the right
> thing... If it's correct, I think it looks like a cleaner solution.
>
> //Magnus
>
>
> RCS file: /projects/cvsroot/pgsql/src/include/access/gist.h,v
> retrieving revision 1.52
> diff -c -r1.52 gist.h
> *** src/include/access/gist.h 5 Mar 2006 15:58:53 -0000 1.52
> --- src/include/access/gist.h 24 Jun 2006 17:20:28 -0000
> ***************
> *** 142,148 ****
> GISTENTRY vector[1];
> } GistEntryVector;
>
> ! #define GEVHDRSZ (offsetof(GistEntryVector, vector[0]))
>
> /*
> * macro to initialize a GISTENTRY
> --- 142,148 ----
> GISTENTRY vector[1];
> } GistEntryVector;
>
> ! #define GEVHDRSZ (offsetof(GistEntryVector, vector))
>
> /*
> * macro to initialize a GISTENTRY
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
>

--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2006-06-25 01:45:45 Re: [CORE] GPL Source and Copyright Questions
Previous Message Bruce Momjian 2006-06-24 23:36:05 Re: vacuum, performance, and MVCC