public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* C++ PATCH to abi_tag on class template
@ 2014-08-08 18:17 Jason Merrill
  2014-08-08 18:30 ` Jakub Jelinek
  0 siblings, 1 reply; 2+ messages in thread
From: Jason Merrill @ 2014-08-08 18:17 UTC (permalink / raw)
  To: gcc-patches List, Jonathan Wakely

[-- Attachment #1: Type: text/plain, Size: 87 bytes --]

Oddly, this case wasn't tested before.

Tested x86_64-pc-linux-gnu, applying to trunk.

[-- Attachment #2: tmpl-tag.patch --]
[-- Type: text/x-patch, Size: 1185 bytes --]

commit b5879e54d61597e2255fd6a25affcb24862f2844
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Aug 8 10:16:43 2014 -0400

    	* pt.c (lookup_template_class_1): Copy abi_tag.

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 30d8950..2592172 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -7813,6 +7813,12 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context,
 	    }
 	}
 
+      if (OVERLOAD_TYPE_P (t)
+	  && !DECL_ALIAS_TEMPLATE_P (gen_tmpl))
+	if (tree attributes
+	    = lookup_attribute ("abi_tag", TYPE_ATTRIBUTES (template_type)))
+	  TYPE_ATTRIBUTES (t) = attributes;
+
       /* Let's consider the explicit specialization of a member
          of a class template specialization that is implicitly instantiated,
 	 e.g.:
diff --git a/gcc/testsuite/g++.dg/abi/abi-tag8.C b/gcc/testsuite/g++.dg/abi/abi-tag8.C
new file mode 100644
index 0000000..0a6eb58
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/abi-tag8.C
@@ -0,0 +1,9 @@
+// { dg-options "-Wabi-tag" }
+
+template<class T>
+struct __attribute ((__abi_tag__("cxx11"))) list // { dg-message "list" }
+{ };
+
+struct X {			// { dg-warning "abi tag" }
+  list<int> l;			// { dg-message "X::l" }
+};

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: C++ PATCH to abi_tag on class template
  2014-08-08 18:17 C++ PATCH to abi_tag on class template Jason Merrill
@ 2014-08-08 18:30 ` Jakub Jelinek
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Jelinek @ 2014-08-08 18:30 UTC (permalink / raw)
  To: Jason Merrill; +Cc: gcc-patches List, Jonathan Wakely

On Fri, Aug 08, 2014 at 02:17:04PM -0400, Jason Merrill wrote:
> --- a/gcc/cp/pt.c
> +++ b/gcc/cp/pt.c
> @@ -7813,6 +7813,12 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context,
>  	    }
>  	}
>  
> +      if (OVERLOAD_TYPE_P (t)
> +	  && !DECL_ALIAS_TEMPLATE_P (gen_tmpl))
> +	if (tree attributes
> +	    = lookup_attribute ("abi_tag", TYPE_ATTRIBUTES (template_type)))
> +	  TYPE_ATTRIBUTES (t) = attributes;

Doesn't this copy the first abi_tag attribute and all following attributes
in the chain?  If other attributes are possible at this point, shouldn't the
above be done only if TYPE_CHAIN (attributes) == NULL_TREE and otherwise
(perhaps in a loop) copy each abi_tag attribute individually?

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-08-08 18:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-08 18:17 C++ PATCH to abi_tag on class template Jason Merrill
2014-08-08 18:30 ` Jakub Jelinek

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).