Re: Fix pg_dump dependency on postgres.h

From: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Bruce Momjian <bruce(at)momjian(dot)us>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Fix pg_dump dependency on postgres.h
Date: 2007-11-22 15:59:09
Message-ID: 4745A74D.6040504@sun.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane napsal(a):

> (a) it wasn't "to build at all", it was to allow "inline" to be enabled
> on Sun Studio's compiler, which apparently is too dumb to not generate
> copies of an unreferenced inline function.

I don't think that you have right. inline is just optimizer hint and Sun Studio
performs inline optimization from level 3 (-xO3). In lower level it generates
it as local function. And on other side GCC (3.4.3) performs inconsistent
optimization on -O0 level which is by my opinion also for discussion see
following case:

---------------------------------
#include <stdio.h>

static inline int test_1(int a)
{
return a*a;
}

static inline int test_2(int p)
{
return p*p;
}

static int test_3(int p)
{
return p*p;
}

int main()
{

int a = 3;
printf("%i\n", test_1(a));
return 0;
}

bash-3.2$ nm ./a.out | grep test
[58] | 134548680| 15|FUNC |LOCL |0 |13 |test_1
[57] | 134548592| 15|FUNC |LOCL |0 |13 |test_3

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

Why test_3 is not removed as unused function, but test_2 is? By my opinion it is
inconsistent. GCC removes test_3 on -O2 level. And why -fkeep-inline-functions
does not work? It seems to me that somebody modify gcc to fix similar problems
as postgreSQL has in the source code.

Zdenek

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-11-22 16:00:32 Re: 8.3devel slower than 8.2 under read-only load
Previous Message Tom Lane 2007-11-22 15:39:44 Re: Postgres 8.3 archive_command

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2007-11-22 16:24:37 Re: plpython crash on exception
Previous Message Gregory Stark 2007-11-22 14:46:21 Ordered Append WIP patch v1