aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Sema/conditional-expr.c
AgeCommit message (Collapse)AuthorFilesLines
2012-07-23Fix a typo (the the => the)Sylvestre Ledru1-1/+1
llvm-svn: 160622
2012-04-05Properly implement the C rules for composite types for qualified pointers in ↵Eli Friedman1-0/+17
conditionals. Patch by Tim Northover. llvm-svn: 154134
2011-07-21Remove warning for conditional operands of differend signedness from ↵Richard Trieu1-10/+15
-Wsign-compare. Cases that previously warn on this will have a different warning emitted from -Wsign-conversion. llvm-svn: 135664
2011-02-18Initial steps to improve diagnostics when there is a NULL andChandler Carruth1-0/+13
a non-pointer on the two sides of a conditional expression. Patch by Stephen Hines and Mihai Rusu. llvm-svn: 125995
2010-05-06Rearchitect -Wconversion and -Wsign-compare. Instead of computing themJohn McCall1-1/+8
"bottom-up" when implicit casts and comparisons are inserted, compute them "top-down" when the full expression is finished. Makes it easier to coordinate warnings and thus implement -Wconversion for signedness conversions without double-warning with -Wsign-compare. Also makes it possible to realize that a signedness conversion is okay because the context is performing the inverse conversion. Also simplifies some logic that was trying to calculate the ultimate comparison/result type and getting it wrong. Also fixes a problem with the C++ explicit casts which are often "implemented" in the AST with a series of implicit cast expressions. llvm-svn: 103174
2010-04-09Improve diagnostics when we fail to convert from a source type to aDouglas Gregor1-4/+4
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
2009-12-15Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar1-1/+1
- This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). llvm-svn: 91446
2009-11-06Turn off -Wsign-compare warnings by defaultDouglas Gregor1-1/+1
llvm-svn: 86233
2009-11-05Implement the conditional-operator part of -Wsign-compare. TurnJohn McCall1-0/+19
DiagnoseSignCompare into Sema::CheckSignCompare and call it from more places. Add some enumerator tests. These seem to expose some oddities in the types we're converting C++ enumerators to; in particular, they're converting to unsigned before int, which seems to contradict 4.5 [conv.prom] p2. Note to self: stop baiting Doug in my commit messages. llvm-svn: 86128
2009-04-08Sema::CheckConditionalOperands(): Soften pointer/integer mismatch from ↵Steve Naroff1-0/+9
error->warning. Fixes <rdar://problem/6762239> [sema] gcc incompatibility; error on incompatible operand types in ?:. llvm-svn: 68617
2009-03-24Rename clang to clang-cc.Daniel Dunbar1-1/+1
Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
2008-05-12Fix <rdar://problem/5928590> clang -fsyntax-only: "incompatible operand ↵Steve Naroff1-0/+4
types ('int' and 'void')" on input that 'gcc -fsyntax-only' eats llvm-svn: 51002
2008-02-13Fix a minor bug in isNullPointerConstant triggered by the linux Eli Friedman1-0/+3
tgmath.h. Note that there is another issue with tgmath.h, so mandel.c still doesn't work. llvm-svn: 47069
2008-02-12Make typechecking for enum+int compatibility stricter.Eli Friedman1-0/+4
llvm-svn: 47005
2008-02-12Fix type compatibility between constant and variable arrays.Eli Friedman1-0/+5
llvm-svn: 47003
2008-02-10Add a couple of sema tests for qualifiers with conditionals containing Eli Friedman1-0/+4
void*. llvm-svn: 46939
2008-01-30Fix test case and add a FIXME.Steve Naroff1-1/+2
llvm-svn: 46577
2008-01-14Revert r45951, Chris says it violates the C99 spec.Steve Naroff1-2/+2
llvm-svn: 45961
2008-01-14Rewrite Expr::isNullPointerConstant() to deal with multiple levels of ↵Steve Naroff1-4/+8
explicit casts. Now, isNullPointerConstant() will return true for the following: "(void*)(double*)0" llvm-svn: 45951
2008-01-13Change Sema::CheckAddressOfOperation() to respect C99-only addressof rules.Steve Naroff1-1/+1
Remove diagnostics from Sema::CheckIndirectionOperand(). C89/C99 allow dereferencing an incomplete type. clang appears to be emulating some incorrect gcc behavior (see below). void foo (void) { struct b; struct b* x = 0; struct b* y = &*x; // gcc produces an error ("dereferencing pointer to incomplete type") } With this patch, the above is now allowed. Bug/Patch by Eli Friedman! llvm-svn: 45933
2008-01-08Fix Sema::CheckConditionalOperands(). The null pointer constant checks need ↵Steve Naroff1-0/+17
to precede the check for two pointer operands. llvm-svn: 45732