On Thu, Jun 18, 2015 at 12:39 PM, David Malcolm <dmalc...@redhat.com> wrote:
> On Thu, 2015-06-18 at 11:41 -0400, Patrick Palka wrote:
>> On Tue, Jun 9, 2015 at 1:31 PM, Patrick Palka <patr...@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.
>
> FWIW, they look reasonable to me; I'm not a reviewer.

Thanks for going over them.

Reply via email to