From: Patrick Palka <patrick@parcs.ath.cx>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: David Malcolm <dmalcolm@redhat.com>,
Patrick Palka <patrick@parcs.ath.cx>
Subject: Re: [PATCH 1/3] Refactor entry point to -Wmisleading-indentation
Date: Thu, 18 Jun 2015 15:45:00 -0000 [thread overview]
Message-ID: <CA+C-WL89hzM5ttopFPt45LrGinWVqBLx+S7gftFssjVx3Sr1mg@mail.gmail.com> (raw)
In-Reply-To: <1433871067-30661-1-git-send-email-patrick@parcs.ath.cx>
On Tue, Jun 9, 2015 at 1:31 PM, Patrick Palka <patrick@parcs.ath.cx> 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.
Pinging this series.
next prev parent reply other threads:[~2015-06-18 15:42 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 ` Patrick Palka [this message]
2015-06-18 16:48 ` [PATCH 1/3] Refactor entry point to -Wmisleading-indentation 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
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-WL89hzM5ttopFPt45LrGinWVqBLx+S7gftFssjVx3Sr1mg@mail.gmail.com \
--to=patrick@parcs.ath.cx \
--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).