Commit e5b15226 authored by ulan's avatar ulan Committed by Commit bot

Enable -Wsign-compare compiler warnings.

BUG=v8:5614

Review-Url: https://codereview.chromium.org/2493193002
Cr-Commit-Position: refs/heads/master@{#40958}
parent 225cb9fa
...@@ -370,6 +370,8 @@ config("toolchain") { ...@@ -370,6 +370,8 @@ config("toolchain") {
if (is_clang) { if (is_clang) {
cflags += [ cflags += [
"-Wsign-compare",
# TODO(hans): Remove once http://crbug.com/428099 is resolved. # TODO(hans): Remove once http://crbug.com/428099 is resolved.
"-Winconsistent-missing-override", "-Winconsistent-missing-override",
] ]
......
...@@ -455,6 +455,7 @@ ...@@ -455,6 +455,7 @@
'variables': { 'variables': {
'v8_code%': '<(v8_code)', 'v8_code%': '<(v8_code)',
'clang_warning_flags': [ 'clang_warning_flags': [
'-Wsign-compare',
# TODO(thakis): https://crbug.com/604888 # TODO(thakis): https://crbug.com/604888
'-Wno-undefined-var-template', '-Wno-undefined-var-template',
# TODO(yangguo): issue 5258 # TODO(yangguo): issue 5258
...@@ -504,7 +505,6 @@ ...@@ -504,7 +505,6 @@
'conditions':[ 'conditions':[
['clang==0', { ['clang==0', {
'cflags+': [ 'cflags+': [
'-Wno-sign-compare',
'-Wno-uninitialized', '-Wno-uninitialized',
], ],
}], }],
......
...@@ -204,7 +204,7 @@ TEST_F(ConstantArrayBuilderTest, GapFilledWhenLowReservationCommitted) { ...@@ -204,7 +204,7 @@ TEST_F(ConstantArrayBuilderTest, GapFilledWhenLowReservationCommitted) {
for (size_t i = 0; i < k8BitCapacity; i++) { for (size_t i = 0; i < k8BitCapacity; i++) {
OperandSize operand_size = builder.CreateReservedEntry(); OperandSize operand_size = builder.CreateReservedEntry();
CHECK(OperandSize::kByte == operand_size); CHECK(OperandSize::kByte == operand_size);
CHECK_EQ(builder.size(), 0); CHECK_EQ(builder.size(), 0u);
} }
for (size_t i = 0; i < k8BitCapacity; i++) { for (size_t i = 0; i < k8BitCapacity; i++) {
builder.CommitReservedEntry(builder.CreateReservedEntry(), builder.CommitReservedEntry(builder.CreateReservedEntry(),
...@@ -217,7 +217,7 @@ TEST_F(ConstantArrayBuilderTest, GapFilledWhenLowReservationCommitted) { ...@@ -217,7 +217,7 @@ TEST_F(ConstantArrayBuilderTest, GapFilledWhenLowReservationCommitted) {
CHECK_EQ(builder.size(), 2 * k8BitCapacity); CHECK_EQ(builder.size(), 2 * k8BitCapacity);
} }
Handle<FixedArray> constant_array = builder.ToFixedArray(isolate()); Handle<FixedArray> constant_array = builder.ToFixedArray(isolate());
CHECK_EQ(constant_array->length(), 2 * k8BitCapacity); CHECK_EQ(constant_array->length(), static_cast<int>(2 * k8BitCapacity));
for (size_t i = 0; i < k8BitCapacity; i++) { for (size_t i = 0; i < k8BitCapacity; i++) {
Object* original = constant_array->get(static_cast<int>(k8BitCapacity + i)); Object* original = constant_array->get(static_cast<int>(k8BitCapacity + i));
Object* duplicate = constant_array->get(static_cast<int>(i)); Object* duplicate = constant_array->get(static_cast<int>(i));
...@@ -233,7 +233,7 @@ TEST_F(ConstantArrayBuilderTest, GapNotFilledWhenLowReservationDiscarded) { ...@@ -233,7 +233,7 @@ TEST_F(ConstantArrayBuilderTest, GapNotFilledWhenLowReservationDiscarded) {
for (size_t i = 0; i < k8BitCapacity; i++) { for (size_t i = 0; i < k8BitCapacity; i++) {
OperandSize operand_size = builder.CreateReservedEntry(); OperandSize operand_size = builder.CreateReservedEntry();
CHECK(OperandSize::kByte == operand_size); CHECK(OperandSize::kByte == operand_size);
CHECK_EQ(builder.size(), 0); CHECK_EQ(builder.size(), 0u);
} }
for (size_t i = 0; i < k8BitCapacity; i++) { for (size_t i = 0; i < k8BitCapacity; i++) {
Handle<Object> object = isolate()->factory()->NewNumberFromSize(i); Handle<Object> object = isolate()->factory()->NewNumberFromSize(i);
...@@ -265,7 +265,7 @@ TEST_F(ConstantArrayBuilderTest, HolesWithUnusedReservations) { ...@@ -265,7 +265,7 @@ TEST_F(ConstantArrayBuilderTest, HolesWithUnusedReservations) {
CHECK_EQ(builder.Insert(isolate()->factory()->NewNumber(i)), CHECK_EQ(builder.Insert(isolate()->factory()->NewNumber(i)),
static_cast<size_t>(i)); static_cast<size_t>(i));
} }
CHECK_EQ(builder.Insert(isolate()->factory()->NewNumber(256)), 256); CHECK_EQ(builder.Insert(isolate()->factory()->NewNumber(256)), 256u);
Handle<FixedArray> constant_array = builder.ToFixedArray(isolate()); Handle<FixedArray> constant_array = builder.ToFixedArray(isolate());
CHECK_EQ(constant_array->length(), 257); CHECK_EQ(constant_array->length(), 257);
...@@ -291,11 +291,12 @@ TEST_F(ConstantArrayBuilderTest, ReservationsAtAllScales) { ...@@ -291,11 +291,12 @@ TEST_F(ConstantArrayBuilderTest, ReservationsAtAllScales) {
for (int i = 65536; i < 131072; ++i) { for (int i = 65536; i < 131072; ++i) {
CHECK_EQ(builder.CreateReservedEntry(), OperandSize::kQuad); CHECK_EQ(builder.CreateReservedEntry(), OperandSize::kQuad);
} }
CHECK_EQ(builder.CommitReservedEntry(OperandSize::kByte, Smi::FromInt(1)), 0); CHECK_EQ(builder.CommitReservedEntry(OperandSize::kByte, Smi::FromInt(1)),
0u);
CHECK_EQ(builder.CommitReservedEntry(OperandSize::kShort, Smi::FromInt(2)), CHECK_EQ(builder.CommitReservedEntry(OperandSize::kShort, Smi::FromInt(2)),
256); 256u);
CHECK_EQ(builder.CommitReservedEntry(OperandSize::kQuad, Smi::FromInt(3)), CHECK_EQ(builder.CommitReservedEntry(OperandSize::kQuad, Smi::FromInt(3)),
65536); 65536u);
Handle<FixedArray> constant_array = builder.ToFixedArray(isolate()); Handle<FixedArray> constant_array = builder.ToFixedArray(isolate());
CHECK_EQ(constant_array->length(), 65537); CHECK_EQ(constant_array->length(), 65537);
int count = 1; int count = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment