Piotr Caban piotr@codeweavers.com writes:
In code produced by gcc callee removes hidden return argument. In code produced by MS Visual Studio caller is responsible for removing the hidden argument.
That's only for structures larger than 8 bytes, which isn't the case at least for _Getcoll. Some tests would probably be a good idea.
On 06/29/12 19:33, Alexandre Julliard wrote:
Piotr Cabanpiotr@codeweavers.com writes:
In code produced by gcc callee removes hidden return argument. In code produced by MS Visual Studio caller is responsible for removing the hidden argument.
That's only for structures larger than 8 bytes, which isn't the case at least for _Getcoll. Some tests would probably be a good idea.
I'm not sure how to write tests for these functions. I see two possibilities in case of functions returning "big" structures (e.g. _Getctype). Should I write a test that calls the function in a loop to make sure the tests are crashing if it corrupts the stack? Or maybe it's better to write a test in assembler that checks %esp value before and after calling the function?
In case of _Getcoll (and _Getcvt) the structure should be returned in %eax and %edx registers. Current implementation tries to pass hidden argument. Is it acceptable to test this case by passing inaccessible memory pointer so the test crashes if implementation tries to write to it? Do you have any other idea of testing it?
Cheers, Piotr
Piotr Caban piotr.caban@gmail.com writes:
I'm not sure how to write tests for these functions. I see two possibilities in case of functions returning "big" structures (e.g. _Getctype). Should I write a test that calls the function in a loop to make sure the tests are crashing if it corrupts the stack? Or maybe it's better to write a test in assembler that checks %esp value before and after calling the function?
The %esp issue is probably hard to test in our test suite, but a simple test checking that the structure contents are valid would already be a good thing.
In case of _Getcoll (and _Getcvt) the structure should be returned in %eax and %edx registers. Current implementation tries to pass hidden argument. Is it acceptable to test this case by passing inaccessible memory pointer so the test crashes if implementation tries to write to it? Do you have any other idea of testing it?
You can simply declare the function as returning ULONGLONG in the test and make sure you get sane values. You could also explicitly pass a broken first argument but that's probably not even necessary.