From: Gorton, R. <Ric...@am...> - 2010-10-06 18:45:04
|
Hi, I've got a need to port elftoolchain to Windows, and am in the process of doing so. Are there any particular process requirements in terms of feeding back the changes to get them integrated? A preferred diff command? My motivation here is to get a completely clean compile with no warnings. Some changes are small, at least one requires a deeper understanding of the intent of a fair amount of the implementation code - realloc(<address>, uint64_t) on a 32-bit os. An example is _dwarf_write_lsb_alloc() ... *block = realloc (*block, *size); where size is a parameter == uint64_t *size. On a 32-bit OS, size_t is uint32_t; the compiler legitimately warns about possible loss of data. In most cases, I suspect that a realloc() is not expected to be > 32bits in size, so the warning can mostly be ignored. One (moderately clean) way to detect/prevent the actual loss is to write a little jacket function: void *myrealloc (void ptr, uint64_t size) { size_t mysize = (size_t) size; if (size) != mysize) { DWARF_SET_ERROR(<stuff>); return NULL; } else { return realloc(ptr, mysize); } } And then have two different myrealloc functions, depending on the OS. Another choice is to explicitly cast size --> size_t knowing that the realloc() is always going to be < 32bits in size. Richard Gorton GPU Developer Tools |