This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] Fix -Wunused-function (PR debug/66869)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>, Marek Polacek <polacek at redhat dot com>, Jan Hubicka <hubicka at ucw dot cz>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 29 Jan 2016 11:35:07 +0100
- Subject: Re: [C++ PATCH] Fix -Wunused-function (PR debug/66869)
- Authentication-results: sourceware.org; auth=none
- References: <20160125203829 dot GP3017 at tucnak dot redhat dot com> <CAFiYyc12VJd=HcmH6YsnwVWinfzBnMzq-WyujU85eg05LCUReg at mail dot gmail dot com> <20160126161813 dot GB3017 at tucnak dot redhat dot com> <CAFiYyc1Kn++hPBBXw1NcjROxpTJbBdPy4Eu=ZXfMmPkhQ8H0=A at mail dot gmail dot com> <20160127185159 dot GT3017 at tucnak dot redhat dot com> <56A91A7A dot 3060700 at redhat dot com> <20160128201506 dot GG3017 at tucnak dot redhat dot com> <56AAD3B6 dot 2060804 at redhat dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Jan 28, 2016 at 09:51:34PM -0500, Jason Merrill wrote:
> On 01/28/2016 03:15 PM, Jakub Jelinek wrote:
> >+ if (TREE_CODE (decl) == FUNCTION_DECL
> >+ && DECL_INITIAL (decl) == 0
> >+ && DECL_EXTERNAL (decl)
> >+ && !TREE_PUBLIC (decl)
> >+ && !DECL_ARTIFICIAL (decl)
> >+ && !TREE_NO_WARNING (decl))
>
> Do we need to check both DECL_INITIAL and DECL_EXTERNAL?
Dunno, but that is what cgraphunit.c does, c-decl.c too,
what the old toplev.c (check_global_declaration_1) did (back to at least
r26593 from ~ 1999), so I think we want some consistency.
Either it is needed, or if it is not needed, then all the spots should
change, not just this one.
I can try to stick there an assert whether for FUNCTION_DECL
(DECL_INITIAL (decl) == 0) == DECL_EXTERNAL (decl).
Jakub