]> git.ipfire.org Git - thirdparty/gcc.git/commit - libcpp/ChangeLog
Implement -Wmisleading-indentation
authorDavid Malcolm <dmalcolm@redhat.com>
Tue, 12 May 2015 20:57:38 +0000 (20:57 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Tue, 12 May 2015 20:57:38 +0000 (20:57 +0000)
commitc3388e62499a6d2f931247a73cabf9184366248e
tree59ac6b4ba6d59fb6b6bc0da54eaa2c8c9b71068d
parentf06ed65044c0cba7f9cb8d6d8a8b99ee81953e4e
Implement -Wmisleading-indentation

gcc/ChangeLog:
* doc/invoke.texi (Warning Options): Add -Wmisleading-indentation.
(-Wmisleading-indentation): New option.
* Makefile.in (C_COMMON_OBJS): Add c-family/c-indentation.o.

gcc/c-family/ChangeLog:
* c-common.h (warn_for_misleading_indentation): New prototype.
* c-indentation.c: New file.
* c.opt (Wmisleading-indentation): New option.

gcc/c/ChangeLog:
* c-parser.c (c_parser_if_body): Add param "if_loc", use it
to add a call to warn_for_misleading_indentation.
(c_parser_else_body): Likewise, adding param "else_loc".
(c_parser_if_statement): Check for misleading indentation.
(c_parser_while_statement): Likewise.
(c_parser_for_statement): Likewise.

gcc/cp/ChangeLog:
* parser.c (cp_parser_selection_statement): Add location and
guard_kind arguments to calls to
cp_parser_implicitly_scoped_statement.
(cp_parser_iteration_statement): Likewise for calls to
cp_parser_already_scoped_statement.
(cp_parser_implicitly_scoped_statement): Add "guard_loc" and
"guard_kind" params; use them to warn for misleading
indentation.
(cp_parser_already_scoped_statement): Likewise.

gcc/testsuite/ChangeLog:
* c-c++-common/Wmisleading-indentation.c: New testcase.
* c-c++-common/Wmisleading-indentation-2.c: New testcase.
* c-c++-common/Wmisleading-indentation-2.md: New file.

libcpp/ChangeLog:
* directives.c (do_line): Set seen_line_directive on line_table.
(do_linemarker): Likewise.
* include/line-map.h (struct line_maps): Add new field
"seen_line_directive".

From-SVN: r223098
18 files changed:
gcc/ChangeLog
gcc/Makefile.in
gcc/c-family/ChangeLog
gcc/c-family/c-common.h
gcc/c-family/c-indentation.c [new file with mode: 0644]
gcc/c-family/c.opt
gcc/c/ChangeLog
gcc/c/c-parser.c
gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/Wmisleading-indentation-2.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/Wmisleading-indentation-2.md [new file with mode: 0644]
gcc/testsuite/c-c++-common/Wmisleading-indentation.c [new file with mode: 0644]
libcpp/ChangeLog
libcpp/directives.c
libcpp/include/line-map.h