Closed
Bug 836182
Opened 13 years ago
Closed 13 years ago
Fix mtransport usages of gtest.h templates w/ mixed-sign types
Categories
(Core :: WebRTC, defect)
Tracking
()
RESOLVED
FIXED
mozilla21
People
(Reporter: dholbert, Assigned: dholbert)
References
(Blocks 1 open bug)
Details
(Whiteboard: [WebRTC] [blocking-webrtc-] [qa-])
Attachments
(1 file, 1 obsolete file)
2.64 KB,
patch
|
jesup
:
review+
|
Details | Diff | Splinter Review |
I get these build warnings for gtest.h template invocations where we're comparing two things w/ different signed-ness, when building current m-c and m-i:
{
0:41.89 In file included from /scratch/work/builds/mozilla-inbound/mozilla/media/mtransport/test/ice_unittest.cpp:31:0:
0:41.89 /scratch/work/builds/mozilla-inbound/mozilla/media/webrtc/trunk/testing/gtest/include/gtest/gtest.h: In instantiation of ‘testing::AssertionResult testing::internal::CmpHelperEQ(const char*, const char*, const T1&, const T2&) [with T1 = int; T2 = long unsigned int]’:
0:41.89 /scratch/work/builds/mozilla-inbound/mozilla/media/webrtc/trunk/testing/gtest/include/gtest/gtest.h:1440:30: required from ‘static testing::AssertionResult testing::internal::EqHelper<lhs_is_null_literal>::Compare(const char*, const char*, const T1&, const T2&) [with T1 = int; T2 = long unsigned int; bool lhs_is_null_literal = false]’
0:41.89 /scratch/work/builds/mozilla-inbound/mozilla/media/mtransport/test/ice_unittest.cpp:317:5: required from here
0:41.89 Warning: -Wsign-compare in /scratch/work/builds/mozilla-inbound/mozilla/media/webrtc/trunk/testing/gtest/include/gtest/gtest.h: comparison between signed and unsigned integer expressions
0:41.89 /scratch/work/builds/mozilla-inbound/mozilla/media/webrtc/trunk/testing/gtest/include/gtest/gtest.h:1403:3: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
0:41.90 In file included from /scratch/work/builds/mozilla-inbound/mozilla/media/mtransport/test/sctp_unittest.cpp:31:0:
0:41.90 /scratch/work/builds/mozilla-inbound/mozilla/media/webrtc/trunk/testing/gtest/include/gtest/gtest.h: In instantiation of ‘testing::AssertionResult testing::internal::CmpHelperEQ(const char*, const char*, const T1&, const T2&) [with T1 = long unsigned int; T2 = int]’:
0:41.90 /scratch/work/builds/mozilla-inbound/mozilla/media/webrtc/trunk/testing/gtest/include/gtest/gtest.h:1440:30: required from ‘static testing::AssertionResult testing::internal::EqHelper<lhs_is_null_literal>::Compare(const char*, const char*, const T1&, const T2&) [with T1 = long unsigned int; T2 = int; bool lhs_is_null_literal = false]’
0:41.90 /scratch/work/builds/mozilla-inbound/mozilla/media/mtransport/test/sctp_unittest.cpp:184:5: required from here
0:41.90 Warning: -Wsign-compare in /scratch/work/builds/mozilla-inbound/mozilla/media/webrtc/trunk/testing/gtest/include/gtest/gtest.h: comparison between signed and unsigned integer expressions
0:41.90 /scratch/work/builds/mozilla-inbound/mozilla/media/webrtc/trunk/testing/gtest/include/gtest/gtest.h:1403:3: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
0:41.98 In file included from /scratch/work/builds/mozilla-inbound/mozilla/media/mtransport/test/transport_unittests.cpp:37:0:
0:41.98 /scratch/work/builds/mozilla-inbound/mozilla/media/webrtc/trunk/testing/gtest/include/gtest/gtest.h: In instantiation of ‘testing::AssertionResult testing::internal::CmpHelperEQ(const char*, const char*, const T1&, const T2&) [with T1 = int; T2 = long unsigned int]’:
0:41.98 /scratch/work/builds/mozilla-inbound/mozilla/media/webrtc/trunk/testing/gtest/include/gtest/gtest.h:1440:30: required from ‘static testing::AssertionResult testing::internal::EqHelper<lhs_is_null_literal>::Compare(const char*, const char*, const T1&, const T2&) [with T1 = int; T2 = long unsigned int; bool lhs_is_null_literal = false]’
0:41.98 /scratch/work/builds/mozilla-inbound/mozilla/media/mtransport/test/transport_unittests.cpp:131:5: required from here
0:41.99 Warning: -Wsign-compare in /scratch/work/builds/mozilla-inbound/mozilla/media/webrtc/trunk/testing/gtest/include/gtest/gtest.h: comparison between signed and unsigned integer expressions
0:41.99 /scratch/work/builds/mozilla-inbound/mozilla/media/webrtc/trunk/testing/gtest/include/gtest/gtest.h:1403:3: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
}
Assignee | ||
Comment 1•13 years ago
|
||
(sorry for the unreadability of comment 0; it's very ugly, and that's why I'd love to have these warnings fixed. :))
Assignee | ||
Comment 2•13 years ago
|
||
In two of the three cases, we're comparing to a numeric literal, which (by default) is treated as signed when we instantiate the template -- but we can add a "u" suffix to make the value unsigned instead.
In the third case, we're comparing an int to a size_t. I just cast the int to size_t, and I added a check to make sure it's nonnegative.
Assignee: nobody → dholbert
Attachment #707995 -
Flags: review?(rjesup)
Assignee | ||
Comment 3•13 years ago
|
||
(oops, previous fix accidentally had "> 0" instead of ">= 0" in the non-negative check.)
Attachment #707995 -
Attachment is obsolete: true
Attachment #707995 -
Flags: review?(rjesup)
Attachment #707996 -
Flags: review?(rjesup)
Updated•13 years ago
|
Attachment #707996 -
Flags: review?(rjesup) → review+
Assignee | ||
Comment 4•13 years ago
|
||
Status: NEW → ASSIGNED
Assignee | ||
Updated•13 years ago
|
Flags: in-testsuite-
Updated•13 years ago
|
Whiteboard: [WebRTC] [blocking-webrtc-]
Comment 5•13 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla21
Updated•13 years ago
|
Whiteboard: [WebRTC] [blocking-webrtc-] → [WebRTC] [blocking-webrtc-] [qa-]
You need to log in
before you can comment on or make changes to this bug.
Description
•