From 4e024bb4f5c8aa8b07459f7fbd65c35122127fd1 Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Wed, 22 Sep 2010 14:19:28 +0200 Subject: Remove compiler warnings when building the emulator. This forces -Wall during the build. Note that this patch doesn't remove all warnings, but most of the remaining ones are from upstream anyway. Change-Id: I8808d8495e99866e156ce5780d2e3c305eab491f --- elff/dwarf_defs.h | 4 ++-- elff/dwarf_die.cc | 2 +- elff/dwarf_die.h | 4 ++-- elff/dwarf_utils.cc | 8 ++++---- elff/elf_alloc.h | 2 +- elff/elf_defs.h | 8 ++++++++ elff/elf_file.cc | 14 +++++++------- 7 files changed, 25 insertions(+), 17 deletions(-) (limited to 'elff') diff --git a/elff/dwarf_defs.h b/elff/dwarf_defs.h index 567df6a..04573e2 100644 --- a/elff/dwarf_defs.h +++ b/elff/dwarf_defs.h @@ -717,9 +717,9 @@ class DwarfAbbrDieArray { * hopping, that all Dwarf_Abbr_DIEs for the CU will fit into it. */ DwarfAbbrDieArray() - : count_(0), + : array_(&small_array_[0]), array_size_(ELFF_ARRAY_SIZE(small_array_)), - array_(&small_array_[0]) { + count_(0) { } /* Destructs DwarfAbbrDieArray instance. */ diff --git a/elff/dwarf_die.cc b/elff/dwarf_die.cc index 2085e31..0f58cbe 100644 --- a/elff/dwarf_die.cc +++ b/elff/dwarf_die.cc @@ -212,7 +212,7 @@ void DIEObject::dump(bool only_this) const { Elf_Xword low, high; while (elf_file()->get_range(off, &low, &high) && (low != 0 || high != 0)) { - printf(" %08I64X - %08I64X\n", + printf(" %08" FMT_I64 "X - %08" FMT_I64 "X\n", low, high); off += 16; } diff --git a/elff/dwarf_die.h b/elff/dwarf_die.h index 21dea37..ca2eeeb 100644 --- a/elff/dwarf_die.h +++ b/elff/dwarf_die.h @@ -39,8 +39,8 @@ class DIEObject : public DwarfAllocBase { : die_(die), parent_cu_(parent_cu), parent_die_(parent_die), - prev_sibling_(NULL), - last_child_(NULL) { + last_child_(NULL), + prev_sibling_(NULL) { } /* Destructs DIEObject intance. */ diff --git a/elff/dwarf_utils.cc b/elff/dwarf_utils.cc index 56c05a3..1d84b66 100644 --- a/elff/dwarf_utils.cc +++ b/elff/dwarf_utils.cc @@ -275,12 +275,12 @@ dump_value(const Dwarf_Value* attr_value) { break; case DWARF_VALUE_U64: - printf("XWORD) = %I64u (x%I64X)\n", attr_value->u64, + printf("XWORD) = %" FMT_I64 "u (x%" FMT_I64 "X)\n", attr_value->u64, attr_value->u64); break; case DWARF_VALUE_S64: - printf("SXWORD) = %I64d (x%I64X)\n", attr_value->s64, + printf("SXWORD) = %" FMT_I64 "d (x%" FMT_I64 "X)\n", attr_value->s64, attr_value->s64); break; @@ -293,11 +293,11 @@ dump_value(const Dwarf_Value* attr_value) { break; case DWARF_VALUE_PTR64: - printf("PTR64) = x%08I64X\n", attr_value->ptr64); + printf("PTR64) = x%08" FMT_I64 "X\n", attr_value->ptr64); break; case DWARF_VALUE_BLOCK: - printf("BLOCK) = [%I64u]:", attr_value->block.block_size); + printf("BLOCK) = [%u]:", attr_value->block.block_size); for (Elf_Xword i = 0; i < attr_value->block.block_size; i++) { Elf_Byte prnt = *((const Elf_Byte*)attr_value->block.block_ptr + i); printf(" x%02X", prnt); diff --git a/elff/elf_alloc.h b/elff/elf_alloc.h index d76dcdb..648a1e9 100644 --- a/elff/elf_alloc.h +++ b/elff/elf_alloc.h @@ -152,7 +152,7 @@ class DwarfAllocBase { * attempts to instantiate objects of derived classes using this version * of operator 'new'. */ - void* operator new(size_t size) { + void* operator new(size_t size) throw() { return NULL; } }; diff --git a/elff/elf_defs.h b/elff/elf_defs.h index 39fd1b1..1eca81b 100644 --- a/elff/elf_defs.h +++ b/elff/elf_defs.h @@ -132,4 +132,12 @@ is_little_endian_cpu(void) { return get_byte(&tmp, 0) == 0xFF; } +/* Use in printf() statements to dump 64-bit values + */ +#ifdef _WIN32 +# define FMT_I64 "I64" +#else +# define FMT_I64 "ll" +#endif + #endif // ELFF_ELF_DEFS_H_ diff --git a/elff/elf_file.cc b/elff/elf_file.cc index 39aa371..5a6392c 100644 --- a/elff/elf_file.cc +++ b/elff/elf_file.cc @@ -35,16 +35,16 @@ static const DwarfParseContext parse_rt_context = { parse_rt_tags }; //============================================================================= ElfFile::ElfFile() - : sec_table_(NULL), + : fixed_base_address_(0), + elf_handle_((MapFile*)-1), elf_file_path_(NULL), + allocator_(NULL), + sec_table_(NULL), sec_count_(0), - cu_count_(0), + sec_entry_size_(0), last_cu_(NULL), - allocator_(NULL), - fixed_base_address_(0), - is_exec_(0), - elf_handle_((MapFile*)-1), - sec_entry_size_(0) { + cu_count_(0), + is_exec_(0) { } ElfFile::~ElfFile() { -- cgit v1.1