This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libc_hidden_proto vs __attribute__


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   `------------------------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]