Commit 2be4dfcb by Marek Polacek Committed by Marek Polacek

re PR c/81779 (bool define from stdbool.h suppresses -Wdeclaration-after-statement)

	PR c/81779
	* c-parser.c (c_parser_compound_statement_nostart): Call
	expansion_point_location_if_in_system_header.

	* gcc.dg/pr81779.c: New test.

From-SVN: r257271
parent c677f80a
2018-01-31 Marek Polacek <polacek@redhat.com>
PR c/81779
* c-parser.c (c_parser_compound_statement_nostart): Call
expansion_point_location_if_in_system_header.
2018-01-17 David Malcolm <dmalcolm@redhat.com> 2018-01-17 David Malcolm <dmalcolm@redhat.com>
PR c++/83814 PR c++/83814
......
...@@ -4975,6 +4975,7 @@ c_parser_compound_statement_nostart (c_parser *parser) ...@@ -4975,6 +4975,7 @@ c_parser_compound_statement_nostart (c_parser *parser)
while (c_parser_next_token_is_not (parser, CPP_CLOSE_BRACE)) while (c_parser_next_token_is_not (parser, CPP_CLOSE_BRACE))
{ {
location_t loc = c_parser_peek_token (parser)->location; location_t loc = c_parser_peek_token (parser)->location;
loc = expansion_point_location_if_in_system_header (loc);
if (c_parser_next_token_is_keyword (parser, RID_CASE) if (c_parser_next_token_is_keyword (parser, RID_CASE)
|| c_parser_next_token_is_keyword (parser, RID_DEFAULT) || c_parser_next_token_is_keyword (parser, RID_DEFAULT)
|| (c_parser_next_token_is (parser, CPP_NAME) || (c_parser_next_token_is (parser, CPP_NAME)
......
2018-01-31 Marek Polacek <polacek@redhat.com>
PR c/81779
* gcc.dg/pr81779.c: New test.
2018-01-31 Jakub Jelinek <jakub@redhat.com> 2018-01-31 Jakub Jelinek <jakub@redhat.com>
PR fortran/84116 PR fortran/84116
......
/* PR c/81779 */
/* { dg-do compile } */
/* { dg-options "-Wdeclaration-after-statement" } */
#include <stdbool.h>
bool
f2 (char *p)
{
if (!p)
return false;
bool ret = true; /* { dg-warning "ISO C90 forbids mixed declarations and code" } */
return ret;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment