Hi,
This is redundant, given the following two.
Yeah, that should have been obvious, not sure how I didn't see it.
Though notice that in C it is illegal to add a number to a void*, so this line will raise some warnings. Convert pointers to char* or to uintptr_t to avoid the warnings.
Sorry about that. This is what I have now:
ok(cur <= ret && (char*)ret < ((char*)ret + 0x100), "Address %p not in function starting at %p.\n", ret, cur);
Is it okay to cast it like this?
My interpretation of that page is that calling __builtin_return_address(0) is always fine, it is for higher frames that it is not necessarily reliable. Still, it is a GCC-specific thing, so alternatives should be provided for other compilers.
I see, so would it be best to just use the assembly code?
Regarding the unit test, is it okay to declare the function directly in the test itself? Doing this, the compiler doesn't issue a warning, but it seems suboptimal to me. A header seems like the correct way to go. But I don't know if it's acceptable to write a header file for just 1 function.
If you or the Wine team thinks a header file is required, should I submit 2 patches instead of one? First for the function implementation and the second for the test, including the header file.