aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorPierre-Marie de Rodat <derodat@adacore.com>2015-06-22 19:16:58 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2015-06-22 19:16:58 +0000
commitc6a2f2d98d666f3d4ddd1e49e0f794da0410ac5c (patch)
treec497bf6f8e2455a359a6622c01e4cc1045a02da5 /gcc/c-family
parenta42e72d1d26d9ffedaa0bcdfec8a058f9d5ad474 (diff)
downloadgcc-c6a2f2d98d666f3d4ddd1e49e0f794da0410ac5c.zip
gcc-c6a2f2d98d666f3d4ddd1e49e0f794da0410ac5c.tar.gz
gcc-c6a2f2d98d666f3d4ddd1e49e0f794da0410ac5c.tar.bz2
c-ada-spec.h (cpp_operation): Add HAS_DEPENDENT_TEMPLATE_ARGS.
c-family/ * c-ada-spec.h (cpp_operation): Add HAS_DEPENDENT_TEMPLATE_ARGS. * c-ada-spec.c (collect_ada_nodes): Skip NAMESPACE_DECL (dump_ada_template): Skip partially specialized types. cp/ * decl2.c (cpp_check): Deal with HAS_DEPENDENT_TEMPLATE_ARGS. From-SVN: r224754
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/ChangeLog6
-rw-r--r--gcc/c-family/c-ada-spec.c17
-rw-r--r--gcc/c-family/c-ada-spec.h1
3 files changed, 20 insertions, 4 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 39de58a..a721ab5 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,9 @@
+2015-06-22 Pierre-Marie de Rodat <derodat@adacore.com>
+
+ * c-ada-spec.h (cpp_operation): Add HAS_DEPENDENT_TEMPLATE_ARGS.
+ * c-ada-spec.c (collect_ada_nodes): Skip NAMESPACE_DECL
+ (dump_ada_template): Skip partially specialized types.
+
2015-06-22 Mikhail Maltsev <maltsevm@gmail.com>
* c-common.c (scalar_to_vector): Use std::swap instead of manually
diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c
index 85db5e3..ab29f86 100644
--- a/gcc/c-family/c-ada-spec.c
+++ b/gcc/c-family/c-ada-spec.c
@@ -593,9 +593,12 @@ collect_ada_nodes (tree t, const char *source_file)
tree n;
int i = to_dump_count;
- /* Count the likely relevant nodes. */
+ /* Count the likely relevant nodes: do not dump builtins (they are irrelevant
+ in the context of bindings) and namespaces (we do not handle them properly
+ yet). */
for (n = t; n; n = TREE_CHAIN (n))
if (!DECL_IS_BUILTIN (n)
+ && TREE_CODE (n) != NAMESPACE_DECL
&& LOCATION_FILE (decl_sloc (n, false)) == source_file)
to_dump_count++;
@@ -605,6 +608,7 @@ collect_ada_nodes (tree t, const char *source_file)
/* Store the relevant nodes. */
for (n = t; n; n = TREE_CHAIN (n))
if (!DECL_IS_BUILTIN (n)
+ && TREE_CODE (n) != NAMESPACE_DECL
&& LOCATION_FILE (decl_sloc (n, false)) == source_file)
to_dump[i++] = n;
}
@@ -1745,7 +1749,7 @@ dump_ada_template (pretty_printer *buffer, tree t, int spc)
!= LOCATION_FILE (decl_sloc (t, false)))
return 0;
- while (inst && inst != error_mark_node)
+ for (; inst && inst != error_mark_node; inst = TREE_CHAIN (inst))
{
tree types = TREE_PURPOSE (inst);
tree instance = TREE_VALUE (inst);
@@ -1756,6 +1760,13 @@ dump_ada_template (pretty_printer *buffer, tree t, int spc)
if (!RECORD_OR_UNION_TYPE_P (instance) || !TYPE_METHODS (instance))
break;
+ /* We are interested in concrete template instantiations only: skip
+ partially specialized nodes. */
+ if ((TREE_CODE (instance) == RECORD_TYPE
+ || TREE_CODE (instance) == UNION_TYPE)
+ && cpp_check && cpp_check (instance, HAS_DEPENDENT_TEMPLATE_ARGS))
+ continue;
+
num_inst++;
INDENT (spc);
pp_string (buffer, "package ");
@@ -1791,8 +1802,6 @@ dump_ada_template (pretty_printer *buffer, tree t, int spc)
pp_semicolon (buffer);
pp_newline (buffer);
pp_newline (buffer);
-
- inst = TREE_CHAIN (inst);
}
return num_inst > 0;
diff --git a/gcc/c-family/c-ada-spec.h b/gcc/c-family/c-ada-spec.h
index 32fcaf9..e922968 100644
--- a/gcc/c-family/c-ada-spec.h
+++ b/gcc/c-family/c-ada-spec.h
@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see
/* In c-ada-spec.c */
typedef enum {
+ HAS_DEPENDENT_TEMPLATE_ARGS,
IS_ABSTRACT,
IS_CONSTRUCTOR,
IS_DESTRUCTOR,