Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 34CAE1337B54 for ; Wed, 20 Apr 2011 13:23:23 -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 45149-10 for ; Wed, 20 Apr 2011 16:23:13 +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.123]) by mail.postgresql.org (Postfix) with ESMTP id DB2681337BB7 for ; Wed, 20 Apr 2011 13:23:12 -0300 (ADT) X-Authority-Analysis: v=1.1 cv=iNGAwgbhgycWJLi8POkSIlT3dR7ZbIoImwFDelgsXY0= c=1 sm=0 a=lpDWfFNTT9MA:10 a=Acs96HtBqXsA:10 a=8nJEP1OIZ-IA:10 a=qCTYjJJ2g1SgQhsHZAUATw==:17 a=KemSYLhRAAAA:8 a=pKG4y1c0m8w8T_HphncA:9 a=7Zwfw_-nv09rgxSFRrEA: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:42481] helo=[192.168.10.146]) by cdptpa-oedge02.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id F8/1A-16352-0780FAD4; Wed, 20 Apr 2011 16:23:12 +0000 Message-ID: <4DAF086F.6050305@dunslane.net> Date: Wed, 20 Apr 2011 12:23:11 -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> In-Reply-To: <27646.1303314228@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/1047 X-Sequence-Number: 186249 On 04/20/2011 11:43 AM, Tom Lane wrote: > Andrew Dunstan writes: >> On 04/20/2011 05:48 AM, Bruce Momjian wrote: >>> BulkInsertStateData is not listed in the typedef list supplied by >>> Andrew; see src/tools/pgindent/typedefs.list. CC'ing him. This might >>> be because the typdef is listed in two files: >> It's tagged as a structure type by objdump, but not as a typedef: > Hmm. hio.h clearly declares it as both, but many object files probably > include only heapam.h, which exposes only the struct name. I'm guessing > that you are merging the results from objdump'ing different files in a > way that fails to consider the possibility of some files knowing more > versions of a symbol than others. We don't run objdump against individual object files, we run it against the linked binaries, i.e. the contents of the installed bin and lib directories. But in any case, *none* of the individual files knows about BulkInsertStateData as a typedef: [andrew@emma backend]$ for f in ./access/heap/hio.o ./access/heap/heapam.o ./commands/tablecmds.o ./commands/copy.o ./executor/execMain.o ; do objdump -W $f ; done | egrep -A3 DW_TAG_typedef | grep BulkInsertState <1811> DW_AT_name : (indirect string, offset: 0x1cc9): BulkInsertState <1f3c> DW_AT_name : (indirect string, offset: 0x296c): BulkInsertState <1fac> DW_AT_name : (indirect string, offset: 0x5c5b): BulkInsertState <211b> DW_AT_name : (indirect string, offset: 0x35ad): BulkInsertState <2530> DW_AT_name : (indirect string, offset: 0x3c93): BulkInsertState 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. So I suspect that the typedef finding code is actually working just fine. It looks like the real problem is in how pgindent handles the use of 'struct foo' in various places. cheers andrew