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