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