diff options
author | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2015-09-18 19:36:19 +0000 |
---|---|---|
committer | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2015-09-18 19:36:19 +0000 |
commit | c4914de6185a913d2dbb152a15b0c43b9d70106c (patch) | |
tree | 616fcade21d35e7c06e245ee5b7578f95ca8ad86 /gcc/cp/parser.c | |
parent | edfc92491b22d1cd8f5fc1101cc148cc85f49441 (diff) | |
download | gcc-c4914de6185a913d2dbb152a15b0c43b9d70106c.zip gcc-c4914de6185a913d2dbb152a15b0c43b9d70106c.tar.gz gcc-c4914de6185a913d2dbb152a15b0c43b9d70106c.tar.bz2 |
Use explicit locations for some warnings in c-pragma.c.
gcc/cp/ChangeLog:
2015-09-18 Manuel López-Ibáñez <manu@gcc.gnu.org>
* parser.c (pragma_lex): Add loc argument. Rearrange the code to
make it more similar to the C version.
gcc/c-family/ChangeLog:
2015-09-18 Manuel López-Ibáñez <manu@gcc.gnu.org>
* c-pragma.c (handle_pragma_diagnostic): Use explicit location
when warning.
* c-pragma.h (pragma_lex): Add optional loc argument.
gcc/c/ChangeLog:
2015-09-18 Manuel López-Ibáñez <manu@gcc.gnu.org>
* c-parser.c (pragma_lex): Add loc argument.
gcc/testsuite/ChangeLog:
2015-09-18 Manuel López-Ibáñez <manu@gcc.gnu.org>
* gcc.dg/pragma-diag-5.c: New test.
From-SVN: r227923
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r-- | gcc/cp/parser.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 4f424b6..637118c 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -34447,15 +34447,14 @@ cp_parser_pragma (cp_parser *parser, enum pragma_context context) /* The interface the pragma parsers have to the lexer. */ enum cpp_ttype -pragma_lex (tree *value) +pragma_lex (tree *value, location_t *loc) { - cp_token *tok; - enum cpp_ttype ret; - - tok = cp_lexer_peek_token (the_parser->lexer); + cp_token *tok = cp_lexer_peek_token (the_parser->lexer); + enum cpp_ttype ret = tok->type; - ret = tok->type; *value = tok->u.value; + if (loc) + *loc = tok->location; if (ret == CPP_PRAGMA_EOL || ret == CPP_EOF) ret = CPP_EOF; @@ -34463,9 +34462,9 @@ pragma_lex (tree *value) *value = cp_parser_string_literal (the_parser, false, false); else { - cp_lexer_consume_token (the_parser->lexer); if (ret == CPP_KEYWORD) ret = CPP_NAME; + cp_lexer_consume_token (the_parser->lexer); } return ret; |