PR 34985: Warning "defined but not used" despite __attribute__((__used__))
Richard Guenther
richard.guenther@gmail.com
Sun Feb 3 11:23:00 GMT 2008
On Feb 2, 2008 8:11 PM, Manuel López-Ibáñez <lopezibanez@gmail.com> wrote:
> On 02/02/2008, Richard Guenther <richard.guenther@gmail.com> wrote:
> > This looks weird. Did you check if we have a testcase that breaks if you just
> > remove that bit?
> >
>
> That line and the comment were added by RMS back in rev 276, so it is
> likely that there are out-dated.
Heh ;)
> However, the two new testcases and a previous testcase fail:
>
> gcc.dg/pr34985.c (test for excess errors)
> gcc.dg/special/20000419-2.c (test for excess errors)
> g++.dg/warn/pr34985.C (test for excess errors)
>
> For the new testcases it makes sense because it seems we create two
> different FUNCTION_DECL trees for the same function, one for the
> declaration and another for the definition. Only one of them gets
> marked by attribute((used)).
They probably do not get merged because the attribute lists differ.
I belive we have code somewhere dealing with merging attributes
to not create two FUNCTION_DECLs - the right fix is probably there.
> The other testcase is about attribute((alias("something"))). In
> c-common.c (handle_alias_attribute), they identifier passed as
> argument is marked as used.
Ok, that's probably the real reason that this code has to stay. Still
try to figure out why we create two FUNCTION_DECLs for the
new testcases, this seems wrong.
Thanks,
Richard.
>
> Cheers,
>
> Manuel.
>
More information about the Gcc-patches
mailing list