Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [RFA 02/10] Fix some indentation in linespec.c
Date: Mon, 02 Apr 2018 01:49:00 -0000	[thread overview]
Message-ID: <350c8eef-e660-832d-5694-f492286b924a@simark.ca> (raw)
In-Reply-To: <20180401163539.15314-3-tom@tromey.com>

On 2018-04-01 12:35 PM, Tom Tromey wrote:
> This removes some leftover comments and fixes the indentation in a
> couple of spots in linespec.c.

Thanks, git show -w shows that it is trivial.  There are three lines that become
too long though.  Feel free to push it by itself.

> gdb/ChangeLog
> 2018-03-31  Tom Tromey  <tom@tromey.com>
> 
> 	* linespec.c (linespec_parse_basic): Reindent.
> ---
>  gdb/ChangeLog  |   4 ++
>  gdb/linespec.c | 136 ++++++++++++++++++++++++++++-----------------------------
>  2 files changed, 70 insertions(+), 70 deletions(-)
> 
> diff --git a/gdb/linespec.c b/gdb/linespec.c
> index bd09f57b05..9273dcde88 100644
> --- a/gdb/linespec.c
> +++ b/gdb/linespec.c
> @@ -1897,68 +1897,66 @@ linespec_parse_basic (linespec_parser *parser)
>      }
>    else
>      {
> -      /* XXX Reindent before pushing.  */
> -
> -  /* Try looking it up as a function/method.  */
> -  find_linespec_symbols (PARSER_STATE (parser),
> -			 PARSER_RESULT (parser)->file_symtabs, name,
> -			 PARSER_EXPLICIT (parser)->func_name_match_type,
> -			 &symbols, &minimal_symbols);
> +      /* Try looking it up as a function/method.  */
> +      find_linespec_symbols (PARSER_STATE (parser),
> +			     PARSER_RESULT (parser)->file_symtabs, name,
> +			     PARSER_EXPLICIT (parser)->func_name_match_type,
> +			     &symbols, &minimal_symbols);
>  
> -  if (symbols != NULL || minimal_symbols != NULL)
> -    {
> -      PARSER_RESULT (parser)->function_symbols = symbols;
> -      PARSER_RESULT (parser)->minimal_symbols = minimal_symbols;
> -      PARSER_EXPLICIT (parser)->function_name = name;
> -      symbols = NULL;
> -      discard_cleanups (cleanup);
> -    }
> -  else
> -    {
> -      /* NAME was not a function or a method.  So it must be a label
> -	 name or user specified variable like "break foo.c:$zippo".  */
> -      labels = find_label_symbols (PARSER_STATE (parser), NULL,
> -				   &symbols, name);
> -      if (labels != NULL)
> +      if (symbols != NULL || minimal_symbols != NULL)
>  	{
> -	  PARSER_RESULT (parser)->labels.label_symbols = labels;
> -	  PARSER_RESULT (parser)->labels.function_symbols = symbols;
> -	  PARSER_EXPLICIT (parser)->label_name = name;
> +	  PARSER_RESULT (parser)->function_symbols = symbols;
> +	  PARSER_RESULT (parser)->minimal_symbols = minimal_symbols;
> +	  PARSER_EXPLICIT (parser)->function_name = name;
>  	  symbols = NULL;
>  	  discard_cleanups (cleanup);
>  	}
> -      else if (token.type == LSTOKEN_STRING
> -	       && *LS_TOKEN_STOKEN (token).ptr == '$')
> +      else
>  	{
> -	  /* User specified a convenience variable or history value.  */
> -	  PARSER_EXPLICIT (parser)->line_offset
> -	    = linespec_parse_variable (PARSER_STATE (parser), name);
> +	  /* NAME was not a function or a method.  So it must be a label
> +	     name or user specified variable like "break foo.c:$zippo".  */
> +	  labels = find_label_symbols (PARSER_STATE (parser), NULL,
> +				       &symbols, name);
> +	  if (labels != NULL)
> +	    {
> +	      PARSER_RESULT (parser)->labels.label_symbols = labels;
> +	      PARSER_RESULT (parser)->labels.function_symbols = symbols;
> +	      PARSER_EXPLICIT (parser)->label_name = name;
> +	      symbols = NULL;
> +	      discard_cleanups (cleanup);
> +	    }
> +	  else if (token.type == LSTOKEN_STRING
> +		   && *LS_TOKEN_STOKEN (token).ptr == '$')
> +	    {
> +	      /* User specified a convenience variable or history value.  */
> +	      PARSER_EXPLICIT (parser)->line_offset
> +		= linespec_parse_variable (PARSER_STATE (parser), name);
>  
> -	  if (PARSER_EXPLICIT (parser)->line_offset.sign == LINE_OFFSET_UNKNOWN)
> +	      if (PARSER_EXPLICIT (parser)->line_offset.sign == LINE_OFFSET_UNKNOWN)

Here...

> +		{
> +		  /* The user-specified variable was not valid.  Do not
> +		     throw an error here.  parse_linespec will do it for us.  */
> +		  PARSER_EXPLICIT (parser)->function_name = name;
> +		  discard_cleanups (cleanup);
> +		  return;
> +		}
> +
> +	      /* The convenience variable/history value parsed correctly.
> +		 NAME is no longer needed.  */
> +	      do_cleanups (cleanup);
> +	    }
> +	  else
>  	    {
> -	      /* The user-specified variable was not valid.  Do not
> -		 throw an error here.  parse_linespec will do it for us.  */
> +	      /* The name is also not a label.  Abort parsing.  Do not throw
> +		 an error here.  parse_linespec will do it for us.  */
> +
> +	      /* Save a copy of the name we were trying to lookup.  */
>  	      PARSER_EXPLICIT (parser)->function_name = name;
>  	      discard_cleanups (cleanup);
>  	      return;
>  	    }
> -
> -	  /* The convenience variable/history value parsed correctly.
> -	     NAME is no longer needed.  */
> -	  do_cleanups (cleanup);
> -	}
> -      else
> -	{
> -	  /* The name is also not a label.  Abort parsing.  Do not throw
> -	     an error here.  parse_linespec will do it for us.  */
> -
> -	  /* Save a copy of the name we were trying to lookup.  */
> -	  PARSER_EXPLICIT (parser)->function_name = name;
> -	  discard_cleanups (cleanup);
> -	  return;
>  	}
>      }
> -    }
>  
>    int previous_qc = parser->completion_quote_char;
>  
> @@ -2027,29 +2025,27 @@ linespec_parse_basic (linespec_parser *parser)
>  	    }
>  	  else
>  	    {
> -	      /* XXX Reindent before pushing.  */
> -
> -	  /* Grab a copy of the label's name and look it up.  */
> -	  name = copy_token_string (token);
> -	  cleanup = make_cleanup (xfree, name);
> -	  labels = find_label_symbols (PARSER_STATE (parser),
> -				       PARSER_RESULT (parser)->function_symbols,
> -				       &symbols, name);
> +	      /* Grab a copy of the label's name and look it up.  */
> +	      name = copy_token_string (token);
> +	      cleanup = make_cleanup (xfree, name);
> +	      labels = find_label_symbols (PARSER_STATE (parser),
> +					   PARSER_RESULT (parser)->function_symbols,

... here ...

> +					   &symbols, name);
>  
> -	  if (labels != NULL)
> -	    {
> -	      PARSER_RESULT (parser)->labels.label_symbols = labels;
> -	      PARSER_RESULT (parser)->labels.function_symbols = symbols;
> -	      PARSER_EXPLICIT (parser)->label_name = name;
> -	      symbols = NULL;
> -	      discard_cleanups (cleanup);
> -	    }
> -	  else
> -	    {
> -	      /* We don't know what it was, but it isn't a label.  */
> -	      undefined_label_error (PARSER_EXPLICIT (parser)->function_name,
> -				     name);
> -	    }
> +	      if (labels != NULL)
> +		{
> +		  PARSER_RESULT (parser)->labels.label_symbols = labels;
> +		  PARSER_RESULT (parser)->labels.function_symbols = symbols;
> +		  PARSER_EXPLICIT (parser)->label_name = name;
> +		  symbols = NULL;
> +		  discard_cleanups (cleanup);
> +		}
> +	      else
> +		{
> +		  /* We don't know what it was, but it isn't a label.  */
> +		  undefined_label_error (PARSER_EXPLICIT (parser)->function_name,

... and here.

Simon


  reply	other threads:[~2018-04-02  1:49 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-01 16:35 [RFA 00/10] Remove some cleanups from linespec.c Tom Tromey
2018-04-01 16:35 ` [RFA 05/10] Have filter_results take a std::vector Tom Tromey
2018-04-01 16:35 ` [RFA 04/10] Return std::string from canonical_to_fullform Tom Tromey
2018-04-02  2:15   ` Simon Marchi
2018-04-01 16:35 ` [RFA 08/10] More use of std::vector in linespec.c Tom Tromey
2018-04-02  2:35   ` Simon Marchi
2018-04-01 16:35 ` [RFA 03/10] Make copy_token_string return unique_xmalloc_ptr Tom Tromey
2018-04-01 16:35 ` [RFA 07/10] Change streq to return bool Tom Tromey
2018-04-02  2:28   ` Simon Marchi
2018-04-01 16:35 ` [RFA 02/10] Fix some indentation in linespec.c Tom Tromey
2018-04-02  1:49   ` Simon Marchi [this message]
2018-04-01 16:35 ` [RFA 10/10] Remove unnecessary include from linespec.h Tom Tromey
2018-04-01 16:35 ` [RFA 06/10] Remove a string copy from event_location_to_sals Tom Tromey
2018-04-01 16:35 ` [RFA 01/10] Remove some cleanups from search_minsyms_for_name Tom Tromey
2018-04-02  1:39   ` Simon Marchi
2018-04-01 16:35 ` [RFA 09/10] Remove typep and VEC(typep) from linespec.c Tom Tromey
2018-04-02  2:44 ` [RFA 00/10] Remove some cleanups " Simon Marchi
2018-04-03 22:31   ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=350c8eef-e660-832d-5694-f492286b924a@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox