This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Adjust -fdump-ada-spec to C++14 switch


The Ada side doesn't know what to do with the move constructors of C++11 so 
the attached patch makes -fdump-ada-spec skip them.

Tested on x86_64-suse-linux, applied on the mainline as obvious.


2015-07-07  Eric Botcazou  <ebotcazou@adacore.com>

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.


2015-07-07  Eric Botcazou  <ebotcazou@adacore.com>

	* g++.dg/other/dump-ada-spec-8.C: New test.

-- 
Eric Botcazou
Index: c-family/c-ada-spec.h
===================================================================
--- c-family/c-ada-spec.h	(revision 225410)
+++ c-family/c-ada-spec.h	(working copy)
@@ -30,6 +30,7 @@ typedef enum {
   IS_CONSTRUCTOR,
   IS_DESTRUCTOR,
   IS_COPY_CONSTRUCTOR,
+  IS_MOVE_CONSTRUCTOR,
   IS_TEMPLATE,
   IS_TRIVIAL
 } cpp_operation;
Index: c-family/c-ada-spec.c
===================================================================
--- c-family/c-ada-spec.c	(revision 225410)
+++ c-family/c-ada-spec.c	(working copy)
@@ -2891,6 +2891,7 @@ print_ada_declaration (pretty_printer *b
       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 *b
 	  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)
Index: cp/decl2.c
===================================================================
--- cp/decl2.c	(revision 225410)
+++ cp/decl2.c	(working copy)
@@ -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:
/* { dg-do compile } */
/* { dg-options "-fdump-ada-spec" } */

template<class T, class U> class Generic_Array
{
  Generic_Array();
};

template class Generic_Array<char, int>;

/* { dg-final { scan-ada-spec-not "access Generic_Array" } } */
/* { dg-final { cleanup-ada-spec } } */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]