[cfe-commits] PFR: Shared string literals

Chris Lattner clattner at apple.com
Tue Nov 27 10:14:15 PST 2007

On Nov 27, 2007, at 9:30 AM, Devang Patel wrote:

> On Nov 27, 2007, at 1:23 AM, Oliver Hunt wrote:
>> Here's support for shared string literals, and -fwritable-string
>> (which causes us to not share literals and to not use constant
>> values for the literal storage)
> Many times, -fwritable-string is used due to historical reasons. It
> is very useful to have diagnostic that can accurately identify
> literals that are not shared and do not use constant values.

Yep, -fwritable-string is of questionable utility, but is needed by  
some code.

Unfortunately, you can't tell when this capability is being used, but  
obvious things like "foo"[4] = 1 do get diagnosed.  Perhaps Ted's  
checking infrastructure will eventually be useful for diagnosing  
other less obvious violations.

GCC makes a really horrible choice of changing the *type* of the  
string literal when -Wwritable-strings is specified.  IMO, warning  
options shouldn't change the AST that is being generated.


More information about the cfe-commits mailing list