summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/warn-write-strings.c
Commit message (Collapse)AuthorAgeFilesLines
* There were some frustrating problems with the implementation ofChandler Carruth2011-04-231-1/+1
| | | | | | | | | | | | | | | | | | | | -Wwrite-strings. First and foremost, once the positive form of the flag was passed, it could never be disabled by passing -Wno-write-strings. Also, the diagnostic engine couldn't in turn use -Wwrite-strings to control diagnostics (as GCC does) because it was essentially hijacked to drive the language semantics. Fix this by giving CC1 a clean '-fconst-strings' flag to enable const-qualified strings in C and ObjC compilations. Corresponding '-fno-const-strings' is also added. Then the driver is taught to introduce '-fconst-strings' in the CC1 command when '-Wwrite-strings' dominates. This entire flag is basically GCC-bug-compatibility driven, so we also match GCC's bug where '-w' doesn't actually disable -Wwrite-strings. I'm open to changing this though as it seems insane. llvm-svn: 130051
* fix PR7192 by defining wchar_t in a more conventional way. TheChris Lattner2010-09-051-0/+6
| | | | | | type of L"x" can change based on command line arguments. llvm-svn: 113127
* make clang print types as "const int *" instead of "int const*",Chris Lattner2010-09-051-1/+1
| | | | | | | which is should have done from the beginning. As usual, the most fun with this sort of change is updating all the testcases. llvm-svn: 113090
* Improve diagnostics like "initializing <type> from an expression ofDouglas Gregor2010-04-091-1/+1
| | | | | | | type..." with "initializing <type> with an expression of type...", which reads better. Thanks to John for the improved wording. llvm-svn: 100873
* Improve diagnostics when we fail to convert from a source type to aDouglas Gregor2010-04-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | destination type for initialization, assignment, parameter-passing, etc. The main issue fixed here is that we used rather confusing wording for diagnostics such as t.c:2:9: warning: initializing 'char const [2]' discards qualifiers, expected 'char *' [-pedantic] char *name = __func__; ^ ~~~~~~~~ We're not initializing a 'char const [2]', we're initializing a 'char *' with an expression of type 'char const [2]'. Similar problems existed for other diagnostics in this area, so I've normalized them all with more precise descriptive text to say what we're initializing/converting/assigning/etc. from and to. The warning for the code above is now: t.c:2:9: warning: initializing 'char *' from an expression of type 'char const [2]' discards qualifiers [-pedantic] char *name = __func__; ^ ~~~~~~~~ Fixes <rdar://problem/7447179>. llvm-svn: 100832
* Add support for -Wwrite-strings. Patch by Mike M! Fixes PR 4804.John McCall2010-03-151-0/+4
llvm-svn: 98541
OpenPOWER on IntegriCloud