On Tue, 1 Sep 2026, Martin Uecker wrote: > > I think -Wwrite-strings has been around for so long with its current > > semantics that it should be considered a semantic option that changes the > > type of string literals, despite its -W name; anything that does not > > change the type should be named differently. (This does not prevent > > giving more precise diagnostics with -Wwrite-strings in the specific case > > of string literals, as long as they are consistent with still having > > const-qualified types - for example, as long as they remain pedwarns and > > typeof produces the const-qualified types.) > > How about doing it the other way around: Instead of > -fconst-string-literals turning on -Wwrite-strings we > have -Wwrite-strings turn on -fconst-string-literals? Then the > behavior with just -Wwrite-strings remains the same as it always > was, but one can independently toggle it using > -fconst-string-literals (which then overwrites the default)?
That seems reasonable (thus, with -Wwrite-strings -fno-const-string-literals as being the pure warning that does not change types and produces warnings rather than pedwarns). -- Joseph S. Myers [email protected]
