This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: 3.0.1 PATCH: Support JNI_OnLoad on systems without weak definitions
Rainer Orth writes:
> Andrew Haley writes:
>
> > > > I couldn't find any docs on `#pragma weak foo = bar'.
> > >
> > > It's the #pragma weak equivalent of
> > >
> > > void foo () __attribute__ ((weak, alias ("bar"));
> >
> > If there's an equivalent attribute, why use a pragma? Pragmas are
> > depracated in gnu code.
>
> Primarily to make the patch as unintrusive as possible: the code used
>
> #pragma weak foo
>
> before, and it's probably very safe to assume that every platform that
> supports this also supports #pragma weak foo = bar. #pragma weak is used
> in several places in GCC,
So it is. However, the #pragma weak syntax was introduced for System
5 compatibility rather than as a pererred alternative to attributes.
> and the deprecation doesn't really hold anymore,
> with the introduction of #pragma GCC.
I don't understand what you mean by this. The explanation in the gcc
docs says this:
"However, it has been found convenient to use `__attribute__' to
achieve a natural attachment of attributes to their corresponding
declarations, whereas `#pragma GCC' is of use for constructs that do
not naturally form part of the grammar."
In this case, a weak function declaration very much is a natural part
of the grammar.
Andrew.