Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 4C6001337BC8 for ; Wed, 20 Apr 2011 13:39:06 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 59980-01 for ; Wed, 20 Apr 2011 16:38:58 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from cdptpa-omtalb.mail.rr.com (cdptpa-omtalb.mail.rr.com [75.180.132.122]) by mail.postgresql.org (Postfix) with ESMTP id 480911337B68 for ; Wed, 20 Apr 2011 13:38:58 -0300 (ADT) X-Authority-Analysis: v=1.1 cv=2pE2Kh9Ye2ywHyyFZnC5ZQ1FvuPrdOtuPO5uN4ysVDU= c=1 sm=0 a=lpDWfFNTT9MA:10 a=Acs96HtBqXsA:10 a=8nJEP1OIZ-IA:10 a=qCTYjJJ2g1SgQhsHZAUATw==:17 a=KemSYLhRAAAA:8 a=NHMuOZOKbUEYrhn2GqYA:9 a=5G1Qh4-0GlNLj8jrj64A:7 a=wPNLvfGTeEIA:10 a=IvWp0zEv-XEA:10 a=qCTYjJJ2g1SgQhsHZAUATw==:117 X-Cloudmark-Score: 0 X-Originating-IP: 98.27.48.207 Received: from [98.27.48.207] ([98.27.48.207:42917] helo=[192.168.10.146]) by cdptpa-oedge03.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id CB/93-05159-12C0FAD4; Wed, 20 Apr 2011 16:38:57 +0000 Message-ID: <4DAF0C21.2070505@dunslane.net> Date: Wed, 20 Apr 2011 12:38:57 -0400 From: Andrew Dunstan User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Lightning/1.0b3pre Thunderbird/3.1.9 MIME-Version: 1.0 To: Tom Lane CC: Bruce Momjian , Robert Haas , pgsql-hackers@postgresql.org Subject: Re: pgindent weirdness 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> In-Reply-To: <28426.1303316942@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201104/1050 X-Sequence-Number: 186252 On 04/20/2011 12:29 PM, Tom Lane wrote: > Andrew Dunstan 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