Re: [C++ PATCH] Fix -Wunused-function (PR debug/66869)

2016-02-03 Thread Jason Merrill
On 01/29/2016 01:30 PM, Jakub Jelinek wrote: On Fri, Jan 29, 2016 at 11:35:07AM +0100, Jakub Jelinek wrote: I can try to stick there an assert whether for FUNCTION_DECL (DECL_INITIAL (decl) == 0) == DECL_EXTERNAL (decl). Tried that, but cancelled that quickly, I see lots of cases where DECL_IN

Re: [C++ PATCH] Fix -Wunused-function (PR debug/66869)

2016-01-29 Thread Jakub Jelinek
On Fri, Jan 29, 2016 at 11:35:07AM +0100, Jakub Jelinek wrote: > I can try to stick there an assert whether for FUNCTION_DECL > (DECL_INITIAL (decl) == 0) == DECL_EXTERNAL (decl). Tried that, but cancelled that quickly, I see lots of cases where DECL_INITIAL is non-NULL, but DECL_EXTERNAL is set,

Re: [C++ PATCH] Fix -Wunused-function (PR debug/66869)

2016-01-29 Thread Jason Merrill
On 01/29/2016 11:35 AM, Jakub Jelinek wrote: 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

Re: [C++ PATCH] Fix -Wunused-function (PR debug/66869)

2016-01-29 Thread Jakub Jelinek
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

Re: [C++ PATCH] Fix -Wunused-function (PR debug/66869)

2016-01-29 Thread Jason Merrill
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

[C++ PATCH] Fix -Wunused-function (PR debug/66869)

2016-01-28 Thread Jakub Jelinek
On Wed, Jan 27, 2016 at 12:28:58PM -0700, Jeff Law wrote: > On 01/27/2016 11:51 AM, Jakub Jelinek wrote: > >2016-01-25 Jakub Jelinek > > > > PR debug/66869 > > * c-decl.c (c_write_global_declarations_1): Warn with > > warn_unused_function if static prototype without definition > >

Re: [C PATCH] Fix -Wunused-function (PR debug/66869)

2016-01-27 Thread Jeff Law
On 01/27/2016 11:51 AM, Jakub Jelinek wrote: Hi! On Wed, Jan 27, 2016 at 11:17:18AM +0100, Richard Biener wrote: No, simply warn and set TREE_NO_WARNING so cgraph doesn't warn again. This seems to work too, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2016-01-25 Jaku

Re: [C PATCH] Fix -Wunused-function (PR debug/66869)

2016-01-27 Thread Jakub Jelinek
Hi! On Wed, Jan 27, 2016 at 11:17:18AM +0100, Richard Biener wrote: > No, simply warn and set TREE_NO_WARNING so cgraph doesn't warn again. This seems to work too, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2016-01-25 Jakub Jelinek PR debug/66869 * c

Re: [C PATCH] Fix -Wunused-function (PR debug/66869)

2016-01-27 Thread Richard Biener
On Tue, Jan 26, 2016 at 5:18 PM, Jakub Jelinek wrote: > On Tue, Jan 26, 2016 at 04:21:08PM +0100, Richard Biener wrote: >> > --- gcc/c/c-decl.c.jj 2016-01-21 00:41:47.0 +0100 >> > +++ gcc/c/c-decl.c 2016-01-25 16:36:31.973504082 +0100 >> > @@ -10741,11 +10741,19 @@ c_write_global_de

Re: [C PATCH] Fix -Wunused-function (PR debug/66869)

2016-01-26 Thread Jakub Jelinek
On Tue, Jan 26, 2016 at 04:21:08PM +0100, Richard Biener wrote: > > --- gcc/c/c-decl.c.jj 2016-01-21 00:41:47.0 +0100 > > +++ gcc/c/c-decl.c 2016-01-25 16:36:31.973504082 +0100 > > @@ -10741,11 +10741,19 @@ c_write_global_declarations_1 (tree glob > >if (TREE_CODE (decl) == F

Re: [C PATCH] Fix -Wunused-function (PR debug/66869)

2016-01-26 Thread Richard Biener
On Mon, Jan 25, 2016 at 9:38 PM, Jakub Jelinek wrote: > Hi! > > The early-debug changes moved warnings about unused functions into cgraph. > The problem is that if we have just unused declarations, they aren't > sometimes even registered with cgraph and therefore we no longer warn. > > Here is an

[C PATCH] Fix -Wunused-function (PR debug/66869)

2016-01-25 Thread Jakub Jelinek
Hi! The early-debug changes moved warnings about unused functions into cgraph. The problem is that if we have just unused declarations, they aren't sometimes even registered with cgraph and therefore we no longer warn. Here is an attempt to register those with cgraph anyway to get the warning, fo