mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-08-18 17:19:55 +00:00
Better way to fix a 'return from incompatible pointer type' compiler warning for const return types.
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_cast = function[:return][:const?] ? "(const #{function[:return][:type]})" : ''
|
||||
file << @plugins.run(:mock_implementation, function)
|
||||
file << " return cmock_call_instance->ReturnVal;\n" unless (function[:return][:void?])
|
||||
file << " return #{return_type_cast}cmock_call_instance->ReturnVal;\n" unless (function[:return][:void?])
|
||||
file << "}\n\n"
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user