mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-08-07 03:37:50 +00:00
Use correct pointer macro.
This commit is contained in:
@@ -79,7 +79,7 @@ class CMockGeneratorPluginReturnThruPtr
|
||||
arg_name = arg[:name]
|
||||
next unless @utils.ptr_or_str?(arg[:type]) && !(arg[:const?])
|
||||
|
||||
dest_cast = arg[:volatile?] ? '(void*)(uintptr_t)' : '(void*)'
|
||||
dest_cast = arg[:volatile?] ? '(void*)(CMOCK_MEM_PTR_AS_INT)' : '(void*)'
|
||||
lines << " if (Mock.#{function[:name]}_IgnoreBool && cmock_call_instance != NULL &&\n"
|
||||
lines << " cmock_call_instance->ReturnThruPtr_#{arg_name}_Used)\n"
|
||||
lines << " {\n"
|
||||
@@ -134,7 +134,7 @@ class CMockGeneratorPluginReturnThruPtr
|
||||
arg_name = arg[:name]
|
||||
next unless @utils.ptr_or_str?(arg[:type]) && !(arg[:const?])
|
||||
|
||||
dest_cast = arg[:volatile?] ? '(void*)(uintptr_t)' : '(void*)'
|
||||
dest_cast = arg[:volatile?] ? '(void*)(CMOCK_MEM_PTR_AS_INT)' : '(void*)'
|
||||
lines << " if (cmock_call_instance->ReturnThruPtr_#{arg_name}_Used)\n"
|
||||
lines << " {\n"
|
||||
lines << " UNITY_TEST_ASSERT_NOT_NULL(#{arg_name}, cmock_line, CMockStringPtrIsNULL);\n"
|
||||
|
||||
@@ -252,14 +252,14 @@ describe CMockGeneratorPluginReturnThruPtr, "Verify CMockGeneratorPluginReturnTh
|
||||
assert_equal(expected, returned)
|
||||
end
|
||||
|
||||
it "uses (void*)(uintptr_t) cast in mock_implementation for volatile pointer arg" do
|
||||
it "uses (void*)(CMOCK_MEM_PTR_AS_INT) cast in mock_implementation for volatile pointer arg" do
|
||||
volatile_ptr_func_expect()
|
||||
|
||||
expected =
|
||||
" if (cmock_call_instance->ReturnThruPtr_foo_handle_Used)\n" +
|
||||
" {\n" +
|
||||
" UNITY_TEST_ASSERT_NOT_NULL(foo_handle, cmock_line, CMockStringPtrIsNULL);\n" +
|
||||
" CMOCK_MEMCPY((void*)(uintptr_t)foo_handle, (const void*)cmock_call_instance->ReturnThruPtr_foo_handle_Val,\n" +
|
||||
" CMOCK_MEMCPY((void*)(CMOCK_MEM_PTR_AS_INT)foo_handle, (const void*)cmock_call_instance->ReturnThruPtr_foo_handle_Val,\n" +
|
||||
" cmock_call_instance->ReturnThruPtr_foo_handle_Size);\n" +
|
||||
" }\n"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user