From 5f6e1f0fe74bc01878d80531a91c39df9dfaa62a Mon Sep 17 00:00:00 2001 From: "ivan.penkov@gmail.com" Date: Mon, 2 Jul 2012 22:55:57 +0000 Subject: Fixing various compiler warnings and applying minor tweaks to allow running of the mojority of breakpad unittests in Google. http://breakpad.appspot.com/399002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@978 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/common/basictypes.h | 2 ++ src/common/language.h | 4 ++++ src/common/linux/elf_core_dump_unittest.cc | 10 ++++++---- src/common/linux/file_id_unittest.cc | 6 ++++-- src/common/linux/linux_libc_support_unittest.cc | 2 +- src/common/memory_unittest.cc | 2 +- src/common/test_assembler.h | 5 ++++- 7 files changed, 22 insertions(+), 9 deletions(-) (limited to 'src/common') diff --git a/src/common/basictypes.h b/src/common/basictypes.h index 694f7022..84668b79 100644 --- a/src/common/basictypes.h +++ b/src/common/basictypes.h @@ -32,8 +32,10 @@ // A macro to disallow the copy constructor and operator= functions // This should be used in the private: declarations for a class +#ifndef DISALLOW_COPY_AND_ASSIGN #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ TypeName(const TypeName&); \ void operator=(const TypeName&) +#endif // DISALLOW_COPY_AND_ASSIGN #endif // COMMON_BASICTYPES_H_ diff --git a/src/common/language.h b/src/common/language.h index 4811e7f0..bbe30334 100644 --- a/src/common/language.h +++ b/src/common/language.h @@ -50,6 +50,10 @@ namespace google_breakpad { // language. class Language { public: + // A base class destructor should be either public and virtual, + // or protected and nonvirtual. + virtual ~Language() {} + // Return true if this language has functions to which we can assign // line numbers. (Debugging info for assembly language, for example, // can have source location information, but does not have functions diff --git a/src/common/linux/elf_core_dump_unittest.cc b/src/common/linux/elf_core_dump_unittest.cc index b799d3f0..e872a4fd 100644 --- a/src/common/linux/elf_core_dump_unittest.cc +++ b/src/common/linux/elf_core_dump_unittest.cc @@ -183,7 +183,9 @@ TEST(ElfCoreDumpTest, ValidCoreFile) { size_t num_nt_prpsinfo = 0; size_t num_nt_prstatus = 0; size_t num_nt_fpregset = 0; +#if defined(__i386__) size_t num_nt_prxfpreg = 0; +#endif set actual_thread_ids; ElfCoreDump::Note note = core.GetFirstNote(); while (note.IsValid()) { @@ -211,7 +213,7 @@ TEST(ElfCoreDumpTest, ValidCoreFile) { ++num_nt_prstatus; break; } -#if defined(__i386) || defined(__x86_64) +#if defined(__i386__) || defined(__x86_64__) case NT_FPREGSET: { EXPECT_TRUE(description.data() != NULL); EXPECT_EQ(sizeof(user_fpregs_struct), description.length()); @@ -219,7 +221,7 @@ TEST(ElfCoreDumpTest, ValidCoreFile) { break; } #endif -#if defined(__i386) +#if defined(__i386__) case NT_PRXFPREG: { EXPECT_TRUE(description.data() != NULL); EXPECT_EQ(sizeof(user_fpxregs_struct), description.length()); @@ -236,10 +238,10 @@ TEST(ElfCoreDumpTest, ValidCoreFile) { EXPECT_TRUE(expected_thread_ids == actual_thread_ids); EXPECT_EQ(1, num_nt_prpsinfo); EXPECT_EQ(kNumOfThreads, num_nt_prstatus); -#if defined(__i386) || defined(__x86_64) +#if defined(__i386__) || defined(__x86_64__) EXPECT_EQ(kNumOfThreads, num_nt_fpregset); #endif -#if defined(__i386) +#if defined(__i386__) EXPECT_EQ(kNumOfThreads, num_nt_prxfpreg); #endif } diff --git a/src/common/linux/file_id_unittest.cc b/src/common/linux/file_id_unittest.cc index 4c803152..daef1e3f 100644 --- a/src/common/linux/file_id_unittest.cc +++ b/src/common/linux/file_id_unittest.cc @@ -73,9 +73,11 @@ TEST(FileIDStripTest, StripSelf) { string templ = temp_dir.path() + "/file-id-unittest"; char cmdline[4096]; sprintf(cmdline, "cp \"%s\" \"%s\"", exe_name, templ.c_str()); - ASSERT_EQ(system(cmdline), 0); + ASSERT_EQ(0, system(cmdline)) << "Failed to execute: " << cmdline; + sprintf(cmdline, "chmod u+w \"%s\"", templ.c_str()); + ASSERT_EQ(0, system(cmdline)) << "Failed to execute: " << cmdline; sprintf(cmdline, "strip \"%s\"", templ.c_str()); - ASSERT_EQ(system(cmdline), 0); + ASSERT_EQ(0, system(cmdline)) << "Failed to execute: " << cmdline; uint8_t identifier1[sizeof(MDGUID)]; uint8_t identifier2[sizeof(MDGUID)]; diff --git a/src/common/linux/linux_libc_support_unittest.cc b/src/common/linux/linux_libc_support_unittest.cc index a7c5a26a..6f4b2da6 100644 --- a/src/common/linux/linux_libc_support_unittest.cc +++ b/src/common/linux/linux_libc_support_unittest.cc @@ -27,8 +27,8 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#include "breakpad_googletest_includes.h" #include "common/linux/linux_libc_support.h" -#include "testing/gtest/include/gtest/gtest.h" namespace { typedef testing::Test LinuxLibcSupportTest; diff --git a/src/common/memory_unittest.cc b/src/common/memory_unittest.cc index d580c1fe..69d9f8ab 100644 --- a/src/common/memory_unittest.cc +++ b/src/common/memory_unittest.cc @@ -27,8 +27,8 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#include "breakpad_googletest_includes.h" #include "common/memory.h" -#include "testing/gtest/include/gtest/gtest.h" using namespace google_breakpad; diff --git a/src/common/test_assembler.h b/src/common/test_assembler.h index 401e8528..891cf677 100644 --- a/src/common/test_assembler.h +++ b/src/common/test_assembler.h @@ -271,7 +271,10 @@ class Section { public: Section(Endianness endianness = kUnsetEndian) : endianness_(endianness) { }; - ~Section() { }; + + // A base class destructor should be either public and virtual, + // or protected and nonvirtual. + virtual ~Section() { }; // Set the default endianness of this section to ENDIANNESS. This // sets the behavior of the D appending functions. If the -- cgit v1.2.1