This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: mutable members in global const objects
- To: nathan at cs dot bris dot ac dot uk
- Subject: Re: mutable members in global const objects
- From: Martin von Loewis <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Mon, 3 Aug 1998 22:35:35 +0200
- CC: egcs at cygnus dot com
- References: <35C586FE.1167@cs.bris.ac.uk>
> In summary, I'm not familiar enough with the internals of g++ to have a
> go at it. I would, however, be willing to have a go at option 3 and
> adding a language specific flag to tree_type, if someone could offer
> some guidance on how to proceed.
Looking at the various implementations of SELECT_SECTION, it seems
that they
a) contain a large amount of front-end code
b) are in various degrees of completion. I'd assume that versions
that check for more conditions (e.g. volatility, presence of
constructors) are most likely more recent than versions that do
not
So, I'd consider this whole thing a bug, and would propose a slightly
modified version of your option 1:
Move all the front-end code (i.e. the stuff dealing with initializers)
into a tree.c function, e.g. var_readonly_p. Then replace in all
SELECT_DECL implementations all that stuff with that function
(keeping, of course, platform specifics in the macro,
e.g. PIC). Finally, make the test platform specific; for cp, you'd
get
int lang_var_readonly_p(decl)
{
return var_readonly_p(decl) && has_no_mutables(decl);
}
You'd then actually call the lang_ version in the macros.
This is a major change, and would require quite some review. So if I'm
missing the obvious, please let us know.
Regards,
Martin