pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew@dunslane.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Bruce Momjian <bruce@momjian.us>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: pgindent weirdness
Date: Wed, 20 Apr 2011 12:38:57 -0400
Message-ID: <4DAF0C21.2070505@dunslane.net> (raw)
In-Reply-To: <28426.1303316942@sss.pgh.pa.us>
References: <201104200948.p3K9mY501163@momjian.us>
	<4DAEF8AB.5030103@dunslane.net>
	<27646.1303314228@sss.pgh.pa.us>
	<4DAF086F.6050305@dunslane.net>
	<28426.1303316942@sss.pgh.pa.us>



On 04/20/2011 12:29 PM, Tom Lane wrote:
> Andrew Dunstan<andrew@dunslane.net>  writes:
>> But in any case, *none* of the individual files knows about
>> BulkInsertStateData as a typedef:
>> ...
>> And the reason is actually fairly obvious on closer inspection. The only
>> place we actually use the BulkInsertStateData typedef (as opposed to the
>> struct declaration) is here:
>>      ./backend/access/heap/heapam.c:    bistate = (BulkInsertState)
>>      palloc(sizeof(BulkInsertStateData));
>> and that sizeof operation will be resolved at compile time and never hit
>> the symbol table.
> Oh, interesting.  So you're saying that for this mechanism to know that
> "foo" is a typedef, there has to be at least one variable in the code
> that's declared as being of type foo or foo *?  (Where "variable" would
> include function parameters, fields of other structs, etc.)

I believe so. I don't see how it could get tagged in the tables otherwise.

> That's probably fine, because otherwise we'd have the typedef list
> cluttered with junk we don't care about from system headers.


Well, yes, except that I'm a tiny bit smarter than that :-) After we 
generate the list of symbols we check that they actually occur in our 
sources and filter them out if they don't. That reduces the list by 
quite a lot.

> So in the case at hand, we actually *need* to remove the "struct" from
> RelationGetBufferForTuple's declaration, so that BulkInsertStateData
> gets used as a typedef name in that way.
>
> 			

That sounds right.

cheers

andrew




view thread (51+ messages)  latest in thread

Message-ID: <4DAF0C21.2070505@dunslane.net>
Permalink:  ../4DAF0C21.2070505@dunslane.net/
Also on:    postgresql.org/message-id/4DAF0C21.2070505@dunslane.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: andrew@dunslane.net, tgl@sss.pgh.pa.us, bruce@momjian.us, robertmhaas@gmail.com
  Subject: Re: pgindent weirdness
  In-Reply-To: <4DAF0C21.2070505@dunslane.net>
  References: <201104200948.p3K9mY501163@momjian.us> <4DAEF8AB.5030103@dunslane.net> <27646.1303314228@sss.pgh.pa.us> <4DAF086F.6050305@dunslane.net> <28426.1303316942@sss.pgh.pa.us> <4DAF0C21.2070505@dunslane.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox