diff mbox series

teach gengtype about 'mutable'

Message ID 02a4709b-e20f-bb5d-1fd4-a216e3d627e9@acm.org
State New
Headers show
Series teach gengtype about 'mutable' | expand

Commit Message

Nathan Sidwell Oct. 13, 2019, 2:45 p.m. UTC
In constifying some more of line-map I discovered gengtype didn't know mutable. 
Added thusly.

nathan

Comments

Richard Biener Oct. 14, 2019, 11:16 a.m. UTC | #1
On Sun, Oct 13, 2019 at 4:45 PM Nathan Sidwell <nathan@acm.org> wrote:
>
> In constifying some more of line-map I discovered gengtype didn't know mutable.
> Added thusly.

mutable is bad.  Why do you want to use it?

> nathan
>
> --
> Nathan Sidwell
Nathan Sidwell Oct. 14, 2019, 12:09 p.m. UTC | #2
On 10/14/19 7:16 AM, Richard Biener wrote:
> On Sun, Oct 13, 2019 at 4:45 PM Nathan Sidwell <nathan@acm.org> wrote:
>>
>> In constifying some more of line-map I discovered gengtype didn't know mutable.
>> Added thusly.
> 
> mutable is bad.  Why do you want to use it?

the line map info has a caching field.

mutable is part of c++ 98

nathan
Jeff Law Oct. 14, 2019, 7:46 p.m. UTC | #3
On 10/14/19 6:09 AM, Nathan Sidwell wrote:
> On 10/14/19 7:16 AM, Richard Biener wrote:
>> On Sun, Oct 13, 2019 at 4:45 PM Nathan Sidwell <nathan@acm.org> wrote:
>>>
>>> In constifying some more of line-map I discovered gengtype didn't
>>> know mutable.
>>> Added thusly.
>>
>> mutable is bad.  Why do you want to use it?
> 
> the line map info has a caching field.
Isn't that in fact a classic use case for mutable?


Seems like it's the right thing to do to me...

jeff
Nathan Sidwell Oct. 14, 2019, 8:09 p.m. UTC | #4
On 10/14/19 3:46 PM, Jeff Law wrote:
> On 10/14/19 6:09 AM, Nathan Sidwell wrote:
>> On 10/14/19 7:16 AM, Richard Biener wrote:
>>> On Sun, Oct 13, 2019 at 4:45 PM Nathan Sidwell <nathan@acm.org> wrote:
>>>>
>>>> In constifying some more of line-map I discovered gengtype didn't
>>>> know mutable.
>>>> Added thusly.
>>>
>>> mutable is bad.  Why do you want to use it?
>>
>> the line map info has a caching field.
> Isn't that in fact a classic use case for mutable?

Indeed it is.  I'm curious as to the 'mutable is bad' origin.  Is it 
similar to 'goto is bad'?

nathan
Richard Biener Oct. 15, 2019, 9:21 a.m. UTC | #5
Yes, it is. :)

On Mon, Oct 14, 2019 at 10:09 PM Nathan Sidwell <nathan@acm.org> wrote:
>
> On 10/14/19 3:46 PM, Jeff Law wrote:
> > On 10/14/19 6:09 AM, Nathan Sidwell wrote:
> >> On 10/14/19 7:16 AM, Richard Biener wrote:
> >>> On Sun, Oct 13, 2019 at 4:45 PM Nathan Sidwell <nathan@acm.org> wrote:
> >>>>
> >>>> In constifying some more of line-map I discovered gengtype didn't
> >>>> know mutable.
> >>>> Added thusly.
> >>>
> >>> mutable is bad.  Why do you want to use it?
> >>
> >> the line map info has a caching field.
> > Isn't that in fact a classic use case for mutable?
>
> Indeed it is.  I'm curious as to the 'mutable is bad' origin.  Is it
> similar to 'goto is bad'?
>
> nathan
>
>
> --
> Nathan Sidwell
diff mbox series

Patch

2019-10-13  Nathan Sidwell  <nathan@acm.org>

	* gengtype-lex.l (CXX_KEYWORD): Add 'mutable'.

Index: gcc/gengtype-lex.l
===================================================================
--- gcc/gengtype-lex.l	(revision 275726)
+++ gcc/gengtype-lex.l	(working copy)
@@ -58,7 +58,7 @@  ITYPE	{IWORD}({WS}{IWORD})*
     /* Include '::' in identifiers to capture C++ scope qualifiers.  */
 ID	{CID}({HWS}::{HWS}{CID})*
 EOID	[^[:alnum:]_]
-CXX_KEYWORD inline|public:|private:|protected:|template|operator|friend|static
+CXX_KEYWORD inline|public:|private:|protected:|template|operator|friend|static|mutable
 
 %x in_struct in_struct_comment in_comment
 %option warn noyywrap nounput nodefault perf-report