This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: PR7455: What is expected behavior for #pragma weak.
- From: Ian Lance Taylor <ian at wasabisystems dot com>
- To: Steven Bosscher <s dot bosscher at student dot tudelft dot nl>
- Cc: gcc at gcc dot gnu dot org
- Date: 11 Jan 2004 19:39:13 -0500
- Subject: Re: PR7455: What is expected behavior for #pragma weak.
- References: <200401112326.18067.s.bosscher@student.tudelft.nl>
Steven Bosscher <s.bosscher@student.tudelft.nl> writes:
> #pragma weak bar = foo
Hmmm. The SUN documentation here:
http://docs.sun.com/db/doc/805-4955/6j4mg806k?a=view
says that the function must be declared before it is used in #pragma
weak. Since #pragma weak exists for compatibility purposes--the gcc
way to handle it is attributes--it is probably fine that gcc requires
a declaration here, since that is compatible.
> extern int bar (void) __attribute__ ((weak));
This is different, since it does not declare bar to be an alias. In
this case there is no need to actually say anything about bar if it is
not declared and if nothing references it.
Note that
extern int bar (void) __attribute__ ((weak, alias ("foo")));
should emit bar as a weak alias for foo--and, in the current sources,
it does.
Ian