summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/conditional-expr.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix a typo (the the => the)Sylvestre Ledru2012-07-231-1/+1
| | | | llvm-svn: 160622
* Properly implement the C rules for composite types for qualified pointers in ↵Eli Friedman2012-04-051-0/+17
| | | | | | conditionals. Patch by Tim Northover. llvm-svn: 154134
* Remove warning for conditional operands of differend signedness from ↵Richard Trieu2011-07-211-10/+15
| | | | | | -Wsign-compare. Cases that previously warn on this will have a different warning emitted from -Wsign-conversion. llvm-svn: 135664
* Initial steps to improve diagnostics when there is a NULL andChandler Carruth2011-02-181-0/+13
| | | | | | | | a non-pointer on the two sides of a conditional expression. Patch by Stephen Hines and Mihai Rusu. llvm-svn: 125995
* Rearchitect -Wconversion and -Wsign-compare. Instead of computing themJohn McCall2010-05-061-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
* Improve diagnostics when we fail to convert from a source type to aDouglas Gregor2010-04-091-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
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-151-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
* Turn off -Wsign-compare warnings by defaultDouglas Gregor2009-11-061-1/+1
| | | | llvm-svn: 86233
* Implement the conditional-operator part of -Wsign-compare. TurnJohn McCall2009-11-051-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
* Sema::CheckConditionalOperands(): Soften pointer/integer mismatch from ↵Steve Naroff2009-04-081-0/+9
| | | | | | | | error->warning. Fixes <rdar://problem/6762239> [sema] gcc incompatibility; error on incompatible operand types in ?:. llvm-svn: 68617
* Rename clang to clang-cc.Daniel Dunbar2009-03-241-1/+1
| | | | | | Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
* Fix <rdar://problem/5928590> clang -fsyntax-only: "incompatible operand ↵Steve Naroff2008-05-121-0/+4
| | | | | | types ('int' and 'void')" on input that 'gcc -fsyntax-only' eats llvm-svn: 51002
* Fix a minor bug in isNullPointerConstant triggered by the linux Eli Friedman2008-02-131-0/+3
| | | | | | | | | tgmath.h. Note that there is another issue with tgmath.h, so mandel.c still doesn't work. llvm-svn: 47069
* Make typechecking for enum+int compatibility stricter.Eli Friedman2008-02-121-0/+4
| | | | llvm-svn: 47005
* Fix type compatibility between constant and variable arrays.Eli Friedman2008-02-121-0/+5
| | | | llvm-svn: 47003
* Add a couple of sema tests for qualifiers with conditionals containing Eli Friedman2008-02-101-0/+4
| | | | | | void*. llvm-svn: 46939
* Fix test case and add a FIXME.Steve Naroff2008-01-301-1/+2
| | | | llvm-svn: 46577
* Revert r45951, Chris says it violates the C99 spec.Steve Naroff2008-01-141-2/+2
| | | | llvm-svn: 45961
* Rewrite Expr::isNullPointerConstant() to deal with multiple levels of ↵Steve Naroff2008-01-141-4/+8
| | | | | | | | explicit casts. Now, isNullPointerConstant() will return true for the following: "(void*)(double*)0" llvm-svn: 45951
* Change Sema::CheckAddressOfOperation() to respect C99-only addressof rules.Steve Naroff2008-01-131-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
* Fix Sema::CheckConditionalOperands(). The null pointer constant checks need ↵Steve Naroff2008-01-081-0/+17
to precede the check for two pointer operands. llvm-svn: 45732
OpenPOWER on IntegriCloud