[PATCH 0/2] c++: Print function template parms when relevant (was: [PATCH v4] c++: Add gnu::diagnose_as attribute)

2021-11-26 Thread Matthias Kretz
On Friday, 19 November 2021 23:26:57 CET Jason Merrill wrote: > On 11/19/21 04:53, Matthias Kretz wrote: > > On Thursday, 18 November 2021 20:24:36 CET Jason Merrill wrote: > >> On 11/17/21 17:51, Matthias Kretz wrote: > > __FUNCTION__ was 'fun' all the time, but __PRETTY_FUNCTION__ was > >

Re: [RFC] c++: Print function template parms when relevant (was: [PATCH v4] c++: Add gnu::diagnose_as attribute)

2021-11-19 Thread Matthias Kretz
On Friday, 19 November 2021 23:26:57 CET Jason Merrill wrote: > On 11/19/21 04:53, Matthias Kretz wrote: > > My motivation for printing a function template specialization differently > > is: > > > > 1. It's a different function definition that's being called. The user > > (caller) might be surpris

Re: [RFC] c++: Print function template parms when relevant (was: [PATCH v4] c++: Add gnu::diagnose_as attribute)

2021-11-19 Thread Jason Merrill via Gcc-patches
On 11/19/21 04:53, Matthias Kretz wrote: On Thursday, 18 November 2021 20:24:36 CET Jason Merrill wrote: On 11/17/21 17:51, Matthias Kretz wrote: Right, I had already added a `gcc_assert (!TMPL_ARGS_HAVE_MULTIPLE_LEVELS (args))` to my new set_non_default_template_args_count function and found c

Re: [RFC] c++: Print function template parms when relevant (was: [PATCH v4] c++: Add gnu::diagnose_as attribute)

2021-11-19 Thread Matthias Kretz
On Friday, 19 November 2021 10:53:27 CET Matthias Kretz wrote: > > >> Ah, you're trying to omit defaulted parms from the ? I'm not > > >> sure > > >> that's necessary, leaving them out of the [with ...] list should be > > >> sufficient. > > > > > > I was thinking about all the std::allocator defau

Re: [RFC] c++: Print function template parms when relevant (was: [PATCH v4] c++: Add gnu::diagnose_as attribute)

2021-11-19 Thread Matthias Kretz
On Thursday, 18 November 2021 20:24:36 CET Jason Merrill wrote: > On 11/17/21 17:51, Matthias Kretz wrote: > > Right, I had already added a `gcc_assert (!TMPL_ARGS_HAVE_MULTIPLE_LEVELS > > (args))` to my new set_non_default_template_args_count function and found > > cp/ constraint.cc:2896 (get_mapp

Re: [RFC] c++: Print function template parms when relevant (was: [PATCH v4] c++: Add gnu::diagnose_as attribute)

2021-11-18 Thread Jason Merrill via Gcc-patches
On 11/17/21 17:51, Matthias Kretz wrote: On Wednesday, 17 November 2021 19:25:46 CET Jason Merrill wrote: On 11/17/21 04:04, Matthias Kretz wrote: On Wednesday, 17 November 2021 07:09:18 CET Jason Merrill wrote: - if (CHECKING_P) -SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT (a, TREE_VEC_LENGTH (a

Re: [RFC] c++: Print function template parms when relevant (was: [PATCH v4] c++: Add gnu::diagnose_as attribute)

2021-11-17 Thread Matthias Kretz
On Wednesday, 17 November 2021 19:25:46 CET Jason Merrill wrote: > On 11/17/21 04:04, Matthias Kretz wrote: > > On Wednesday, 17 November 2021 07:09:18 CET Jason Merrill wrote: > >>> - if (CHECKING_P) > >>> -SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT (a, TREE_VEC_LENGTH (a)); > >>> + SET_NON_DEFAULT

Re: [RFC] c++: Print function template parms when relevant (was: [PATCH v4] c++: Add gnu::diagnose_as attribute)

2021-11-17 Thread Jason Merrill via Gcc-patches
On 11/17/21 04:04, Matthias Kretz wrote: On Wednesday, 17 November 2021 07:09:18 CET Jason Merrill wrote: - if (CHECKING_P) -SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT (a, TREE_VEC_LENGTH (a)); + SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT (a, nondefault); should have been if (CHECKING_P || nondefault

Re: [RFC] c++: Print function template parms when relevant (was: [PATCH v4] c++: Add gnu::diagnose_as attribute)

2021-11-17 Thread Matthias Kretz
On Wednesday, 17 November 2021 07:09:18 CET Jason Merrill wrote: > > - if (CHECKING_P) > > -SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT (a, TREE_VEC_LENGTH (a)); > > + SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT (a, nondefault); > > should have been > > if (CHECKING_P || nondefault != TREE_VEC_LENGTH (a))

Re: [RFC] c++: Print function template parms when relevant (was: [PATCH v4] c++: Add gnu::diagnose_as attribute)

2021-11-16 Thread Jason Merrill via Gcc-patches
On 11/8/21 11:40, Matthias Kretz wrote: On Tuesday, 17 August 2021 20:31:54 CET Jason Merrill wrote: 2. Given a DECL_TI_ARGS tree, can I query whether an argument was deduced or explicitly specified? I'm asking because I still consider diagnostics of function templates unfortunate. `template vo

Re: [RFC] c++: Print function template parms when relevant (was: [PATCH v4] c++: Add gnu::diagnose_as attribute)

2021-11-16 Thread Matthias Kretz
On Tuesday, 16 November 2021 21:49:31 CET Jason Merrill wrote: > On 11/16/21 15:42, Matthias Kretz wrote: > > On Tuesday, 16 November 2021 21:25:33 CET Jason Merrill wrote: > >> On 11/8/21 15:00, Matthias Kretz wrote: > >>> I forgot to mention why I tagged it [RFC]: I needed one more bit of > >>> i

Re: [RFC] c++: Print function template parms when relevant (was: [PATCH v4] c++: Add gnu::diagnose_as attribute)

2021-11-16 Thread Jason Merrill via Gcc-patches
On 11/16/21 15:42, Matthias Kretz wrote: On Tuesday, 16 November 2021 21:25:33 CET Jason Merrill wrote: On 11/8/21 15:00, Matthias Kretz wrote: I forgot to mention why I tagged it [RFC]: I needed one more bit of information on the template args TREE_VEC to encode EXPLICIT_TEMPLATE_ARGS_P. Its T

Re: [RFC] c++: Print function template parms when relevant (was: [PATCH v4] c++: Add gnu::diagnose_as attribute)

2021-11-16 Thread Matthias Kretz
On Tuesday, 16 November 2021 21:25:33 CET Jason Merrill wrote: > On 11/8/21 15:00, Matthias Kretz wrote: > > I forgot to mention why I tagged it [RFC]: I needed one more bit of > > information on the template args TREE_VEC to encode > > EXPLICIT_TEMPLATE_ARGS_P. Its TREE_CHAIN already points to an

Re: [RFC] c++: Print function template parms when relevant (was: [PATCH v4] c++: Add gnu::diagnose_as attribute)

2021-11-16 Thread Jason Merrill via Gcc-patches
On 11/8/21 15:00, Matthias Kretz wrote: I forgot to mention why I tagged it [RFC]: I needed one more bit of information on the template args TREE_VEC to encode EXPLICIT_TEMPLATE_ARGS_P. Its TREE_CHAIN already points to an integer constant denoting the number of non-default arguments, so I couldn'

Re: [RFC] c++: Print function template parms when relevant (was: [PATCH v4] c++: Add gnu::diagnose_as attribute)

2021-11-08 Thread Matthias Kretz
I forgot to mention why I tagged it [RFC]: I needed one more bit of information on the template args TREE_VEC to encode EXPLICIT_TEMPLATE_ARGS_P. Its TREE_CHAIN already points to an integer constant denoting the number of non-default arguments, so I couldn't trivially replace that. Therefore, I

[RFC] c++: Print function template parms when relevant (was: [PATCH v4] c++: Add gnu::diagnose_as attribute)

2021-11-08 Thread Matthias Kretz
On Tuesday, 17 August 2021 20:31:54 CET Jason Merrill wrote: > > 2. Given a DECL_TI_ARGS tree, can I query whether an argument was deduced > > or explicitly specified? I'm asking because I still consider diagnostics > > of function templates unfortunate. `template void f()` is fine, > > as is `voi

Re: [PATCH v4] c++: Add gnu::diagnose_as attribute

2021-09-07 Thread Jason Merrill via Gcc-patches
On 7/23/21 4:58 AM, Matthias Kretz wrote: Hi Jason, I found a few regressions from the last patch in the meantime. Version 4 of the patch is attached. Questions: 1. I simplified the condition for calling dump_template_parms in dump_function_name. !DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (t)

Re: [PATCH v4] c++: Add gnu::diagnose_as attribute

2021-08-17 Thread Jason Merrill via Gcc-patches
On 7/23/21 4:58 AM, Matthias Kretz wrote: Hi Jason, Hi, thanks for your patience; I've been out on PTO a lot in the last month, and will be again this week. I found a few regressions from the last patch in the meantime. Version 4 of the patch is attached. Questions: 1. I simplified the co

[PATCH v4] c++: Add gnu::diagnose_as attribute

2021-07-23 Thread Matthias Kretz
Hi Jason, I found a few regressions from the last patch in the meantime. Version 4 of the patch is attached. Questions: 1. I simplified the condition for calling dump_template_parms in dump_function_name. !DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (t) is equivalent to DECL_USE_TEMPLATE (t) in