On Mon, Jan 16, 2012 at 09:35:08AM +0100, Richard Guenther wrote:
> But that's of course intended.  Attributes or redirection on the
> extern inline variant are completely meaningless.
> 
> > If you want to keep olddecl as is, then IMHO we should add a new bool
> > argument to merge_decls and if the flag is set, make sure we only ever
> > modify newdecl and not olddecl.
> 
> I don't think that is necesary nor warranted.  What legitimate use
> would break you think?

The extern inline decl gets also all the previous decl attributes
accumulated.  Asm redirection on the extern inline is meaningless.
Consider:
/* foo.h */
extern int foo (int, int) __attribute__((regparm (2))) __asm ("bar");
...
/* foo-inlines.h */
extern inline __attribute__((gnu_inline, always_inline)) void
foo (int x, int y)
{
  return something (x, y);
}
...
/* foo.c */
int
foo (int x, int y)
{
  return something (x, y);
}

You really want to have __asm ("bar") on the foo out-of-line definition,
wouldn't surprise me if this broke glibc or other packages that heavily
use asm redirection (in glibc e.g. LFS).  And the regparm attribute
is needed too.  The gnu_inline attribute isn't needed, but can be safely
copied over and ignored, the always_inline attribute and maybe artificial
attributes are the only ones that should be not copied over to the
out-of-line definition.

        Jakub

Reply via email to