diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c/c-parser.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr81779.c | 15 |
4 files changed, 27 insertions, 0 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 52ed9f0..561b58e 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +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> PR c++/83814 diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 3327dc9..5e3512a 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -4975,6 +4975,7 @@ c_parser_compound_statement_nostart (c_parser *parser) while (c_parser_next_token_is_not (parser, CPP_CLOSE_BRACE)) { 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) || c_parser_next_token_is_keyword (parser, RID_DEFAULT) || (c_parser_next_token_is (parser, CPP_NAME) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4dd7c6d..149df85 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +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> PR fortran/84116 diff --git a/gcc/testsuite/gcc.dg/pr81779.c b/gcc/testsuite/gcc.dg/pr81779.c new file mode 100644 index 0000000..6e79638 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr81779.c @@ -0,0 +1,15 @@ +/* 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; +} |