From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 70142 invoked by alias); 25 Jan 2016 21:46:15 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 70126 invoked by uid 89); 25 Jan 2016 21:46:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=Hx-languages-length:2067, voice X-HELO: usplmg21.ericsson.net Received: from usplmg21.ericsson.net (HELO usplmg21.ericsson.net) (198.24.6.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 25 Jan 2016 21:46:13 +0000 Received: from EUSAAHC004.ericsson.se (Unknown_Domain [147.117.188.84]) by usplmg21.ericsson.net (Symantec Mail Security) with SMTP id 60.62.32102.19796A65; Mon, 25 Jan 2016 22:45:53 +0100 (CET) Received: from [142.133.110.144] (147.117.188.8) by smtp-am.internal.ericsson.com (147.117.188.86) with Microsoft SMTP Server id 14.3.248.2; Mon, 25 Jan 2016 16:46:11 -0500 Subject: Re: [PATCH] Fix GCC6 -Wmisleading-indentation issues. To: Mark Wielaard , References: <1453750851-29990-1-git-send-email-mjw@redhat.com> From: Simon Marchi Message-ID: <56A697A2.9060207@ericsson.com> Date: Mon, 25 Jan 2016 21:46:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <1453750851-29990-1-git-send-email-mjw@redhat.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2016-01/txt/msg00635.txt.bz2 On 16-01-25 02:40 PM, Mark Wielaard wrote: > GCC6 will warn about misleading indentation issues like: >=20 > gdb/ada-lang.c: In function =E2=80=98ada_evaluate_subexp=E2=80=99: > ada-lang.c:11423:9: error: statement is indented as if it were guarded by= ... > arg1 =3D unwrap_value (arg1); > ^~~~ >=20 > gdb/ada-lang.c:11421:7: note: ...this =E2=80=98else=E2=80=99 clause, but = it is not > else > ^~~~ >=20 > In this case it would be a bug except for the fact the if clause already > returned early. So this misindented statement really only got executed > for the else case. But it could easily mislead a reader, so adding a > proper else block is the correct solution. >=20 > In case of c-typeprint.c (c_type_print_base) the if statement is indeed > misleadingly indented, but not a bug. Just indent correctly. The inflow.c > (terminal_ours_1) misindented block comes from the removal of an if clause > in commit d9d2d8b which looks correct. So just reindent the brackets of > the block. The linux-record.c misleadingly indented return statements > are just that. Misleading to the reader, but not actual bugs. So just > properly indent them so they don't look the fall under the wrong if claus= e. Thanks for doing this! If you feel like it, you could build with --enable-targets=3Dall to enable = more code. You'll find more of these. One little comment below, otherwise it LGTM (without implying that my voice= is worth anything). > diff --git a/gdb/inflow.c b/gdb/inflow.c > index bbd2b12..d1dd41c 100644 > --- a/gdb/inflow.c > +++ b/gdb/inflow.c > @@ -413,7 +413,7 @@ child_terminal_ours_1 (int output_only) > if (tinfo->run_terminal !=3D NULL || gdb_has_a_terminal () =3D=3D 0) > return; >=20=20 > - { > + { > #ifdef SIGTTOU > /* Ignore this signal since it will happen when we try to set the > pgrp. */ > @@ -497,7 +497,7 @@ child_terminal_ours_1 (int output_only) > result =3D fcntl (0, F_SETFL, our_terminal_info.tflags); > result =3D fcntl (0, F_SETFL, our_terminal_info.tflags); > #endif > - } > + } Shouldn't the code inside the brackets be de-indented too?