On 07/03/2017 11:00 PM, Jason Merrill wrote:
On Mon, Jul 3, 2017 at 5:52 AM, Martin Liška <mli...@suse.cz> wrote:
On 06/30/2017 09:34 PM, Jason Merrill wrote:
On Fri, Jun 30, 2017 at 5:23 AM, Martin Liška <mli...@suse.cz> wrote:
This is v2 of the patch, where just names of attributes are canonicalized.
Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

What is the purpose of the new "strict" parameter to cmp_attribs* ?  I
don't see any discussion of it.

It's needed for arguments of attribute names, like:

/usr/include/stdio.h:391:62: internal compiler error: in cmp_attribs, at 
tree.h:5523
       __THROWNL __attribute__ ((__format__ (__printf__, 3, 4)));


Mm.  Although we don't want to automatically canonicalize all
identifier arguments to attributes in the parser, we could still do it
for specific attributes, e.g. in handle_format_attribute or
handle_mode_attribute.

Yep, that was done in my previous version of the patch 
(https://gcc.gnu.org/ml/gcc-patches/2017-06/msg00996.html).
Where only attribute that was preserved unchanged was 'cleanup':

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 8f638785e0e..08b4db5e5bd 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -24765,7 +24765,8 @@ cp_parser_gnu_attribute_list (cp_parser* parser)
                  tree tv;
                  if (arguments != NULL_TREE
                      && ((tv = TREE_VALUE (arguments)) != NULL_TREE)
-                     && TREE_CODE (tv) == IDENTIFIER_NODE)
+                     && TREE_CODE (tv) == IDENTIFIER_NODE
+                     && !id_equal (TREE_PURPOSE (attribute), "cleanup"))
                    TREE_VALUE (arguments) = canonize_attr_name (tv);
                  release_tree_vector (vec);
                }

Does it work for you to do it so?

Martin


Jason


Reply via email to