From 2a7fb83f490c86f530efe5a83f720c95e03f883d Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Tue, 7 Jul 2015 20:13:59 +0000 Subject: [PATCH] c-ada-spec.h (cpp_operation): Add IS_MOVE_CONSTRUCTOR. c-family/ * c-ada-spec.h (cpp_operation): Add IS_MOVE_CONSTRUCTOR. * c-ada-spec.c (print_ada_declaration): Skip move constructors. cp/ * decl2.c (cpp_check): Deal with IS_MOVE_CONSTRUCTOR. From-SVN: r225525 --- gcc/c-family/ChangeLog | 5 +++++ gcc/c-family/c-ada-spec.c | 8 +++++--- gcc/c-family/c-ada-spec.h | 1 + gcc/cp/ChangeLog | 4 ++++ gcc/cp/decl2.c | 2 ++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/other/dump-ada-spec-8.C | 12 ++++++++++++ 7 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/other/dump-ada-spec-8.C diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 49f33d6357a..f2b923f0df3 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,8 @@ +2015-07-07 Eric Botcazou + + * c-ada-spec.h (cpp_operation): Add IS_MOVE_CONSTRUCTOR. + * c-ada-spec.c (print_ada_declaration): Skip move constructors. + 2015-07-01 Jason Merrill * c-common.h (D_CXX11): Rename from D_CXX0X. diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c index 41d612fc467..abe22d7f92a 100644 --- a/gcc/c-family/c-ada-spec.c +++ b/gcc/c-family/c-ada-spec.c @@ -2891,6 +2891,7 @@ print_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc) bool is_constructor = false; bool is_destructor = false; bool is_copy_constructor = false; + bool is_move_constructor = false; if (!decl_name) return 0; @@ -2901,11 +2902,12 @@ print_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc) is_constructor = cpp_check (t, IS_CONSTRUCTOR); is_destructor = cpp_check (t, IS_DESTRUCTOR); is_copy_constructor = cpp_check (t, IS_COPY_CONSTRUCTOR); + is_move_constructor = cpp_check (t, IS_MOVE_CONSTRUCTOR); } - /* Skip copy constructors: some are internal only, and those that are - not cannot be called easily from Ada anyway. */ - if (is_copy_constructor) + /* Skip copy constructors and C++11 move constructors: some are internal + only and those that are not cannot be called easily from Ada. */ + if (is_copy_constructor || is_move_constructor) return 0; if (is_constructor || is_destructor) diff --git a/gcc/c-family/c-ada-spec.h b/gcc/c-family/c-ada-spec.h index e922968626f..08d268573c7 100644 --- a/gcc/c-family/c-ada-spec.h +++ b/gcc/c-family/c-ada-spec.h @@ -30,6 +30,7 @@ typedef enum { IS_CONSTRUCTOR, IS_DESTRUCTOR, IS_COPY_CONSTRUCTOR, + IS_MOVE_CONSTRUCTOR, IS_TEMPLATE, IS_TRIVIAL } cpp_operation; diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ee9402ee0d6..f393a232802 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2015-07-07 Eric Botcazou + + * decl2.c (cpp_check): Deal with IS_MOVE_CONSTRUCTOR. + 2015-07-06 Jason Merrill * pt.c (reduce_template_parm_level): Also build the TYPE_DECL diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 0332aa239a4..cd43e62a84c 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -4077,6 +4077,8 @@ cpp_check (tree t, cpp_operation op) return DECL_DESTRUCTOR_P (t); case IS_COPY_CONSTRUCTOR: return DECL_COPY_CONSTRUCTOR_P (t); + case IS_MOVE_CONSTRUCTOR: + return DECL_MOVE_CONSTRUCTOR_P (t); case IS_TEMPLATE: return TREE_CODE (t) == TEMPLATE_DECL; case IS_TRIVIAL: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ca13429495f..57705bcc915 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-07-07 Eric Botcazou + + * g++.dg/other/dump-ada-spec-8.C: New test. + 2015-07-07 David Malcolm PR jit/66783 diff --git a/gcc/testsuite/g++.dg/other/dump-ada-spec-8.C b/gcc/testsuite/g++.dg/other/dump-ada-spec-8.C new file mode 100644 index 00000000000..f687405dbb7 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/dump-ada-spec-8.C @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-ada-spec" } */ + +template class Generic_Array +{ + Generic_Array(); +}; + +template class Generic_Array; + +/* { dg-final { scan-ada-spec-not "access Generic_Array" } } */ +/* { dg-final { cleanup-ada-spec } } */ -- 2.30.2