Changes to compile with gcc 4.6
Change-Id: I55908b3b98b49373ce948fd1f12e0a5cd56ae4f7
diff --git a/src/class_linker_test.cc b/src/class_linker_test.cc
index eb18280..8b0e1a1 100644
--- a/src/class_linker_test.cc
+++ b/src/class_linker_test.cc
@@ -863,7 +863,9 @@
EXPECT_TRUE(s8->GetObject(NULL)->AsString()->Equals("android"));
s8->SetObject(NULL, String::AllocFromModifiedUtf8("robot"));
- EXPECT_EQ(false, s0->GetBoolean(NULL));
+ // TODO: Remove EXPECT_FALSE when GCC can handle EXPECT_EQ
+ // http://code.google.com/p/googletest/issues/detail?id=322
+ EXPECT_FALSE( s0->GetBoolean(NULL));
EXPECT_EQ(6, s1->GetByte(NULL));
EXPECT_EQ('b', s2->GetChar(NULL));
EXPECT_EQ(-535, s3->GetShort(NULL));
diff --git a/src/compiler/codegen/arm/Assemble.cc b/src/compiler/codegen/arm/Assemble.cc
index 43fb05e..9a1a30e 100644
--- a/src/compiler/codegen/arm/Assemble.cc
+++ b/src/compiler/codegen/arm/Assemble.cc
@@ -1566,7 +1566,7 @@
*/
while (true) {
- AssemblerStatus res = assembleInstructions(cUnit, NULL);
+ AssemblerStatus res = assembleInstructions(cUnit, 0);
if (res == kSuccess) {
break;
} else {
diff --git a/src/dalvik_system_DexFile.cc b/src/dalvik_system_DexFile.cc
index 23247cf..7fce25f 100644
--- a/src/dalvik_system_DexFile.cc
+++ b/src/dalvik_system_DexFile.cc
@@ -97,7 +97,7 @@
if (!IsValidZipFilename(sourceName.c_str()) || !IsValidDexFilename(outputName.c_str())) {
LOG(ERROR) << "Bad filenames extracting dex '" << outputName.c_str()
<< "' from zip '" << sourceName.c_str() << "'";
- return NULL;
+ return 0;
}
// Generate the output oat file for the source dex file
ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
diff --git a/src/dex2oat.cc b/src/dex2oat.cc
index 2781aae..41adc74 100644
--- a/src/dex2oat.cc
+++ b/src/dex2oat.cc
@@ -574,7 +574,7 @@
UniquePtr<ZipArchive> zip_archive(ZipArchive::OpenFromFd(zip_fd));
if (zip_archive.get() == NULL) {
LOG(ERROR) << "Failed to zip from file descriptor for " << zip_name;
- return NULL;
+ return EXIT_FAILURE;
}
const DexFile* dex_file = DexFile::Open(*zip_archive.get(), zip_name);
if (dex_file == NULL) {
diff --git a/src/dex_verifier.cc b/src/dex_verifier.cc
index 2f91dcd..9868656 100644
--- a/src/dex_verifier.cc
+++ b/src/dex_verifier.cc
@@ -1416,8 +1416,8 @@
}
uint32_t table_size = targets_offset + switch_count * 2;
if (switch_insns[0] != expected_signature) {
- Fail(VERIFY_ERROR_GENERIC) << "wrong signature for switch table (" << (void*) switch_insns[0]
- << ", wanted " << (void*) expected_signature << ")";
+ Fail(VERIFY_ERROR_GENERIC) << StringPrintf("wrong signature for switch table (%x, wanted %x)",
+ switch_insns[0], expected_signature);
return false;
}
/* make sure the end of the switch is in range */
diff --git a/src/exception_test.cc b/src/exception_test.cc
index 559636f..eca1fa8 100644
--- a/src/exception_test.cc
+++ b/src/exception_test.cc
@@ -118,7 +118,7 @@
fake_stack.push_back(0xEBAD6070); // return pc
// Pull Method* of NULL to terminate the trace
- fake_stack.push_back(NULL);
+ fake_stack.push_back(0);
// Set up thread to appear as if we called out of method_g_ at pc 3
Thread* thread = Thread::Current();
diff --git a/src/jni_internal.cc b/src/jni_internal.cc
index e6c7410..597c58b 100644
--- a/src/jni_internal.cc
+++ b/src/jni_internal.cc
@@ -2356,6 +2356,8 @@
return JNIInvalidRefType;
}
+ LOG(FATAL) << "IndirectRefKind[" << kind << "]";
+ return JNIInvalidRefType;
}
};
@@ -2974,5 +2976,8 @@
case JNIWeakGlobalRefType:
os << "JNIWeakGlobalRefType";
return os;
+ default:
+ os << "jobjectRefType[" << static_cast<int>(rhs) << "]";
+ return os;
}
}
diff --git a/src/jni_internal_test.cc b/src/jni_internal_test.cc
index d59fb3d..fabd813 100644
--- a/src/jni_internal_test.cc
+++ b/src/jni_internal_test.cc
@@ -644,9 +644,9 @@
jfieldID fid = env_->GetStaticFieldID(c, field_name, sig); \
EXPECT_TRUE(fid != NULL); \
env_->SetStatic ## type ## Field(c, fid, value1); \
- EXPECT_EQ(value1, env_->GetStatic ## type ## Field(c, fid)); \
+ EXPECT_TRUE(value1 == env_->GetStatic ## type ## Field(c, fid)); \
env_->SetStatic ## type ## Field(c, fid, value2); \
- EXPECT_EQ(value2, env_->GetStatic ## type ## Field(c, fid)); \
+ EXPECT_TRUE(value2 == env_->GetStatic ## type ## Field(c, fid)); \
} while (false)
#define EXPECT_PRIMITIVE_FIELD(instance, type, field_name, sig, value1, value2) \
@@ -654,9 +654,9 @@
jfieldID fid = env_->GetFieldID(c, field_name, sig); \
EXPECT_TRUE(fid != NULL); \
env_->Set ## type ## Field(instance, fid, value1); \
- EXPECT_EQ(value1, env_->Get ## type ## Field(instance, fid)); \
+ EXPECT_TRUE(value1 == env_->Get ## type ## Field(instance, fid)); \
env_->Set ## type ## Field(instance, fid, value2); \
- EXPECT_EQ(value2, env_->Get ## type ## Field(instance, fid)); \
+ EXPECT_TRUE(value2 == env_->Get ## type ## Field(instance, fid)); \
} while (false)