From: Patrick Palka <patrick@parcs.ath.cx>
To: Jeff Law <law@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
David Malcolm <dmalcolm@redhat.com>
Subject: Re: [PATCH 1/3] Refactor entry point to -Wmisleading-indentation
Date: Tue, 23 Jun 2015 19:14:00 -0000 [thread overview]
Message-ID: <CA+C-WL-MTe1EdX9pKFA8mmKtEvX-ZOU-JikY66CAUwCDt=qNZg@mail.gmail.com> (raw)
In-Reply-To: <CA+C-WL_O7W6YUs_i1cF8TDs61UmAnfg2x5fviPTVegbACCwyyg@mail.gmail.com>
On Mon, Jun 22, 2015 at 2:56 PM, Patrick Palka <patrick@parcs.ath.cx> wrote:
> On Mon, Jun 22, 2015 at 1:29 PM, Jeff Law <law@redhat.com> wrote:
>> On 06/09/2015 11:31 AM, Patrick Palka wrote:
>>>
>>> This patch refactors the entry point of -Wmisleading-indentation from:
>>>
>>> void
>>> warn_for_misleading_indentation (location_t guard_loc,
>>> location_t body_loc,
>>> location_t next_stmt_loc,
>>> enum cpp_ttype next_tok_type,
>>> const char *guard_kind);
>>>
>>> to
>>>
>>> struct token_indent_info
>>> {
>>> location_t location;
>>> cpp_ttype type;
>>> rid keyword;
>>> };
>>>
>>> void
>>> warn_for_misleading_indentation (const token_indent_info &guard_tinfo,
>>> const token_indent_info &body_tinfo,
>>> const token_indent_info &next_tinfo);
>>>
>>> The purpose of this refactoring is to expose more information to the
>>> -Wmisleading-indentation implementation to allow for more advanced
>>> heuristics and for better coverage.
>>>
>>> (I decided to keep the usage of const references because nobody
>>> seems to mind. Also I added a new header file, c-indentation.h.)
>>>
>>> gcc/c-family/ChangeLog:
>>>
>>> * c-indentation.h (struct token_indent_info): Define.
>>> (get_token_indent_info): Define.
>>> (warn_for_misleading_information): Declare.
>>> * c-common.h (warn_for_misleading_information): Remove.
>>> * c-identation.c (warn_for_misleading_indentation):
>>> Change declaration to take three token_indent_infos. Adjust
>>> accordingly.
>>> * c-identation.c (should_warn_for_misleading_indentation):
>>> Likewise. Bail out early if the body is a compound statement.
>>> (guard_tinfo_to_string): Define.
>>>
>>> gcc/c/ChangeLog:
>>>
>>> * c-parser.c (c_parser_if_body): Take token_indent_info
>>> argument. Call warn_for_misleading_indentation even when the
>>> body is a semicolon. Extract token_indent_infos corresponding
>>> to the guard, body and next tokens. Adjust call to
>>> warn_for_misleading_indentation accordingly.
>>> (c_parser_else_body): Likewise.
>>> (c_parser_if_statement): Likewise.
>>> (c_parser_while_statement): Likewise.
>>> (c_parser_for_statement): Likewise.
>>>
>>> gcc/cp/ChangeLog:
>>>
>>> * parser.c (cp_parser_selection_statement): Move handling of
>>> semicolon body to ...
>>> (cp_parser_implicitly_scoped_statement): .. here. Call
>>> warn_for_misleading_indentation even when the body is a
>>> semicolon. Extract token_indent_infos corresponding to the
>>> guard, body and next tokens. Adjust call to
>>> warn_for_misleading_indentation accordingly. Take
>>> token_indent_info argument.
>>> (cp_parser_already_scoped_statement): Likewise.
>>> (cp_parser_selection_statement, cp_parser_iteration_statement):
>>> Extract a token_indent_info corresponding to the guard token.
>>
>> The only question in my mind is bootstrap & regression testing. From
>> reading the thread for the earlier version of this patch I got the
>> impression you had bootstrapped and regression tested earlier versions.
>>
>> If you could confirm that you've bootstrapped and regression tested this
>> version it'd be appreciated. You can do it on the individual patches or the
>> set as a whole.
>
> I think I successfully bootstrapped + regtested this exact version but
> I'm not sure. I was going to do so again before committing anyway.
> I will fire off a build tonight and confirm the results tomorrow.
Bootstrap + regtest on x86_64-linux-gnu was successful with no new regressions.
>
>>
>> Jeff
>>
>>
next prev parent reply other threads:[~2015-06-23 19:06 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-09 17:31 Patrick Palka
2015-06-09 17:31 ` [PATCH 2/3] Remove is_first_nonwhitespace_on_line(), instead improve get_visual_column() Patrick Palka
2015-06-22 17:37 ` Jeff Law
2015-06-09 18:01 ` [PATCH 3/3] Improve -Wmissing-indentation heuristics Patrick Palka
2015-06-18 16:46 ` David Malcolm
2015-06-18 16:58 ` Patrick Palka
2015-06-18 17:15 ` Patrick Palka
2015-06-22 16:51 ` Jeff Law
2015-06-22 17:38 ` Jeff Law
2015-06-18 15:45 ` [PATCH 1/3] Refactor entry point to -Wmisleading-indentation Patrick Palka
2015-06-18 16:48 ` David Malcolm
2015-06-18 17:09 ` Patrick Palka
2015-06-22 16:37 ` Jeff Law
2015-06-22 17:32 ` Jeff Law
2015-06-22 19:03 ` Patrick Palka
2015-06-23 19:14 ` Patrick Palka [this message]
2015-07-28 2:36 ` Patrick Palka
2015-07-31 16:56 ` 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='CA+C-WL-MTe1EdX9pKFA8mmKtEvX-ZOU-JikY66CAUwCDt=qNZg@mail.gmail.com' \
--to=patrick@parcs.ath.cx \
--cc=dmalcolm@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=law@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).