+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
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++;
/* 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;
}
!= 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);
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 ");
pp_semicolon (buffer);
pp_newline (buffer);
pp_newline (buffer);
-
- inst = TREE_CHAIN (inst);
}
return num_inst > 0;
/* In c-ada-spec.c */
typedef enum {
+ HAS_DEPENDENT_TEMPLATE_ARGS,
IS_ABSTRACT,
IS_CONSTRUCTOR,
IS_DESTRUCTOR,
+2015-06-22 Pierre-Marie de Rodat <derodat@adacore.com>
+
+ * decl2.c (cpp_check): Deal with HAS_DEPENDENT_TEMPLATE_ARGS.
+
2015-06-22 Paolo Carlini <paolo.carlini@oracle.com>
* decl.c (grokdeclarator): Use declspecs->locations[ds_virtual].
{
switch (op)
{
+ case HAS_DEPENDENT_TEMPLATE_ARGS:
+ {
+ tree ti = CLASSTYPE_TEMPLATE_INFO (t);
+ if (!ti)
+ return 0;
+ ++processing_template_decl;
+ const bool dep = any_dependent_template_arguments_p (TI_ARGS (ti));
+ --processing_template_decl;
+ return dep;
+ }
case IS_ABSTRACT:
return DECL_PURE_VIRTUAL_P (t);
case IS_CONSTRUCTOR:
+2015-06-22 Pierre-Marie de Rodat <derodat@adacore.com>
+
+ * g++.dg/other/dump-ada-spec-5.C: New test.
+ * g++.dg/other/dump-ada-spec-6.C: Likewise.
+ * g++.dg/other/dump-ada-spec-7.C: Likewise.
+
2015-06-22 Paolo Carlini <paolo.carlini@oracle.com>
* g++.dg/inherit/pure1.C: Test location too.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-fdump-ada-spec" } */
+
+namespace foo
+{
+ int bar = 0;
+}
+
+namespace bar = foo;
+
+/* { dg-final { cleanup-ada-spec } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-fdump-ada-spec" } */
+
+template<typename T, bool b> class Foo;
+
+template<typename T>
+class Foo<T, false>
+{
+public:
+ // This checks that we do not crash on static members from partially
+ // specialized class templates.
+ static int bar;
+
+ int f();
+};
+
+int func()
+{
+ Foo<int, false> f;
+ return f.f();
+}
+
+/* { dg-final { cleanup-ada-spec } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-fdump-ada-spec" } */
+
+template<int n>
+void bar ()
+{
+ return;
+}
+
+class Foo
+{
+ // This check that we properly skip the specification for templated
+ // members of non-templated classes.
+ template<int n>
+ void bar ();
+};
+
+template<int n>
+void Foo::bar ()
+{
+ return;
+}
+
+/* { dg-final { cleanup-ada-spec } } */