tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: GNU inline functions



In article <1269705788.250341.7366.nullmailer%galant.ukfsn.org@localhost>,
Iain Hibbert  <plunky%rya-online.net@localhost> wrote:
>Hi,
>
>gcc has some non standard interpretations of inline function declarations,
>there is a fairly good summary of the problems at
>
>  http://www.greenend.org.uk/rjk/2003/03/inline.html
>
>but basically, the C99 standard
>
>  http://www.open-std.org/JTC1/SC22/wg14/www/docs/n1124.pdf
>
>says that declaring an "extern" inline function causes an externally
>callable symbol to be defined, whereas traditional gcc (prior to 4.3 or
>using the std=gnu99) does not, as per the following
>
>% cat i.c
>inline void foo (void)
>{
>}
>
>extern inline void bar (void)
>{
>}
>
>static inline void baz (void)
>{
>}
>
>int
>main(int ac, char *av[])
>{
>        foo();
>        bar();
>        baz();
>
>        return 0;
>}
>% pcc -c i.c && nm i.o
>00000000 T bar
>0000002c t baz
>         U foo
>00000008 T main
>% gcc -c i.c && nm i.o
>         U bar
>00000033 t baz
>00000000 T foo
>00000005 T main
>
>This affects pcc which now has some gcc compatibility built in but follows
>the C99 standard wrt inline functions, causing programs using sigsetops(3)
>in multiple source files to fail link because of multiply defined symbols.
>The patch below allows such programs (eg usr.bin/ftp) to build properly
>with gcc 4.1.3 (in-tree) and pcc (-current) and should continue to work
>with gcc 4.3 and beyond
>
>any objections to committing that?
>
>iain

go for it.

christos



Home | Main Index | Thread Index | Old Index