aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/warn-write-strings.c
AgeCommit message (Collapse)Author
2011-04-23There were some frustrating problems with the implementation ofChandler Carruth
-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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130051 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-05fix PR7192 by defining wchar_t in a more conventional way. TheChris Lattner
type of L"x" can change based on command line arguments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113127 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-05make clang print types as "const int *" instead of "int const*",Chris Lattner
which is should have done from the beginning. As usual, the most fun with this sort of change is updating all the testcases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113090 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09Improve diagnostics like "initializing <type> from an expression ofDouglas Gregor
type..." with "initializing <type> with an expression of type...", which reads better. Thanks to John for the improved wording. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100873 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-09Improve diagnostics when we fail to convert from a source type to aDouglas Gregor
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>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100832 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-15Add support for -Wwrite-strings. Patch by Mike M! Fixes PR 4804.John McCall
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98541 91177308-0d34-0410-b5e6-96231b3b80d8