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:23:11 -0400
Message-ID: <4DAF086F.6050305@dunslane.net> (raw)
In-Reply-To: <27646.1303314228@sss.pgh.pa.us>
References: <201104200948.p3K9mY501163@momjian.us>
	<4DAEF8AB.5030103@dunslane.net>
	<27646.1303314228@sss.pgh.pa.us>



On 04/20/2011 11:43 AM, Tom Lane wrote:
> Andrew Dunstan<andrew@dunslane.net>  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




view thread (51+ messages)  latest in thread

Message-ID: <4DAF086F.6050305@dunslane.net>
Permalink:  ../4DAF086F.6050305@dunslane.net/
Also on:    postgresql.org/message-id/4DAF086F.6050305@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: <4DAF086F.6050305@dunslane.net>
  References: <201104200948.p3K9mY501163@momjian.us> <4DAEF8AB.5030103@dunslane.net> <27646.1303314228@sss.pgh.pa.us> <4DAF086F.6050305@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