Closed Bug 997306 Opened 11 years ago Closed 11 years ago

TestGCPostBarriers.cpp:58:21: warning: comparison of integers of different signs: 'int' and 'const size_t' (aka 'const unsigned long') [-Wsign-compare], and many more

Categories

(Core :: JavaScript: GC, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla31

People

(Reporter: dholbert, Assigned: dholbert)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

I noticed these 57 lines go by in my buildspew today, for TestGCPostBarriers.cpp: { 3:11.17 In file included from $OBJDIR/xpcom/glue/tests/gtest/Unified_cpp_glue_tests_gtest0.cpp:15: 3:11.17 Warning: -Wsign-compare in $SRCDIR/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp: comparison of integers of different signs: 'int' and 'const size_t' (aka 'const unsigned long') 3:11.17 $SRCDIR/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp:58:21: warning: comparison of integers of different signs: 'int' and 'const size_t' (aka 'const unsigned long') [-Wsign-compare] 3:11.17 for (int i = 0; i < ElementCount; ++i) { 3:11.17 ~ ^ ~~~~~~~~~~~~ 3:11.17 Warning: -Wsign-compare in $SRCDIR/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp: comparison of integers of different signs: 'int' and 'const size_t' (aka 'const unsigned long') 3:11.17 $SRCDIR/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp:79:21: warning: comparison of integers of different signs: 'int' and 'const size_t' (aka 'const unsigned long') [-Wsign-compare] 3:11.17 for (int i = 0; i < ElementCount; ++i) { 3:11.17 ~ ^ ~~~~~~~~~~~~ 3:11.18 TestComponent.o 3:11.18 nsEnumeratorUtils.o 3:11.27 Warning: -Wsign-compare in $SRCDIR/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp: comparison of integers of different signs: 'int' and 'const size_t' (aka 'const unsigned long') 3:11.27 $SRCDIR/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp:58:21: warning: comparison of integers of different signs: 'int' and 'const size_t' (aka 'const unsigned long') [-Wsign-compare] 3:11.27 for (int i = 0; i < ElementCount; ++i) { 3:11.27 ~ ^ ~~~~~~~~~~~~ 3:11.27 $SRCDIR/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp:113:5: note: in instantiation of function template specialization 'RunTest<nsTArray<JS::Heap<JSObject *> > >' requested here 3:11.27 RunTest(rt, cx, array); 3:11.27 ^ 3:11.27 Warning: -Wsign-compare in $SRCDIR/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp: comparison of integers of different signs: 'int' and 'const size_t' (aka 'const unsigned long') 3:11.27 $SRCDIR/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp:79:21: warning: comparison of integers of different signs: 'int' and 'const size_t' (aka 'const unsigned long') [-Wsign-compare] 3:11.27 for (int i = 0; i < ElementCount; ++i) { 3:11.27 ~ ^ ~~~~~~~~~~~~ 3:11.27 TestComponent.o 3:11.28 Warning: -Wsign-compare in $SRCDIR/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp: comparison of integers of different signs: 'int' and 'const size_t' (aka 'const unsigned long') 3:11.28 $SRCDIR/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp:58:21: warning: comparison of integers of different signs: 'int' and 'const size_t' (aka 'const unsigned long') [-Wsign-compare] 3:11.28 for (int i = 0; i < ElementCount; ++i) { 3:11.28 ~ ^ ~~~~~~~~~~~~ 3:11.28 $SRCDIR/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp:119:5: note: in instantiation of function template specialization 'RunTest<FallibleTArray<JS::Heap<JSObject *> > >' requested here 3:11.28 RunTest(rt, cx, array); 3:11.28 ^ 3:11.28 Warning: -Wsign-compare in $SRCDIR/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp: comparison of integers of different signs: 'int' and 'const size_t' (aka 'const unsigned long') 3:11.28 $SRCDIR/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp:79:21: warning: comparison of integers of different signs: 'int' and 'const size_t' (aka 'const unsigned long') [-Wsign-compare] 3:11.28 for (int i = 0; i < ElementCount; ++i) { 3:11.28 ~ ^ ~~~~~~~~~~~~ 3:11.28 nsTestSample.o 3:11.28 Warning: -Wsign-compare in $SRCDIR/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp: comparison of integers of different signs: 'int' and 'const size_t' (aka 'const unsigned long') 3:11.28 $SRCDIR/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp:58:21: warning: comparison of integers of different signs: 'int' and 'const size_t' (aka 'const unsigned long') [-Wsign-compare] 3:11.28 for (int i = 0; i < ElementCount; ++i) { 3:11.28 ~ ^ ~~~~~~~~~~~~ 3:11.28 $SRCDIR/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp:125:5: note: in instantiation of function template specialization 'RunTest<nsAutoTArray<JS::Heap<JSObject *>, 10> >' requested here 3:11.28 RunTest(rt, cx, &array); 3:11.28 ^ 3:11.29 Warning: -Wsign-compare in $SRCDIR/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp: comparison of integers of different signs: 'int' and 'const size_t' (aka 'const unsigned long') 3:11.29 $SRCDIR/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp:79:21: warning: comparison of integers of different signs: 'int' and 'const size_t' (aka 'const unsigned long') [-Wsign-compare] 3:11.29 for (int i = 0; i < ElementCount; ++i) { 3:11.29 ~ ^ ~~~~~~~~~~~~ 3:11.29 Warning: -Wsign-compare in $SRCDIR/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp: comparison of integers of different signs: 'int' and 'const size_t' (aka 'const unsigned long') 3:11.29 $SRCDIR/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp:58:21: warning: comparison of integers of different signs: 'int' and 'const size_t' (aka 'const unsigned long') [-Wsign-compare] 3:11.29 for (int i = 0; i < ElementCount; ++i) { 3:11.29 ~ ^ ~~~~~~~~~~~~ 3:11.29 $SRCDIR/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp:130:5: note: in instantiation of function template specialization 'RunTest<AutoFallibleTArray<JS::Heap<JSObject *>, 10> >' requested here 3:11.29 RunTest(rt, cx, &array); 3:11.29 ^ 3:11.29 Warning: -Wsign-compare in $SRCDIR/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp: comparison of integers of different signs: 'int' and 'const size_t' (aka 'const unsigned long') 3:11.29 $SRCDIR/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp:79:21: warning: comparison of integers of different signs: 'int' and 'const size_t' (aka 'const unsigned long') [-Wsign-compare] 3:11.29 for (int i = 0; i < ElementCount; ++i) { 3:11.29 ~ ^ ~~~~~~~~~~~~ } Looks like Bug 993410 introduced 'ElementCount' and made these comparisons into signed/unsigned comparisons; hence, setting as blocking that bug. (I'm building with clang 3.4 on linux, if it matters -- though I think all compilers should warn about this.)
Attached patch fix v1 (obsolete) — Splinter Review
This patch makes the test compile with no warnings for me.
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Attachment #8407687 - Flags: review?(jcoppeard)
Attached patch fix v2Splinter Review
[minor tweak: changed my static_cast to use int32_t instead of int, to match the return-type of value.toInt32().]
Attachment #8407687 - Attachment is obsolete: true
Attachment #8407687 - Flags: review?(jcoppeard)
Attachment #8407692 - Flags: review?(jcoppeard)
Comment on attachment 8407692 [details] [diff] [review] fix v2 Review of attachment 8407692 [details] [diff] [review]: ----------------------------------------------------------------- Thanks for fixing this!
Attachment #8407692 - Flags: review?(jcoppeard) → review+
Blocks: 997982
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: