This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Change arglist-intro default indentation in GDB .dir-locals.el
- From: Pedro Alves <palves at redhat dot com>
- To: Antoine Tremblay <antoine dot tremblay at ericsson dot com>, gdb-patches at sourceware dot org
- Date: Thu, 19 Jan 2017 16:06:03 +0000
- Subject: Re: [PATCH] Change arglist-intro default indentation in GDB .dir-locals.el
- Authentication-results: sourceware.org; auth=none
- References: <1484336122-3804-1-git-send-email-antoine.tremblay@ericsson.com>
On 01/13/2017 07:35 PM, Antoine Tremblay wrote:
> This changes the first line in an argument list indentation so that it is
> indented one level rather than being aligned with the opening parens.
>
> Before you would have:
>
> function (
> int a);
>
> Now you will get:
>
> function (
> int a);
>
> This is done to accomodate situations where the line is very long and that
> writing arguments aligned with the parens can't be done in 80 chars, like in
> gdb/gdbserver/tracepoint.c:get_get_tsv_func_addr
>
> CORE_ADDR
> get_get_tsv_func_addr (void)
> {
> CORE_ADDR res;
> if (read_inferior_data_pointer (
> ipa_sym_addrs.addr_get_trace_state_variable_value_ptr, &res))
> {
> error ("error extracting get_trace_state_variable_value_ptr");
> return 0;
> }
> return res;
> }
>
> There's multiple places were formatting like that is used already. I
> think we can make this a global policy.
Hmm, I don't think it's that common.
Grepping around for "($" only finds a few hits.
Honestly, a "(" at the end of a line looks a bit odd in GNU-formatted code
to me. I think the usual way is to break before the parens instead:
if (read_inferior_data_pointer
(ipa_sym_addrs.addr_get_trace_state_variable_value_ptr, &res))
> Note that this does not affect the other arguments so writing a multiple
> argument function call like:
>
> void function (int a,
> int b,
> int c)
Doesn't look like a call. :-)
>
> keeps the parens alignment.
>
> Unless you start with an empty line which gives:
>
> void function (
> int a,
> int b,
> int c)
Empty line? ITYM, unless the first line has nothing after
the parens, right?
Thanks,
Pedro Alves