This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Removing -frwitable-strings
mark@codesourcery.com (Mark Mitchell) wrote on 18.12.03 in <1071789046.21686.215.camel@doubledemon.codesourcery.com>:
> I'm not sure how this actually works at present, but I don't think it
> works as you expect. I think the optimizers still assume that constants
> are constant, and I think that __builtin_strlen (for example) will still
> return a constant when given a string constant.
In any case, it seems that this option is typically only needed for very
few strings, used as an argument for mktemp() or mkstemp().
So whatever goes into the docs for deprecating or removing it, should
perhaps mention the possibility of fixing this via a macro, which is quite
possible in this limited case, especially if *all* mktemp/mkstemp
arguments are constant, as is quite likely.
For example,
#define mktemp(x) mktemp (({ char[] __filename = x; __filename; }))
#define mkstemp(x) mkstemp (({ char[] __filename = x; __filename; }))
(untested)
ought to do the job - it can't solve everything done with -fwritable-
strings, but it ought to solve the vast majority.
MfG Kai