http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59870
--- Comment #6 from Chengnian Sun <chengniansun at gmail dot com> --- (In reply to Harald van Dijk from comment #2) > The type of a string literal in C is char[N], unlike in C++ where it is > const char[N]. clang's -Weverything option enables -Wwrite-strings, which > changes the type const char[N] and because of that makes the compiler not > conform to the C standard. The same -Wwrite-strings option also exists in > GCC already (in fact, I would be surprised if clang's name for the option > didn't come from GCC), so I don't think there's anything in GCC that needs > changing. > > $ gcc -Wwrite-strings test.c > test.c: In function ‘main’: > test.c:4:19: warning: initialization discards ‘const’ qualifier from pointer > target type [enabled by default] > char* s = "test"; > ^ Yes, this option works. However, one more question. Does "[enabled by default]" imply that this type of warnings is enabled by default? If yes, then it is inconsistent with the current setting of GCC flags (i.e., this flag should be explicitly enabled).