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
This commit is contained in:
ivan.penkov@gmail.com 2012-07-02 22:55:57 +00:00
parent eb3bf49197
commit 5f6e1f0fe7
20 changed files with 292 additions and 120 deletions

View file

@ -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_

View file

@ -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

View file

@ -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<pid_t> 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
}

View file

@ -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)];

View file

@ -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;

View file

@ -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;

View file

@ -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<N> appending functions. If the