From 0c41863093aedb7bc7e3771bebb070e8f433b17f Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Tue, 27 Jun 2017 07:16:29 +0000 Subject: [PATCH] re PR bootstrap/81216 (bootstrap failed on i386 and powerpc64le) PR bootstrap/81216 * parser.c (cp_parser_already_scoped_statement): Initialize LOC_AFTER_LABELS. * g++.dg/warn/Wmultistatement-macros-1.C: New test. From-SVN: r249676 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/parser.c | 5 +++-- gcc/testsuite/ChangeLog | 5 +++++ .../g++.dg/warn/Wmultistatement-macros-1.C | 13 +++++++++++++ 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/warn/Wmultistatement-macros-1.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c067d23eb8a..53aadf4ac44 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2017-06-27 Marek Polacek + + PR bootstrap/81216 + * parser.c (cp_parser_already_scoped_statement): Initialize + LOC_AFTER_LABELS. + 2017-06-26 Jason Merrill PR c++/81215 - deduction failure with variadic TTP. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index c405fe5b776..573b97a658f 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -12438,7 +12438,7 @@ cp_parser_already_scoped_statement (cp_parser* parser, bool *if_p, { token_indent_info body_tinfo = get_token_indent_info (cp_lexer_peek_token (parser->lexer)); - location_t loc_after_labels; + location_t loc_after_labels = UNKNOWN_LOCATION; cp_parser_statement (parser, NULL_TREE, false, if_p, NULL, &loc_after_labels); @@ -12446,7 +12446,8 @@ cp_parser_already_scoped_statement (cp_parser* parser, bool *if_p, = get_token_indent_info (cp_lexer_peek_token (parser->lexer)); warn_for_misleading_indentation (guard_tinfo, body_tinfo, next_tinfo); - if (next_tinfo.type != CPP_SEMICOLON) + if (loc_after_labels != UNKNOWN_LOCATION + && next_tinfo.type != CPP_SEMICOLON) warn_for_multistatement_macros (loc_after_labels, next_tinfo.location, guard_tinfo.location, guard_tinfo.keyword); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d7c906aad6f..38e5c7a9434 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-06-27 Marek Polacek + + PR bootstrap/81216 + * g++.dg/warn/Wmultistatement-macros-1.C: New test. + 2017-06-26 Martin Sebor PR c++/81169 diff --git a/gcc/testsuite/g++.dg/warn/Wmultistatement-macros-1.C b/gcc/testsuite/g++.dg/warn/Wmultistatement-macros-1.C new file mode 100644 index 00000000000..afaef9ad429 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wmultistatement-macros-1.C @@ -0,0 +1,13 @@ +// PR bootstrap/81216 +// { dg-options "-Wmultistatement-macros" } +// { dg-do compile } + +template +static bool +equal (A a, A b, B c) +{ + for (; a != b; ++a, (void)++c) + if (!(*a == *c)) + return false; + return true; +} -- 2.30.2