* Adjust -fdump-ada-spec to C++14 switch (2)
@ 2015-07-08 21:59 Eric Botcazou
2015-07-10 19:20 ` Eric Botcazou
0 siblings, 1 reply; 2+ messages in thread
From: Eric Botcazou @ 2015-07-08 21:59 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 472 bytes --]
We need to skip the constexpr default constructors.
Tested on x86_64-suse-linux, applied on the mainline as obvious.
2015-07-08 Eric Botcazou <ebotcazou@adacore.com>
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.
2015-07-08 Eric Botcazou <ebotcazou@adacore.com>
* g++.dg/other/dump-ada-spec-9.C: New test.
--
Eric Botcazou
[-- Attachment #2: p.diff --]
[-- Type: text/x-patch, Size: 2040 bytes --]
Index: c-family/c-ada-spec.h
===================================================================
--- c-family/c-ada-spec.h (revision 225533)
+++ c-family/c-ada-spec.h (working copy)
@@ -27,6 +27,7 @@ along with GCC; see the file COPYING3.
typedef enum {
HAS_DEPENDENT_TEMPLATE_ARGS,
IS_ABSTRACT,
+ IS_CONSTEXPR,
IS_CONSTRUCTOR,
IS_DESTRUCTOR,
IS_COPY_CONSTRUCTOR,
Index: c-family/c-ada-spec.c
===================================================================
--- c-family/c-ada-spec.c (revision 225533)
+++ c-family/c-ada-spec.c (working copy)
@@ -2887,6 +2887,7 @@ print_ada_declaration (pretty_printer *b
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 *b
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 *b
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: cp/decl2.c
===================================================================
--- cp/decl2.c (revision 225533)
+++ cp/decl2.c (working copy)
@@ -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:
[-- Attachment #3: dump-ada-spec-9.C --]
[-- Type: text/x-c++src, Size: 302 bytes --]
/* { 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 } } */
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Adjust -fdump-ada-spec to C++14 switch (2)
2015-07-08 21:59 Adjust -fdump-ada-spec to C++14 switch (2) Eric Botcazou
@ 2015-07-10 19:20 ` Eric Botcazou
0 siblings, 0 replies; 2+ messages in thread
From: Eric Botcazou @ 2015-07-10 19:20 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 484 bytes --]
> We need to skip the constexpr default constructors.
That's actually not sufficient so I have installed the attached patch instead.
Tested on x86_64-suse-linux, applied on the mainline as obvious.
2015-07-10 Eric Botcazou <ebotcazou@adacore.com>
c-family/
* c-ada-spec.h (cpp_operation): Revert latest change.
* c-ada-spec.c (print_ada_declaration): Likewise. Skip implicit
constructors and destructors.
cp/
* decl2.c (cpp_check): Revert latest change.
--
Eric Botcazou
[-- Attachment #2: p.diff --]
[-- Type: text/x-patch, Size: 2577 bytes --]
Index: c-family/c-ada-spec.h
===================================================================
--- c-family/c-ada-spec.h (revision 225585)
+++ c-family/c-ada-spec.h (working copy)
@@ -27,7 +27,6 @@ along with GCC; see the file COPYING3.
typedef enum {
HAS_DEPENDENT_TEMPLATE_ARGS,
IS_ABSTRACT,
- IS_CONSTEXPR,
IS_CONSTRUCTOR,
IS_DESTRUCTOR,
IS_COPY_CONSTRUCTOR,
Index: c-family/c-ada-spec.c
===================================================================
--- c-family/c-ada-spec.c (revision 225585)
+++ c-family/c-ada-spec.c (working copy)
@@ -2887,7 +2887,6 @@ print_ada_declaration (pretty_printer *b
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;
@@ -2899,7 +2898,6 @@ print_ada_declaration (pretty_printer *b
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);
@@ -2913,8 +2911,8 @@ print_ada_declaration (pretty_printer *b
if (is_constructor || is_destructor)
{
- /* Skip constexpr default constructors. */
- if (is_constexpr)
+ /* ??? Skip implicit constructors/destructors for now. */
+ if (DECL_ARTIFICIAL (t))
return 0;
/* Only consider constructors/destructors for complete objects. */
@@ -3050,9 +3048,12 @@ print_ada_declaration (pretty_printer *b
if (num_fields == 1)
is_interface = 1;
- /* Also check that there are only virtual methods. */
+ /* Also check that there are only pure virtual methods. Since the
+ class is empty, we can skip implicit constructors/destructors. */
for (tmp = TYPE_METHODS (TREE_TYPE (t)); tmp; tmp = TREE_CHAIN (tmp))
{
+ if (DECL_ARTIFICIAL (tmp))
+ continue;
if (cpp_check (tmp, IS_ABSTRACT))
is_abstract_record = 1;
else
Index: cp/decl2.c
===================================================================
--- cp/decl2.c (revision 225585)
+++ cp/decl2.c (working copy)
@@ -4070,8 +4070,6 @@ 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:
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-07-10 19:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-08 21:59 Adjust -fdump-ada-spec to C++14 switch (2) Eric Botcazou
2015-07-10 19:20 ` Eric Botcazou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).