https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119068
Bug ID: 119068
Summary: Should -Wwrite-strings be renamed to -fwrite-strings?
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: alx at kernel dot org
Target Milestone: ---
-f flags are meant to change the meaning of code, while -W flags are meant to
add diagnostics without changing the meaning of code.
-Wwrite-strings is an oddity, since it does change the meaning of code:
alx@debian:~/tmp$ cat ws.c
int
main(void)
{
return _Generic(&*"", const char *: 0, char *: 1);
}
alx@debian:~/tmp$ gcc -Wall -Wextra -Wwrite-strings ws.c
alx@debian:~/tmp$ ./a.out; echo $?
0
alx@debian:~/tmp$ gcc -Wall -Wextra -Wno-write-strings ws.c
alx@debian:~/tmp$ ./a.out; echo $?
1
alx@debian:~/tmp$ clang -Weverything -Wwrite-strings ws.c -Wno-pre-c11-compat
alx@debian:~/tmp$ ./a.out; echo $?
0
alx@debian:~/tmp$ clang -Weverything -Wno-write-strings ws.c
-Wno-pre-c11-compatalx@debian:~/tmp$ ./a.out; echo $?
1
Should we add -fwrite-strings, and keep -Wwrite-strings as a deprecated
synonym?