mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-10-15 21:37:26 +00:00
Fixed 'return from incompatible pointer type' compiler warnings that were produced by generated code for functions having 'const ptr' has return value.
This commit is contained in:
@@ -183,8 +183,9 @@ class CMockGenerator
|
||||
file << " UNITY_TEST_FAIL(cmock_line, \"Function '#{function[:name]}' called later than expected.\");\n"
|
||||
# file << " UNITY_TEST_ASSERT((cmock_call_instance->CallOrder == ++GlobalVerifyOrder), cmock_line, \"Out of order function calls. Function '#{function[:name]}'\");\n"
|
||||
end
|
||||
return_type = function[:return][:const?] ? "const #{function[:return][:type]}" : function[:return][:type]
|
||||
file << @plugins.run(:mock_implementation, function)
|
||||
file << " return cmock_call_instance->ReturnVal;\n" unless (function[:return][:void?])
|
||||
file << " return (#{return_type})cmock_call_instance->ReturnVal;\n" unless (function[:return][:void?])
|
||||
file << "}\n\n"
|
||||
end
|
||||
|
||||
|
||||
@@ -39,9 +39,10 @@ class CMockGeneratorPluginIgnore
|
||||
lines << " return;\n }\n"
|
||||
else
|
||||
retval = function[:return].merge( { :name => "cmock_call_instance->ReturnVal"} )
|
||||
lines << " if (cmock_call_instance == NULL)\n return Mock.#{function[:name]}_FinalReturn;\n"
|
||||
return_type = function[:return][:const?] ? "const #{function[:return][:type]}" : function[:return][:type]
|
||||
lines << " if (cmock_call_instance == NULL)\n return (#{return_type})Mock.#{function[:name]}_FinalReturn;\n"
|
||||
lines << " " + @utils.code_assign_argument_quickly("Mock.#{function[:name]}_FinalReturn", retval) unless (retval[:void?])
|
||||
lines << " return cmock_call_instance->ReturnVal;\n }\n"
|
||||
lines << " return (#{return_type})cmock_call_instance->ReturnVal;\n }\n"
|
||||
end
|
||||
lines
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user