aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorFabien Chêne <fabien@gcc.gnu.org>2012-01-01 18:26:23 +0100
committerFabien Chêne <fabien@gcc.gnu.org>2012-01-01 18:26:23 +0100
commit5135baed7db0fdfcaffced3d582c28a2a01f7ba1 (patch)
tree186d4d129a900d60cbe18c6e48687c2fd5a1af50 /gcc/cp
parentb4cbc46c32041cf17954de37448c22188bc0bc57 (diff)
downloadgcc-5135baed7db0fdfcaffced3d582c28a2a01f7ba1.zip
gcc-5135baed7db0fdfcaffced3d582c28a2a01f7ba1.tar.gz
gcc-5135baed7db0fdfcaffced3d582c28a2a01f7ba1.tar.bz2
crash25.C: Adjust.
gcc/testsuite/ChangeLog 2011-12-31 Fabien Chene <fabien@gcc.gnu.org> * g++.old-deja/g++.brendan/crash25.C: Adjust. * g++.old-deja/g++.brendan/crash56.C: Likewise. * g++.old-deja/g++.jason/access14.C: Likewise. * g++.old-deja/g++.jason/access8.C: Likewise. * g++.old-deja/g++.jason/access1.C: Likewise. * g++.old-deja/g++.other/access3.C: Likewise. * g++.old-deja/g++.other/access5.C: Likewise. * g++.old-deja/g++.law/unsorted1.C: Likewise. * g++.old-deja/g++.law/visibility22.C: Likewise. * g++.old-deja/g++.law/visibility26.C: Likewise. * g++.old-deja/g++.mike/p2746.C: Likewise. * g++.dg/debug/using1.C: Likewise. * g++.dg/lookup/using51.C: Likewise. * g++.dg/inherit/using5.C: Likewise. * g++.dg/inherit/pr30297.C: Likewise. * g++.dg/inherit/access8.C: Likewise. * g++.dg/torture/pr39362.C: Likewise. * g++.dg/template/crash13.C: Likewise. * g++.dg/template/using10.C: Likewise. gcc/cp/ChangeLog 2011-12-31 Fabien Chene <fabien@gcc.gnu.org> * parser.c (cp_parser_using_declaration): Add a warning about deprecated access declarations when no errors were encountered while parsing the access declaration. Save the first token in order to emit the warning at the right place. From-SVN: r182772
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/parser.c15
2 files changed, 20 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 5065989..3d2c5de 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2011-12-31 Fabien Chêne <fabien@gcc.gnu.org>
+
+ * parser.c (cp_parser_using_declaration): Add a warning about
+ deprecated access declarations when no errors were encountered
+ while parsing the access declaration. Save the first token in
+ order to emit the warning at the right place.
+
2011-12-31 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51397
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index d4947e7..0f5bb8e 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -14887,9 +14887,14 @@ cp_parser_using_declaration (cp_parser* parser,
tree decl;
tree identifier;
tree qscope;
+ int oldcount = errorcount;
+ cp_token *diag_token = NULL;
if (access_declaration_p)
- cp_parser_parse_tentatively (parser);
+ {
+ diag_token = cp_lexer_peek_token (parser->lexer);
+ cp_parser_parse_tentatively (parser);
+ }
else
{
/* Look for the `using' keyword. */
@@ -15000,7 +15005,13 @@ cp_parser_using_declaration (cp_parser* parser,
/* Look for the final `;'. */
cp_parser_require (parser, CPP_SEMICOLON, RT_SEMICOLON);
-
+
+ if (access_declaration_p && errorcount == oldcount)
+ warning_at (diag_token->location, OPT_Wdeprecated,
+ "access declarations are deprecated "
+ "in favour of using-declarations; "
+ "suggestion: add the %<using%> keyword");
+
return true;
}