Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(346)

Issue 4731042: Remove check for mixed signs on conditional operands from -Wsign-compare (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 5 months ago by rtrieu
Modified:
13 years, 5 months ago
Reviewers:
chandlerc
Base URL:
https://llvm.org/svn/llvm-project/cfe/trunk/
Visibility:
Public.

Description

Patch added at revision 135664.

Patch Set 1 #

Patch Set 2 : Remove warning completely instead of moving the warning to a different flag. #

Total comments: 12

Patch Set 3 : Made suggested comments #

Patch Set 4 : Add some clarifying comments to test case. #

Patch Set 5 : Removed comment, shuffled variables to clarify test case. #

Patch Set 6 : Realign test cases with old test cases #

Unified diffs Side-by-side diffs Delta from patch set Stats (+73 lines, -130 lines) Patch
M include/clang/Basic/DiagnosticSemaKinds.td View 1 1 chunk +0 lines, -3 lines 0 comments Download
M lib/Sema/SemaChecking.cpp View 1 1 chunk +7 lines, -20 lines 0 comments Download
M test/Sema/conditional-expr.c View 1 2 3 4 5 3 chunks +15 lines, -10 lines 0 comments Download
M test/SemaCXX/compare.cpp View 1 2 1 chunk +11 lines, -0 lines 0 comments Download
M test/SemaCXX/conditional-expr.cpp View 1 2 3 4 5 3 chunks +15 lines, -8 lines 0 comments Download
D test/SemaCXX/warn-sign-compare.cpp View 1 chunk +0 lines, -72 lines 0 comments Download
A + test/SemaCXX/warn-sign-conversion.cpp View 1 3 chunks +25 lines, -17 lines 0 comments Download

Messages

Total messages: 6
chandlerc
http://codereview.appspot.com/4731042/diff/1001/test/Sema/conditional-expr.c File test/Sema/conditional-expr.c (right): http://codereview.appspot.com/4731042/diff/1001/test/Sema/conditional-expr.c#newcode54 test/Sema/conditional-expr.c:54: test0 = test0 ? EVal : (int) test0; // ...
13 years, 5 months ago (2011-07-15 22:28:36 UTC) #1
rtrieu
http://codereview.appspot.com/4731042/diff/1001/test/Sema/conditional-expr.c File test/Sema/conditional-expr.c (right): http://codereview.appspot.com/4731042/diff/1001/test/Sema/conditional-expr.c#newcode54 test/Sema/conditional-expr.c:54: test0 = test0 ? EVal : (int) test0; // ...
13 years, 5 months ago (2011-07-16 00:44:26 UTC) #2
chandlerc
http://codereview.appspot.com/4731042/diff/1001/test/Sema/conditional-expr.c File test/Sema/conditional-expr.c (right): http://codereview.appspot.com/4731042/diff/1001/test/Sema/conditional-expr.c#newcode54 test/Sema/conditional-expr.c:54: test0 = test0 ? EVal : (int) test0; // ...
13 years, 5 months ago (2011-07-16 00:59:56 UTC) #3
rtrieu
http://codereview.appspot.com/4731042/diff/1001/test/Sema/conditional-expr.c File test/Sema/conditional-expr.c (right): http://codereview.appspot.com/4731042/diff/1001/test/Sema/conditional-expr.c#newcode54 test/Sema/conditional-expr.c:54: test0 = test0 ? EVal : (int) test0; // ...
13 years, 5 months ago (2011-07-19 03:58:49 UTC) #4
chandlerc
http://codereview.appspot.com/4731042/diff/1001/test/Sema/conditional-expr.c File test/Sema/conditional-expr.c (right): http://codereview.appspot.com/4731042/diff/1001/test/Sema/conditional-expr.c#newcode54 test/Sema/conditional-expr.c:54: test0 = test0 ? EVal : (int) test0; // ...
13 years, 5 months ago (2011-07-19 08:03:05 UTC) #5
rtrieu
13 years, 5 months ago (2011-07-19 19:40:36 UTC) #6
http://codereview.appspot.com/4731042/diff/1001/test/Sema/conditional-expr.c
File test/Sema/conditional-expr.c (right):

http://codereview.appspot.com/4731042/diff/1001/test/Sema/conditional-expr.c#...
test/Sema/conditional-expr.c:54: test0 = test0 ? EVal : (int) test0; //
expected-warning {{operand of ? changes signedness: 'int' to 'unsigned long'}}
On 2011/07/19 08:03:05, chandlerc wrote:
> On 2011/07/19 03:58:50, rtrieu wrote:
> > On 2011/07/16 00:59:56, chandlerc wrote:
> > > On 2011/07/16 00:44:26, rtrieu wrote:
> > > > On 2011/07/15 22:28:37, chandlerc wrote:
> > > > > Why is this now warning?
> > > > 
> > > > test0 is unsigned.  Both EVal and (int) test0 are signed integers.  When
> > > either
> > > > one is assigned to test0, they must be sign converted, and thus get
warned
> > on.
> > > 
> > > Maybe get a signed value to assign to? That way its more clear that the ?:
> > > doesn't warn.
> > > 
> > > Also, this diagnostic is really confusing -- it makes it sound like only
one
> > of
> > > the operands would be subject to this conversion when they both would...
but
> > > that is likely an orthogonal issue...
> > 
> > Added a comment to clarify the warning reason.  Moved the related test cases
> > together.
> 
> I like the grouping, but why not just move 'test1's declaration up from line
61
> to line 57, and assign to test1 which is signed? Then there won't be any
warning
> to explain...

Done.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b