From: jason Date: Thu, 19 Sep 2019 19:41:17 +0000 (+0000) Subject: Handle [[likely]] on compound-statement. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ffe6a780adb8e958e77eb335d9cc540ef6668e67;p=thirdparty%2Fgcc.git Handle [[likely]] on compound-statement. I overlooked this case when adding [[likely]] handling to cp_parser_statement. * parser.c (cp_parser_statement): Handle [[likely]] on compound-statement. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@275978 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index de1677f61421..3015d6806d08 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2019-09-17 Jason Merrill + + * parser.c (cp_parser_statement): Handle [[likely]] on + compound-statement. + 2019-09-19 Jason Merrill Revert: diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 165039ef07c0..da0ffacc2186 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -11297,7 +11297,10 @@ cp_parser_statement (cp_parser* parser, tree in_statement_expr, } /* Anything that starts with a `{' must be a compound-statement. */ else if (token->type == CPP_OPEN_BRACE) - statement = cp_parser_compound_statement (parser, NULL, BCS_NORMAL, false); + { + std_attrs = process_stmt_hotness_attribute (std_attrs, attrs_loc); + statement = cp_parser_compound_statement (parser, NULL, BCS_NORMAL, false); + } /* CPP_PRAGMA is a #pragma inside a function body, which constitutes a statement all its own. */ else if (token->type == CPP_PRAGMA) diff --git a/gcc/testsuite/g++.dg/cpp2a/attr-likely5.C b/gcc/testsuite/g++.dg/cpp2a/attr-likely5.C new file mode 100644 index 000000000000..166214835d8b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/attr-likely5.C @@ -0,0 +1,9 @@ +// { dg-do compile { target c++11 } } + +void f(int i) +{ + if (i) [[likely]] + { + ++i; + } +}