libc_hidden_proto vs __attribute__

Ulrich Drepper drepper@redhat.com
Sat Aug 3 20:51:00 GMT 2002


Roland McGrath wrote:
> AFAICT, libc_hidden_proto causes the symbol to lose its special attributes,
> e.g. if it had __attribute__((noreturn)).  For noreturn this meanings
> spurious warnings in libc code, but for const it could hurt optimization
> and for any weirder ones (regparm!) it could really be a problem.

I cannot reproduce this for const or regparm.  These are the two I tried.

extern int foo (int) __attribute ((regparm (1), const));
//extern int bar (int) __attribute ((regparm (1), const));
__typeof (foo) __foo;
__typeof (foo) foo __asm ("__foo") __attribute ((visibility ("hidden")));
int
foo (int a)
{
   return a;
}
int
bar (int a)
{
   return a;
}
int
xyzzy (int a)
{
   return foo (a) == 1 || foo (a) == 2;
}
int
xyzzy2 (int a)
{
   return bar (a) == 1 || bar (a) == 2;
}


-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------



More information about the Libc-hacker mailing list