From: Jeff Law <law@redhat.com>
To: David Malcolm <dmalcolm@redhat.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 2/2] PR c/68187: fix overzealous -Wmisleading-indentation (comment #1)
Date: Fri, 04 Mar 2016 07:20:00 -0000 [thread overview]
Message-ID: <56D93746.8080009@redhat.com> (raw)
In-Reply-To: <1457018483-26829-2-git-send-email-dmalcolm@redhat.com>
On 03/03/2016 08:21 AM, David Malcolm wrote:
> Comment #1 of PR c/68187 identified another overzealous warning
> from -Wmisleading-indentation, with OpenSSL 1.0.1, on this poorly
> indented code:
>
> 115 if (locked)
> 116 i = CRYPTO_add(&e->struct_ref, -1, CRYPTO_LOCK_ENGINE);
> 117 else
> 118 i = --e->struct_ref;
> 119 engine_ref_debug(e, 0, -1)
> 120 if (i > 0)
> 121 return 1;
Egad. How do people read this code when they have to understand it and
make changes. What a steaming pile of .....
>
> Root cause is that "engine_ref_debug" is actually a debugging macro
> that was empty in the given configuration, so the code effectively
> was:
>
> 117 else // GUARD
> 118 i = --e->struct_ref; // BODY
> 119
> 120 if (i > 0) // NEXT
>
> hence the warning.
No surprise we triggered seeing that.
>
> OK for trunk?
>
> Note: one of the new test cases adds a dg-warning/dg-message pair, and so
> would require updating if/when the wording change posted here:
> https://gcc.gnu.org/ml/gcc-patches/2016-03/msg00068.html
> ("[PATCH] PR c/69993: improvements to wording of -Wmisleading-indentation")
> is applied.
>
> gcc/c-family/ChangeLog:
> PR c/68187
> * c-indentation.c (get_visual_column): Move code to determine next
> tab stop to...
> (next_tab_stop): ...this new function.
> (line_contains_hash_if): Delete function.
> (detect_preprocessor_logic): Delete function.
> (get_first_nws_vis_column): New function.
> (detect_intervening_unindent): New function.
> (should_warn_for_misleading_indentation): Replace call to
> detect_preprocessor_logic with a call to
> detect_intervening_unindent.
>
> gcc/testsuite/ChangeLog:
> PR c/68187
> * c-c++-common/Wmisleading-indentation.c (fn_42_a): New test
> function.
> (fn_42_b): Likewise.
> (fn_42_c): Likewise.
OK.
Jeff
next prev parent reply other threads:[~2016-03-04 7:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-03 14:58 [PATCH 1/2] PR c/68187: fix overzealous -Wmisleading-indentation (comment #0) David Malcolm
2016-03-03 14:58 ` [PATCH 2/2] PR c/68187: fix overzealous -Wmisleading-indentation (comment #1) David Malcolm
2016-03-03 17:16 ` Patrick Palka
2016-03-04 12:53 ` Bernd Schmidt
2016-03-04 13:05 ` Marek Polacek
2016-03-04 7:20 ` Jeff Law [this message]
2016-03-03 15:25 ` [PATCH 1/2] PR c/68187: fix overzealous -Wmisleading-indentation (comment #0) Patrick Palka
2016-03-03 15:56 ` David Malcolm
2016-03-03 16:58 ` Patrick Palka
2016-03-11 20:05 ` [committed 1/2] Wmisleading-indentation: add reproducer for PR c/70085 David Malcolm
2016-03-11 20:05 ` [committed 2/2] Wmisleading-indentation.c: add more test cases for PR c/68187 David Malcolm
2016-03-04 7:15 ` [PATCH 1/2] PR c/68187: fix overzealous -Wmisleading-indentation (comment #0) Jeff Law
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=56D93746.8080009@redhat.com \
--to=law@redhat.com \
--cc=dmalcolm@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).