forte12 (and forte11) chokes on wrong protype for inline function
static inline const unsigned char *tree_entry_extract(struct tree_desc *desc, const char **pathp, unsigned int *modep)
{
*pathp = desc->entry.path;
*modep = canon_mode(desc->entry.mode);
return desc->entry.sha1;
}
const unsigned char *tree_entry_extract(struct tree_desc *, const char **, unsigned int *);
lets forte12 and forte11 choke with the following error:
LINK git-convert-objects
ld: fatal: symbol `tree_entry_extract' is multiply-defined:
(file libgit.a(sha1_name.o) type=FUNC; file libgit.a(tree.o) type=FUNC);
ld: fatal: symbol `tree_entry_extract' is multiply-defined:
(file libgit.a(sha1_name.o) type=FUNC; file libgit.a(tree-walk.o) type=FUNC);
ld: fatal: File processing errors. No output written to git-convert-objects
gmake[1]: *** [git-convert-objects] Error 1
there are two fixes: remove the prototype or add -features=no%extinl to CFLAGS
[965 byte] By [
Glanzmanna] at [2007-11-27 4:12:35]

# 5
It seems to be a question to C99 standard. As I understand, the second declaration of tree_entry_extract function (prototype) must not change the linkage of tree_entry_extract because the prior declaration specifies internal linkage (static specifier). Consider the following testcase:
$ cat test.c
static void foo(void)
{
}
void foo(void);
void boo()
{
foo();
}
Here foo should be a local symbol, what we have:
$ suncc -c test.c
$ nm test.o | grep foo
0000000000000000 t foo
But with inline specifier foo becomes global (not sure it is correct behavior) and if foo is defined in several modules, linker will complain about multiple-definitions:
$ cat test2.c
static inline void foo(void)
{
}
void foo(void);
void boo()
{
foo();
}
$ suncc -c test2.c
$ nm test2.o |grep foo
0000000000000000 T foo
gcc compiler leaves foo local:
$ gcc -c test2.c
$ nm test2.o |grep foo
000000000000000b t foo
Please file a bug at http://bugs.sun.com
Product/Category is 揅 compiler?
Dmitry