Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Simon Marchi <simon.marchi@efficios.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix indentation (and clang warning) in c-lang.c
Date: Wed, 18 Dec 2019 18:28:00 -0000	[thread overview]
Message-ID: <2b7648a2-7f88-bb49-0e41-b2415e520c3c@simark.ca> (raw)
In-Reply-To: <20191216233637.29925-1-simon.marchi@efficios.com>

On 2019-12-16 6:36 p.m., Simon Marchi wrote:
> I see this warning when building with clang:
> 
>       CXX    c-lang.o
>     /home/smarchi/src/binutils-gdb/gdb/c-lang.c:314:7: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
>           *length = i * width;
>           ^
>     /home/smarchi/src/binutils-gdb/gdb/c-lang.c:308:4: note: previous statement is here
>               if (extract_unsigned_integer (contents + i * width,
>               ^
> 
> It took me a while to notice that some lines in that area have a
> spurious space before the tabs, at the beginning of the ling.  I'm not
> sure how clang translates that to misleading indentation, but making the
> indentation correct gets rid of the error.
> 
> There are many more instances of this in the code base (`grep -P '^ \t'
> *.c`), if others think it's a good idea, it would be pretty easy to fix
> them all up in one shot.
> 
> gdb/ChangeLog:
> 
> 	* c-lang.c (c_get_string, asm_language_defn): Remove space
> 	before tab.
> ---
>  gdb/c-lang.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/gdb/c-lang.c b/gdb/c-lang.c
> index 846970af7b92..1f40e885d99a 100644
> --- a/gdb/c-lang.c
> +++ b/gdb/c-lang.c
> @@ -303,14 +303,14 @@ c_get_string (struct value *value, gdb::unique_xmalloc_ptr<gdb_byte> *buffer,
>        if (*length >= 0)
>  	i  = *length;
>        else
> - 	/* Otherwise, look for a null character.  */
> - 	for (i = 0; i < fetchlimit; i++)
> +	/* Otherwise, look for a null character.  */
> +	for (i = 0; i < fetchlimit; i++)
>  	  if (extract_unsigned_integer (contents + i * width,
>  					width, byte_order) == 0)
> - 	    break;
> +	    break;
>    
>        /* I is now either a user-defined length, the number of non-null
> - 	 characters, or FETCHLIMIT.  */
> +	 characters, or FETCHLIMIT.  */
>        *length = i * width;
>        buffer->reset ((gdb_byte *) xmalloc (*length));
>        memcpy (buffer->get (), contents, *length);
> @@ -1119,7 +1119,7 @@ extern const struct language_defn asm_language_defn =
>    0,				/* String lower bound */
>    default_word_break_characters,
>    default_collect_symbol_completion_matches,
> -  c_language_arch_info, 	/* FIXME: la_language_arch_info.  */
> +  c_language_arch_info,		/* FIXME: la_language_arch_info.  */
>    default_print_array_index,
>    default_pass_by_reference,
>    c_watch_location_expression,
> -- 
> 2.24.1
> 

I pushed this one.

Simon


      parent reply	other threads:[~2019-12-18 18:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-16 23:36 Simon Marchi
2019-12-16 23:50 ` Simon Marchi
2019-12-17 19:24   ` Pedro Alves
2019-12-17 19:39     ` Simon Marchi
2019-12-17 19:41       ` Pedro Alves
2019-12-17 19:53         ` Simon Marchi
2019-12-18 18:28 ` Simon Marchi [this message]

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=2b7648a2-7f88-bb49-0e41-b2415e520c3c@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@efficios.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