Re: Fix pg_dump dependency on postgres.h
| От | Zdenek Kotala |
|---|---|
| Тема | Re: Fix pg_dump dependency on postgres.h |
| Дата | |
| Msg-id | 4745A74D.6040504@sun.com обсуждение исходный текст |
| Ответ на | Re: Fix pg_dump dependency on postgres.h (Tom Lane <tgl@sss.pgh.pa.us>) |
| Список | 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
В списке pgsql-patches по дате отправления: