diff options
author | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-05-04 12:47:53 +0000 |
---|---|---|
committer | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-05-04 12:47:53 +0000 |
commit | d3ca4ed0d68ac644d0c5e846d2fd129f18938d3b (patch) | |
tree | 02efb23b17d27157c296459ff616149bc405afae /gcc | |
parent | 27746e01e73b4caa0b4c6237ce6f21c8c5c1eb6c (diff) | |
download | gcc-d3ca4ed0d68ac644d0c5e846d2fd129f18938d3b.tar.gz |
2009-05-04 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c++/28152
cp/
* parser.c (cp_lexer_get_preprocessor_token): Do not store the
canonical spelling for keywords.
(cp_parser_attribute_list): Use the canonical spelling for
keywords in attributes.
testsuite/
* g++.dg/parse/parser-pr28152.C: New.
* g++.dg/parse/parser-pr28152-2.C: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147097 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/parser.c | 12 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/parser-pr28152-2.C | 13 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/parser-pr28152.C | 13 |
5 files changed, 46 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 785dbb1b6b2..4a34132fe33 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2009-05-04 Manuel Lopez-Ibanez <manu@gcc.gnu.org> + + PR c++/28152 + * parser.c (cp_lexer_get_preprocessor_token): Do not store the + canonical spelling for keywords. + (cp_parser_attribute_list): Use the canonical spelling for + keywords in attributes. + 2009-05-01 Joseph Myers <joseph@codesourcery.com> * cxx-pretty-print.c (is_destructor_name, pp_cxx_unqualified_id, diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 98292753a3b..c691ef24ff6 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -418,11 +418,6 @@ cp_lexer_get_preprocessor_token (cp_lexer *lexer, cp_token *token) token->type = CPP_KEYWORD; /* Record which keyword. */ token->keyword = C_RID_CODE (token->u.value); - /* Update the value. Some keywords are mapped to particular - entities, rather than simply having the value of the - corresponding IDENTIFIER_NODE. For example, `__const' is - mapped to `const'. */ - token->u.value = ridpointers[token->keyword]; } else { @@ -16842,7 +16837,12 @@ cp_parser_attribute_list (cp_parser* parser) /* Save away the identifier that indicates which attribute this is. */ - identifier = token->u.value; + identifier = (token->type == CPP_KEYWORD) + /* For keywords, use the canonical spelling, not the + parsed identifier. */ + ? ridpointers[(int) token->keyword] + : token->u.value; + attribute = build_tree_list (identifier, NULL_TREE); /* Peek at the next token. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9fa40cb4807..842105c63bd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2009-05-04 Manuel Lopez-Ibanez <manu@gcc.gnu.org> + + PR c++/28152 + * g++.dg/parse/parser-pr28152.C: New. + * g++.dg/parse/parser-pr28152-2.C: New. + 2009-05-04 Joseph Myers <joseph@codesourcery.com> * gcc.dg/attr-alias-5.c, gcc.dg/ucnid-7.c: New tests. diff --git a/gcc/testsuite/g++.dg/parse/parser-pr28152-2.C b/gcc/testsuite/g++.dg/parse/parser-pr28152-2.C new file mode 100644 index 00000000000..bcccb94a0cf --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/parser-pr28152-2.C @@ -0,0 +1,13 @@ +/* PR 28152: error messages should mention __complex__ */ +/* { dg-do compile } */ +/* { dg-options "" } */ +int +main (void) +{ + __complex__ float z; + + z = __complex__ (1.90000007326203904e+19, 0.0); // { dg-error "expected primary-expression before '__complex__'" } + // { dg-error "expected .;. before .__complex__." "" { target *-*-* } 9 } + z = __complex__ (1.0e+0, 0.0) / z; // { dg-error "expected primary-expression before '__complex__'" } + // { dg-error "expected .;. before '__complex__'" "" { target *-*-* } 11 } + // { dg-error "at end of input" "" { target *-*-* } 11 } diff --git a/gcc/testsuite/g++.dg/parse/parser-pr28152.C b/gcc/testsuite/g++.dg/parse/parser-pr28152.C new file mode 100644 index 00000000000..5b3a25e18c9 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/parser-pr28152.C @@ -0,0 +1,13 @@ +/* PR 28152: error messages should mention _Complex */ +/* { dg-do compile } */ +/* { dg-options "" } */ +int +main (void) +{ + _Complex float z; + + z = _Complex (1.90000007326203904e+19, 0.0); // { dg-error "expected primary-expression before '_Complex'" } + // { dg-error "expected .;. before ._Complex." "" { target *-*-* } 9 } + z = _Complex (1.0e+0, 0.0) / z; // { dg-error "expected primary-expression before '_Complex'" } + // { dg-error "expected .;. before '_Complex'" "" { target *-*-* } 11 } + // { dg-error "at end of input" "" { target *-*-* } 11 } |