Re: [RFA 1/3] Use function_name_style to print Ada and C function names

Philippe Waroquiers
2019-01-12T16:29:25Z

On Sat, 2019-01-12 at 09:22 -0700, Tom Tromey wrote:
> > > > > > "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:
>
> Philippe> * ada-typeprint.c (print_func_type): Print function name
> Philippe> style to print function name.
> Philippe> * c-typeprint.c (c_print_type_1): Likewise.
>
> These are printing type names, not function names -- so I wonder whether
> we want to apply the function name styling here.
>
> Any comments on this aspect? I am not sure myself.
ada-typeprint.c:print_func_type is only called to print types that are
functions. So, that effectively prints a function name.

c-typeprint.c (c_print_type_1) is effectively called to print whatever
type (so not only functions), but the following added condition
should ensure function name style is only used for function names:
-Â Â Â Â Â  fputs_filtered (varstring, stream);
+Â Â Â Â Â  if (code == TYPE_CODE_FUNC || code == TYPE_CODE_METHOD)
+Â Â Â Â Â Â Â fputs_styled (varstring, function_name_style.style (), stream );
+Â Â Â Â Â  else
+Â Â Â Â Â Â Â fputs_filtered (varstring, stream);

>
> On the one hand, it isn't a function name; maybe we would like a type
> style, but then maybe a type style would be too noisy somehow?
>
> On the other hand, maybe calling out function type names looks nicer.
>
> Philippe> + fputs_styled (varstring, function_name_style.style (), stream );
>
> Extra space before the close paren.
I will fix this, once/if a go to push ...

Thanks

Philippe