c-ada-spec.h (cpp_operation): Add IS_CONSTEXPR.
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 8 Jul 2015 21:58:10 +0000 (21:58 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Wed, 8 Jul 2015 21:58:10 +0000 (21:58 +0000)
c-family/
* c-ada-spec.h (cpp_operation): Add IS_CONSTEXPR.
* c-ada-spec.c (print_ada_declaration): Skip constexpr constructors.
cp/
* decl2.c (cpp_check): Deal with IS_CONSTEXPR.

From-SVN: r225585

gcc/c-family/ChangeLog
gcc/c-family/c-ada-spec.c
gcc/c-family/c-ada-spec.h
gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/dump-ada-spec-9.C [new file with mode: 0644]

index 63d592ddc5649283414131cc1d865985c3192214..75e43fd7f09806bf53f8b9e6c531cdb30a90ae8f 100644 (file)
@@ -1,3 +1,8 @@
+2015-07-08  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * c-ada-spec.h (cpp_operation): Add IS_CONSTEXPR.
+       * c-ada-spec.c (print_ada_declaration): Skip constexpr constructors.
+
 2015-07-08  Jakub Jelinek  <jakub@redhat.com>
 
        * c-omp.c (c_omp_declare_simd_clauses_to_numbers): If all clauses
index 38a8fb266ac040ea911c1d6c0be79e4d8d6a0fb1..be8ef244b96089f12d97c65d425949cd38b5d86e 100644 (file)
@@ -2887,6 +2887,7 @@ print_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc)
       bool is_method = TREE_CODE (TREE_TYPE (t)) == METHOD_TYPE;
       tree decl_name = DECL_NAME (t);
       bool is_abstract = false;
+      bool is_constexpr = false;
       bool is_constructor = false;
       bool is_destructor = false;
       bool is_copy_constructor = false;
@@ -2898,6 +2899,7 @@ print_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc)
       if (cpp_check)
        {
          is_abstract = cpp_check (t, IS_ABSTRACT);
+         is_constexpr = cpp_check (t, IS_CONSTEXPR);
          is_constructor = cpp_check (t, IS_CONSTRUCTOR);
          is_destructor = cpp_check (t, IS_DESTRUCTOR);
          is_copy_constructor = cpp_check (t, IS_COPY_CONSTRUCTOR);
@@ -2911,6 +2913,10 @@ print_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc)
 
       if (is_constructor || is_destructor)
        {
+         /* Skip constexpr default constructors.  */
+         if (is_constexpr)
+           return 0;
+
          /* Only consider constructors/destructors for complete objects.  */
          if (strncmp (IDENTIFIER_POINTER (decl_name), "__comp", 6) != 0)
            return 0;
index 08d268573c7b0b0a4459f312f9a114e68e4879c7..116ac0bb64477623f2aa173f91416e12c1667115 100644 (file)
@@ -27,6 +27,7 @@ along with GCC; see the file COPYING3.  If not see
 typedef enum {
   HAS_DEPENDENT_TEMPLATE_ARGS,
   IS_ABSTRACT,
+  IS_CONSTEXPR,
   IS_CONSTRUCTOR,
   IS_DESTRUCTOR,
   IS_COPY_CONSTRUCTOR,
index 74b746a53982576e5d1ecef6ab9f5ccfc0de7c03..b6cca3ade33c1b9051390f2519aaec3559026f8b 100644 (file)
@@ -1,3 +1,7 @@
+2015-07-08  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * decl2.c (cpp_check): Deal with IS_CONSTEXPR.
+
 2015-07-08  Jakub Jelinek  <jakub@redhat.com>
 
        * decl.c (grokfndecl): Handle flag_openmp_simd like flag_openmp.
index cac0508f881af2e0cd21a135b6d594787d30b328..a1446c25cb8a4fa2388b7ddedde4a9bf1c7d513f 100644 (file)
@@ -4070,6 +4070,8 @@ cpp_check (tree t, cpp_operation op)
        }
       case IS_ABSTRACT:
        return DECL_PURE_VIRTUAL_P (t);
+      case IS_CONSTEXPR:
+       return DECL_DECLARED_CONSTEXPR_P (t);
       case IS_CONSTRUCTOR:
        return DECL_CONSTRUCTOR_P (t);
       case IS_DESTRUCTOR:
index d883a7c8406e4ec1243f78819ee83b036da97817..d2d51ae0ac56f09749828c438184b17aa0df1f18 100644 (file)
@@ -1,3 +1,7 @@
+2015-07-08  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * g++.dg/other/dump-ada-spec-9.C: New test.
+
 2015-07-08  Jakub Jelinek  <jakub@redhat.com>
 
        * g++.dg/vect/vect.exp: Run also simd* tests.
diff --git a/gcc/testsuite/g++.dg/other/dump-ada-spec-9.C b/gcc/testsuite/g++.dg/other/dump-ada-spec-9.C
new file mode 100644 (file)
index 0000000..6387c81
--- /dev/null
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-ada-spec" } */
+
+class Base {
+  public:
+     virtual void Primitive ();
+
+};
+
+void Base::Primitive () {
+
+}
+
+void Dispatch (Base * B) {
+  B->Primitive ();
+}
+
+/* { dg-final { scan-ada-spec-not "CPP_Constructor" } } */
+/* { dg-final { cleanup-ada-spec } } */