mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2024-11-24 11:55:47 +01:00
Turn on more warnings in ios / mac projects.
Make casts explicit. This makes casts that loose precision explicit, from here on we will get warnings. The changes in this commit are made without evaluating each cast, asuming the original casts were intentional. Patch by: jakerr@google.com Review: https://breakpad.appspot.com/453002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1046 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
c83cd11615
commit
f1489baeb7
@ -492,9 +492,17 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
|
||||
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = c99;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_SHADOW = YES;
|
||||
GCC_WARN_SIGN_COMPARE = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNKNOWN_PRAGMAS = YES;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_LABEL = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
../../,
|
||||
@ -510,8 +518,16 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
|
||||
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = c99;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_SHADOW = YES;
|
||||
GCC_WARN_SIGN_COMPARE = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNKNOWN_PRAGMAS = YES;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_LABEL = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
../../,
|
||||
|
@ -224,7 +224,7 @@ NSString* GetPlatform() {
|
||||
|
||||
if (spanSeconds >= uploadIntervalInSeconds_)
|
||||
return 0;
|
||||
return uploadIntervalInSeconds_ - spanSeconds;
|
||||
return uploadIntervalInSeconds_ - static_cast<int>(spanSeconds);
|
||||
}
|
||||
|
||||
- (void)reportWillBeSent {
|
||||
|
@ -204,11 +204,11 @@ int __breakpad_fdnlist(int fd, nlist_type *list, const char **symbolNames,
|
||||
*((unsigned int *)&buf) == FAT_MAGIC) {
|
||||
/* Get host info */
|
||||
host_t host = mach_host_self();
|
||||
unsigned i = HOST_BASIC_INFO_COUNT;
|
||||
unsigned hic = HOST_BASIC_INFO_COUNT;
|
||||
struct host_basic_info hbi;
|
||||
kern_return_t kr;
|
||||
if ((kr = host_info(host, HOST_BASIC_INFO,
|
||||
(host_info_t)(&hbi), &i)) != KERN_SUCCESS) {
|
||||
(host_info_t)(&hbi), &hic)) != KERN_SUCCESS) {
|
||||
return -1;
|
||||
}
|
||||
mach_port_deallocate(mach_task_self(), host);
|
||||
@ -361,7 +361,7 @@ int __breakpad_fdnlist(int fd, nlist_type *list, const char **symbolNames,
|
||||
if (read(fd, (char *)space, m) != m)
|
||||
break;
|
||||
n -= m;
|
||||
long savpos = lseek(fd, 0, SEEK_CUR);
|
||||
off_t savpos = lseek(fd, 0, SEEK_CUR);
|
||||
if (savpos == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -261,8 +261,8 @@ bool FindTextSection(DynamicImage& image) {
|
||||
reinterpret_cast<const mach_segment_command_type *>(cmd);
|
||||
|
||||
if (!strcmp(seg->segname, "__TEXT")) {
|
||||
image.vmaddr_ = seg->vmaddr;
|
||||
image.vmsize_ = seg->vmsize;
|
||||
image.vmaddr_ = static_cast<mach_vm_address_t>(seg->vmaddr);
|
||||
image.vmsize_ = static_cast<mach_vm_size_t>(seg->vmsize);
|
||||
image.slide_ = 0;
|
||||
|
||||
if (seg->fileoff == 0 && seg->filesize != 0) {
|
||||
@ -492,7 +492,7 @@ void ReadImageInfo(DynamicImages& images,
|
||||
header_size,
|
||||
info.load_address_,
|
||||
file_path,
|
||||
info.file_mod_date_,
|
||||
static_cast<uintptr_t>(info.file_mod_date_),
|
||||
images.task_,
|
||||
images.cpu_type_);
|
||||
|
||||
|
@ -294,7 +294,7 @@ size_t MinidumpGenerator::CalculateStackSize(mach_vm_address_t start_addr) {
|
||||
mach_vm_address_t proposed_next_region_base = next_region_base;
|
||||
mach_vm_size_t next_region_size;
|
||||
nesting_level = 0;
|
||||
mach_msg_type_number_t info_count = VM_REGION_SUBMAP_INFO_COUNT_64;
|
||||
info_count = VM_REGION_SUBMAP_INFO_COUNT_64;
|
||||
result = mach_vm_region_recurse(crashing_task_, &next_region_base,
|
||||
&next_region_size, &nesting_level,
|
||||
region_info, &info_count);
|
||||
@ -429,7 +429,7 @@ u_int64_t MinidumpGenerator::CurrentPCForStack(
|
||||
return CurrentPCForStackX86_64(state);
|
||||
#endif
|
||||
default:
|
||||
assert("Unknown CPU type!");
|
||||
assert(0 && "Unknown CPU type!");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -902,18 +902,20 @@ bool MinidumpGenerator::WriteMemoryListStream(
|
||||
// Bound it to the upper and lower bounds of the region
|
||||
// it's contained within. If it's not in a known memory region,
|
||||
// don't bother trying to write it.
|
||||
mach_vm_address_t addr = ip;
|
||||
mach_vm_address_t addr = static_cast<vm_address_t>(ip);
|
||||
mach_vm_size_t size;
|
||||
natural_t nesting_level = 0;
|
||||
vm_region_submap_info_64 info;
|
||||
mach_msg_type_number_t info_count = VM_REGION_SUBMAP_INFO_COUNT_64;
|
||||
vm_region_recurse_info_t recurse_info;
|
||||
recurse_info = reinterpret_cast<vm_region_recurse_info_t>(&info);
|
||||
|
||||
kern_return_t ret =
|
||||
mach_vm_region_recurse(crashing_task_,
|
||||
&addr,
|
||||
&size,
|
||||
&nesting_level,
|
||||
(vm_region_recurse_info_t)&info,
|
||||
recurse_info,
|
||||
&info_count);
|
||||
if (ret == KERN_SUCCESS && ip >= addr && ip < (addr + size)) {
|
||||
// Try to get 128 bytes before and after the IP, but
|
||||
@ -925,7 +927,8 @@ bool MinidumpGenerator::WriteMemoryListStream(
|
||||
std::min(uintptr_t(ip + (kIPMemorySize / 2)),
|
||||
uintptr_t(addr + size));
|
||||
ip_memory_d.memory.data_size =
|
||||
end_of_range - ip_memory_d.start_of_memory_range;
|
||||
end_of_range -
|
||||
static_cast<uintptr_t>(ip_memory_d.start_of_memory_range);
|
||||
have_ip_memory = true;
|
||||
// This needs to get appended to the list even though
|
||||
// the memory bytes aren't filled in yet so the entire
|
||||
@ -1119,7 +1122,7 @@ bool MinidumpGenerator::WriteSystemInfoStream(
|
||||
break;
|
||||
}
|
||||
|
||||
info_ptr->number_of_processors = number_of_processors;
|
||||
info_ptr->number_of_processors = static_cast<uint8_t>(number_of_processors);
|
||||
#if TARGET_OS_IPHONE
|
||||
info_ptr->platform_id = MD_OS_IOS;
|
||||
#else
|
||||
@ -1164,7 +1167,7 @@ bool MinidumpGenerator::WriteModuleStream(unsigned int index,
|
||||
// We'll skip the executable module, because they don't have
|
||||
// LC_ID_DYLIB load commands, and the crash processing server gets
|
||||
// version information from the Plist file, anyway.
|
||||
if (index != (uint32_t)FindExecutableModule()) {
|
||||
if (index != static_cast<uint32_t>(FindExecutableModule())) {
|
||||
module->version_info.signature = MD_VSFIXEDFILEINFO_SIGNATURE;
|
||||
module->version_info.struct_version |= MD_VSFIXEDFILEINFO_VERSION;
|
||||
// Convert MAC dylib version format, which is a 32 bit number, to the
|
||||
@ -1312,11 +1315,15 @@ bool MinidumpGenerator::WriteCVRecord(MDRawModule *module, int cpu_type,
|
||||
}
|
||||
|
||||
if (result) {
|
||||
cv_ptr->signature.data1 = (uint32_t)identifier[0] << 24 |
|
||||
(uint32_t)identifier[1] << 16 | (uint32_t)identifier[2] << 8 |
|
||||
(uint32_t)identifier[3];
|
||||
cv_ptr->signature.data2 = (uint32_t)identifier[4] << 8 | identifier[5];
|
||||
cv_ptr->signature.data3 = (uint32_t)identifier[6] << 8 | identifier[7];
|
||||
cv_ptr->signature.data1 =
|
||||
static_cast<uint32_t>(identifier[0]) << 24 |
|
||||
static_cast<uint32_t>(identifier[1]) << 16 |
|
||||
static_cast<uint32_t>(identifier[2]) << 8 |
|
||||
static_cast<uint32_t>(identifier[3]);
|
||||
cv_ptr->signature.data2 =
|
||||
static_cast<uint16_t>(identifier[4] << 8) | identifier[5];
|
||||
cv_ptr->signature.data3 =
|
||||
static_cast<uint16_t>(identifier[6] << 8) | identifier[7];
|
||||
cv_ptr->signature.data4[0] = identifier[8];
|
||||
cv_ptr->signature.data4[1] = identifier[9];
|
||||
cv_ptr->signature.data4[2] = identifier[10];
|
||||
|
@ -86,7 +86,7 @@ static bool WriteFile(const char *path) {
|
||||
google_breakpad::TypedMDRVA<ArrayStructure> array(&writer);
|
||||
unsigned int count = 10;
|
||||
ASSERT_TRUE(array.AllocateArray(count));
|
||||
for (unsigned int i = 0; i < count; ++i) {
|
||||
for (unsigned char i = 0; i < count; ++i) {
|
||||
ArrayStructure local;
|
||||
local.char_value = i;
|
||||
local.short_value = i + 1;
|
||||
@ -99,7 +99,7 @@ static bool WriteFile(const char *path) {
|
||||
ASSERT_TRUE(obj_array.AllocateObjectAndArray(count,
|
||||
sizeof(ArrayStructure)));
|
||||
obj_array.get()->count = count;
|
||||
for (unsigned int i = 0; i < count; ++i) {
|
||||
for (unsigned char i = 0; i < count; ++i) {
|
||||
ArrayStructure local;
|
||||
local.char_value = i;
|
||||
local.short_value = i + 1;
|
||||
|
@ -90,8 +90,10 @@ void FileID::ConvertIdentifierToString(const unsigned char identifier[16],
|
||||
if (idx == 4 || idx == 6 || idx == 8 || idx == 10)
|
||||
buffer[buffer_idx++] = '-';
|
||||
|
||||
buffer[buffer_idx++] = (hi >= 10) ? 'A' + hi - 10 : '0' + hi;
|
||||
buffer[buffer_idx++] = (lo >= 10) ? 'A' + lo - 10 : '0' + lo;
|
||||
buffer[buffer_idx++] =
|
||||
static_cast<char>((hi >= 10) ? ('A' + hi - 10) : ('0' + hi));
|
||||
buffer[buffer_idx++] =
|
||||
static_cast<char>((lo >= 10) ? ('A' + lo - 10) : ('0' + lo));
|
||||
}
|
||||
|
||||
// NULL terminate
|
||||
|
@ -111,7 +111,7 @@ bool MachoWalker::ReadBytes(void *buffer, size_t size, off_t offset) {
|
||||
if (offset + size > memory_size_) {
|
||||
if (static_cast<size_t>(offset) >= memory_size_)
|
||||
return false;
|
||||
size = memory_size_ - offset;
|
||||
size = memory_size_ - static_cast<size_t>(offset);
|
||||
result = false;
|
||||
}
|
||||
memcpy(buffer, static_cast<char *>(memory_) + offset, size);
|
||||
|
@ -115,7 +115,7 @@ void UTF32ToUTF16Char(wchar_t in, u_int16_t out[2]) {
|
||||
}
|
||||
|
||||
static inline u_int16_t Swap(u_int16_t value) {
|
||||
return (value >> 8) | (value << 8);
|
||||
return (value >> 8) | static_cast<uint16_t>(value << 8);
|
||||
}
|
||||
|
||||
string UTF16ToUTF8(const vector<u_int16_t> &in, bool swap) {
|
||||
|
@ -89,7 +89,7 @@ static bool ModuleDataForSymbolFile(const std::string &file,
|
||||
std::string line(buffer);
|
||||
std::string::size_type line_break_pos = line.find_first_of('\n');
|
||||
if (line_break_pos == std::string::npos) {
|
||||
assert(!"The file is invalid!");
|
||||
assert(0 && "The file is invalid!");
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user