This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH v2][RFC] Canonize names of attributes.
- From: Jason Merrill <jason at redhat dot com>
- To: Martin Liška <mliska at suse dot cz>
- Cc: Joseph Myers <joseph at codesourcery dot com>, gcc-patches List <gcc-patches at gcc dot gnu dot org>, Richard Biener <richard dot guenther at gmail dot com>
- Date: Wed, 2 Aug 2017 15:42:05 -0400
- Subject: Re: [PATCH v2][RFC] Canonize names of attributes.
- Authentication-results: sourceware.org; auth=none
- References: <d34360a3-c245-7525-03e7-99a9ba8830e6@suse.cz> <CADzB+2mSLts01iKWZQ-dzZCEjZA-wX96_OHhd-6dmf4PrLVBNQ@mail.gmail.com> <1856059e-e9b1-63d2-717f-e20ec171b329@suse.cz> <alpine.DEB.2.20.1706281605270.25698@digraph.polyomino.org.uk> <CADzB+2nMBvm3vxJ59uCmVJpZEgrf3W6q17Q=DD9uhUbzeTvpDg@mail.gmail.com> <4cf00ee9-4cd7-1806-481f-966611768a15@suse.cz> <CADzB+2my3MZap45Bpb_sH7=j+JsBf2R2+S+7ETDdSW8yhBmDRA@mail.gmail.com> <8a0b2ff0-50f9-771d-fb63-01d17cb06b46@suse.cz> <CADzB+2=o6Wr1jyhk3P2JNYP92B0W6iLcZdgcb8GK3hdMTSjW4Q@mail.gmail.com> <669c960e-f4a8-eae3-efd2-f8c29477a817@suse.cz> <CADzB+2kHe_XW-7jqLNJN5RHgVp2y4TsrK_387yaFb8qSpQY1RA@mail.gmail.com> <e3bb65b3-38f7-08d1-05ab-629fdd9affc3@suse.cz>
OK.
On Thu, Jul 13, 2017 at 9:48 AM, Martin Liška <mliska@suse.cz> wrote:
> On 07/11/2017 05:52 PM, Jason Merrill wrote:
>> On Tue, Jul 11, 2017 at 9:37 AM, Martin Liška <mliska@suse.cz> wrote:
>>> On 07/03/2017 11:00 PM, Jason Merrill wrote:
>>>> On Mon, Jul 3, 2017 at 5:52 AM, Martin Liška <mliska@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 <mliska@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?
>>
>> This is canonicalizing arguments by default; I want the default to be
>> not canonicalizing arguments. I think we only want to canonicalize
>> arguments for format and mode, and we can do that in their handle_*
>> functions.
>
> Yep, done that in v3. I decided to move couple of functions to attribs.h and
> verified that it will not cause binary size increase of cc1 and cc1plus.
>
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
>
> Ready to be installed?
> Martin
>
>>
>> Jason
>>
>