[PATCH] wdscore: Implement CurrentIP.

Giovanni Mascellani gmascellani at codeweavers.com
Tue Jan 18 10:00:33 CST 2022


Hi,

Il 18/01/22 01:48, Mohamad Al-Jaf ha scritto:
> 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?

Does the compiler emit any warning?

Remember that if it makes your life easier, you can directly define cur 
and ret of type char*.

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

It seems plausible.

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

I am not able to answer about this.

Giovanni.



More information about the wine-devel mailing list