Fix warnings between clang and gcc usage

This commit is contained in:
Mark VanderVoord
2026-07-08 13:22:16 -04:00
parent b732cb091e
commit 3bd4d94c4c
18 changed files with 106 additions and 80 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ void Timer_Reset(void)
AT91C_BASE_TC0->TC_CCR = AT91C_TC_CLKDIS;
AT91C_BASE_TC0->TC_IDR = 0xffffffff;
dummy = AT91C_BASE_TC0->TC_SR;
dummy = dummy;
(void)dummy;
}
void Timer_ConfigureMode(void)
+1 -1
View File
@@ -31,7 +31,7 @@ class CMockGeneratorPluginExpect
lines << " #{function[:return][:type]} ReturnVal;\n" unless function[:return][:void?]
lines << " int CallOrder;\n" if @ordered
function[:args].each do |arg|
lines << " #{arg[:volatile?] ? "volatile #{arg[:type]}" : arg[:type]} Expected_#{arg[:name]};\n"
lines << " #{arg[:type]} Expected_#{arg[:name]};\n"
end
lines
end
@@ -72,6 +72,11 @@ class CMockGeneratorPluginReturnThruPtr
lines
end
def as_void_ptr(arg, arg_name)
# volatile pointers use CMOCK_DEVOLATILE_PTR to avoid -Wcast-qual
arg[:volatile?] ? "CMOCK_DEVOLATILE_PTR(#{arg_name})" : "(void*)#{arg_name}"
end
def mock_precheck_return_thru_ptr(function)
return '' unless @ignore_used
@@ -84,7 +89,7 @@ class CMockGeneratorPluginReturnThruPtr
lines << " cmock_call_instance->ReturnThruPtr_#{arg_name}_Used)\n"
lines << " {\n"
lines << " UNITY_TEST_ASSERT_NOT_NULL(#{arg_name}, cmock_line, CMockStringPtrIsNULL);\n"
lines << " CMOCK_MEMCPY((void*)#{arg_name}, (const void*)cmock_call_instance->ReturnThruPtr_#{arg_name}_Val,\n"
lines << " CMOCK_MEMCPY(#{as_void_ptr(arg, arg_name)}, (const void*)cmock_call_instance->ReturnThruPtr_#{arg_name}_Val,\n"
lines << " cmock_call_instance->ReturnThruPtr_#{arg_name}_Size);\n"
lines << " }\n"
end
@@ -138,7 +143,7 @@ class CMockGeneratorPluginReturnThruPtr
lines << " if (cmock_call_instance->ReturnThruPtr_#{arg_name}_Used)\n"
lines << " {\n"
lines << " UNITY_TEST_ASSERT_NOT_NULL(#{arg_name}, cmock_line, CMockStringPtrIsNULL);\n"
lines << " CMOCK_MEMCPY((void*)#{arg_name}, (const void*)cmock_call_instance->ReturnThruPtr_#{arg_name}_Val,\n"
lines << " CMOCK_MEMCPY(#{as_void_ptr(arg, arg_name)}, (const void*)cmock_call_instance->ReturnThruPtr_#{arg_name}_Val,\n"
lines << " cmock_call_instance->ReturnThruPtr_#{arg_name}_Size);\n"
lines << " }\n"
end
+55 -31
View File
@@ -96,7 +96,16 @@ class CMockGeneratorUtils
def code_assign_argument_quickly(dest, arg)
if arg[:ptr?] || @treat_as.include?(arg[:type])
cast = arg[:array_dims] ? "(#{arg[:type]})" : ''
# For volatile pointer args, cast through CMOCK_MEM_PTR_AS_INT (a pointer-sized
# integer) to avoid -Wdiscarded-qualifiers when storing in a non-volatile Expected_
# struct field.
cast = if arg[:volatile?]
"(#{arg[:type]})(CMOCK_MEM_PTR_AS_INT)"
elsif arg[:array_dims]
"(#{arg[:type]})"
else
''
end
" #{dest} = #{cast}#{arg[:name]};\n"
else
assert_expr = "sizeof(#{arg[:name]}) == sizeof(#{arg[:type]}) ? 1 : -1"
@@ -173,6 +182,18 @@ class CMockGeneratorUtils
# private ######################
# Returns the C expression for the actual arg when passed to Unity assertion macros.
# Unity macros cast actuals to UNITY_INTERNAL_PTR (const void*), which drops volatile.
# For volatile pointer args, CMOCK_DEVOLATILE_PTR routes through a pointer-sized integer
# to avoid -Wcast-qual.
def actual_arg_expr(arg, pre, arg_name)
if arg[:volatile?] && pre.empty?
"CMOCK_DEVOLATILE_PTR(#{arg_name})"
else
"#{pre}#{arg_name}"
end
end
def lookup_expect_type(_function, arg)
c_type = arg[:type]
arg_name = arg[:name]
@@ -217,6 +238,7 @@ class CMockGeneratorUtils
def code_verify_an_arg_expectation_with_no_arrays(function, arg)
c_type, arg_name, expected, ignore, unity_func, pre = lookup_expect_type(function, arg)
actual_arg = actual_arg_expr(arg, pre, arg_name)
elem_size = ptr_to_array_elem_size(arg, c_type)
lines = ''
lines << " if (!#{ignore})\n" if @ignore_arg
@@ -225,27 +247,27 @@ class CMockGeneratorUtils
case unity_func
when 'UNITY_TEST_ASSERT_EQUAL_MEMORY'
c_type_local = c_type.gsub(/\*$/, '')
lines << " UNITY_TEST_ASSERT_EQUAL_MEMORY(#{pre}#{expected}, #{pre}#{arg_name}, sizeof(#{c_type_local}), cmock_line, CMockStringMismatch);\n"
lines << " UNITY_TEST_ASSERT_EQUAL_MEMORY(#{pre}#{expected}, #{actual_arg}, sizeof(#{c_type_local}), cmock_line, CMockStringMismatch);\n"
when 'UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY'
if pre == '&'
lines << " UNITY_TEST_ASSERT_EQUAL_MEMORY(#{pre}#{expected}, #{pre}#{arg_name}, #{elem_size}, cmock_line, CMockStringMismatch);\n"
lines << " UNITY_TEST_ASSERT_EQUAL_MEMORY(#{pre}#{expected}, #{actual_arg}, #{elem_size}, cmock_line, CMockStringMismatch);\n"
else
lines << " if (#{pre}#{expected} == NULL)\n"
lines << " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, CMockStringExpNULL); }\n"
lines << " { UNITY_TEST_ASSERT_NULL(#{actual_arg}, cmock_line, CMockStringExpNULL); }\n"
lines << " else\n"
lines << " { UNITY_TEST_ASSERT_EQUAL_MEMORY(#{pre}#{expected}, #{pre}#{arg_name}, #{elem_size}, cmock_line, CMockStringMismatch); }\n"
lines << " { UNITY_TEST_ASSERT_EQUAL_MEMORY(#{pre}#{expected}, #{actual_arg}, #{elem_size}, cmock_line, CMockStringMismatch); }\n"
end
when /_ARRAY/
if pre == '&'
lines << " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, 1, cmock_line, CMockStringMismatch);\n"
lines << " #{unity_func}(#{pre}#{expected}, #{actual_arg}, 1, cmock_line, CMockStringMismatch);\n"
else
lines << " if (#{pre}#{expected} == NULL)\n"
lines << " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, CMockStringExpNULL); }\n"
lines << " { UNITY_TEST_ASSERT_NULL(#{actual_arg}, cmock_line, CMockStringExpNULL); }\n"
lines << " else\n"
lines << " { #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, 1, cmock_line, CMockStringMismatch); }\n"
lines << " { #{unity_func}(#{pre}#{expected}, #{actual_arg}, 1, cmock_line, CMockStringMismatch); }\n"
end
else
lines << " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, CMockStringMismatch);\n"
lines << " #{unity_func}(#{pre}#{expected}, #{actual_arg}, cmock_line, CMockStringMismatch);\n"
end
lines << " }\n"
lines
@@ -253,6 +275,7 @@ class CMockGeneratorUtils
def code_verify_an_arg_expectation_with_normal_arrays(function, arg)
c_type, arg_name, expected, ignore, unity_func, pre = lookup_expect_type(function, arg)
actual_arg = actual_arg_expr(arg, pre, arg_name)
depth_name = arg[:ptr?] || arg[:string?] ? "cmock_call_instance->Expected_#{arg_name}_Depth" : 1
elem_size = ptr_to_array_elem_size(arg, c_type)
lines = ''
@@ -262,33 +285,33 @@ class CMockGeneratorUtils
case unity_func
when 'UNITY_TEST_ASSERT_EQUAL_MEMORY'
c_type_local = c_type.gsub(/\*$/, '')
lines << " UNITY_TEST_ASSERT_EQUAL_MEMORY(#{pre}#{expected}, #{pre}#{arg_name}, sizeof(#{c_type_local}), cmock_line, CMockStringMismatch);\n"
lines << " UNITY_TEST_ASSERT_EQUAL_MEMORY(#{pre}#{expected}, #{actual_arg}, sizeof(#{c_type_local}), cmock_line, CMockStringMismatch);\n"
when 'UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY'
if pre == '&'
lines << " UNITY_TEST_ASSERT_EQUAL_MEMORY(#{pre}#{expected}, #{pre}#{arg_name}, #{elem_size}, cmock_line, CMockStringMismatch);\n"
lines << " UNITY_TEST_ASSERT_EQUAL_MEMORY(#{pre}#{expected}, #{actual_arg}, #{elem_size}, cmock_line, CMockStringMismatch);\n"
else
lines << " if (#{pre}#{expected} == NULL)\n"
lines << " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, CMockStringExpNULL); }\n"
lines << " { UNITY_TEST_ASSERT_NULL(#{actual_arg}, cmock_line, CMockStringExpNULL); }\n"
lines << " else\n"
lines << " { UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(#{pre}#{expected}, #{pre}#{arg_name}, #{elem_size}, #{depth_name}, cmock_line, CMockStringMismatch); }\n"
lines << " { UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(#{pre}#{expected}, #{actual_arg}, #{elem_size}, #{depth_name}, cmock_line, CMockStringMismatch); }\n"
end
when /_ARRAY/
if pre == '&'
lines << " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, #{depth_name}, cmock_line, CMockStringMismatch);\n"
lines << " #{unity_func}(#{pre}#{expected}, #{actual_arg}, #{depth_name}, cmock_line, CMockStringMismatch);\n"
else
lines << " if (#{pre}#{expected} == NULL)\n"
lines << " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, CMockStringExpNULL); }\n"
lines << " { UNITY_TEST_ASSERT_NULL(#{actual_arg}, cmock_line, CMockStringExpNULL); }\n"
lines << " else\n"
lines << " { #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, #{depth_name}, cmock_line, CMockStringMismatch); }\n"
lines << " { #{unity_func}(#{pre}#{expected}, #{actual_arg}, #{depth_name}, cmock_line, CMockStringMismatch); }\n"
end
else
if arg[:string?]
lines << " if (#{depth_name} == 0)\n"
lines << " { #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, CMockStringMismatch); }\n"
lines << " { #{unity_func}(#{pre}#{expected}, #{actual_arg}, cmock_line, CMockStringMismatch); }\n"
lines << " else\n"
lines << " { UNITY_TEST_ASSERT_EQUAL_MEMORY((const void*)(#{pre}#{expected}), (const void*)(#{pre}#{arg_name}), (UNITY_UINT32)(#{depth_name}), cmock_line, CMockStringMismatch); }\n"
lines << " { UNITY_TEST_ASSERT_EQUAL_MEMORY((const void*)(#{pre}#{expected}), (const void*)(#{actual_arg}), (UNITY_UINT32)(#{depth_name}), cmock_line, CMockStringMismatch); }\n"
else
lines << " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, CMockStringMismatch);\n"
lines << " #{unity_func}(#{pre}#{expected}, #{actual_arg}, cmock_line, CMockStringMismatch);\n"
end
end
lines << " }\n"
@@ -297,6 +320,7 @@ class CMockGeneratorUtils
def code_verify_an_arg_expectation_with_smart_arrays(function, arg)
c_type, arg_name, expected, ignore, unity_func, pre = lookup_expect_type(function, arg)
actual_arg = actual_arg_expr(arg, pre, arg_name)
depth_name = arg[:ptr?] || arg[:string?] ? "cmock_call_instance->Expected_#{arg_name}_Depth" : 1
elem_size = ptr_to_array_elem_size(arg, c_type)
lines = ''
@@ -306,35 +330,35 @@ class CMockGeneratorUtils
case unity_func
when 'UNITY_TEST_ASSERT_EQUAL_MEMORY'
c_type_local = c_type.gsub(/\*$/, '')
lines << " UNITY_TEST_ASSERT_EQUAL_MEMORY(#{pre}#{expected}, #{pre}#{arg_name}, sizeof(#{c_type_local}), cmock_line, CMockStringMismatch);\n"
lines << " UNITY_TEST_ASSERT_EQUAL_MEMORY(#{pre}#{expected}, #{actual_arg}, sizeof(#{c_type_local}), cmock_line, CMockStringMismatch);\n"
when 'UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY'
if pre == '&'
lines << " UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(#{pre}#{expected}, #{pre}#{arg_name}, #{elem_size}, #{depth_name}, cmock_line, CMockStringMismatch);\n"
lines << " UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(#{pre}#{expected}, #{actual_arg}, #{elem_size}, #{depth_name}, cmock_line, CMockStringMismatch);\n"
else
lines << " if (#{pre}#{expected} == NULL)\n"
lines << " { UNITY_TEST_ASSERT_NULL(#{arg_name}, cmock_line, CMockStringExpNULL); }\n"
lines << (depth_name != 1 ? " else if (#{depth_name} == 0)\n { UNITY_TEST_ASSERT_EQUAL_PTR(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, CMockStringMismatch); }\n" : '')
lines << " { UNITY_TEST_ASSERT_NULL(#{actual_arg}, cmock_line, CMockStringExpNULL); }\n"
lines << (depth_name != 1 ? " else if (#{depth_name} == 0)\n { UNITY_TEST_ASSERT_EQUAL_PTR(#{pre}#{expected}, #{actual_arg}, cmock_line, CMockStringMismatch); }\n" : '')
lines << " else\n"
lines << " { UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(#{pre}#{expected}, #{pre}#{arg_name}, #{elem_size}, #{depth_name}, cmock_line, CMockStringMismatch); }\n"
lines << " { UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(#{pre}#{expected}, #{actual_arg}, #{elem_size}, #{depth_name}, cmock_line, CMockStringMismatch); }\n"
end
when /_ARRAY/
if pre == '&'
lines << " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, #{depth_name}, cmock_line, CMockStringMismatch);\n"
lines << " #{unity_func}(#{pre}#{expected}, #{actual_arg}, #{depth_name}, cmock_line, CMockStringMismatch);\n"
else
lines << " if (#{pre}#{expected} == NULL)\n"
lines << " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, CMockStringExpNULL); }\n"
lines << (depth_name != 1 ? " else if (#{depth_name} == 0)\n { UNITY_TEST_ASSERT_EQUAL_PTR(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, CMockStringMismatch); }\n" : '')
lines << " { UNITY_TEST_ASSERT_NULL(#{actual_arg}, cmock_line, CMockStringExpNULL); }\n"
lines << (depth_name != 1 ? " else if (#{depth_name} == 0)\n { UNITY_TEST_ASSERT_EQUAL_PTR(#{pre}#{expected}, #{actual_arg}, cmock_line, CMockStringMismatch); }\n" : '')
lines << " else\n"
lines << " { #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, #{depth_name}, cmock_line, CMockStringMismatch); }\n"
lines << " { #{unity_func}(#{pre}#{expected}, #{actual_arg}, #{depth_name}, cmock_line, CMockStringMismatch); }\n"
end
else
if arg[:string?]
lines << " if (#{depth_name} == 0)\n"
lines << " { #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, CMockStringMismatch); }\n"
lines << " { #{unity_func}(#{pre}#{expected}, #{actual_arg}, cmock_line, CMockStringMismatch); }\n"
lines << " else\n"
lines << " { UNITY_TEST_ASSERT_EQUAL_MEMORY((const void*)(#{pre}#{expected}), (const void*)(#{pre}#{arg_name}), (UNITY_UINT32)(#{depth_name}), cmock_line, CMockStringMismatch); }\n"
lines << " { UNITY_TEST_ASSERT_EQUAL_MEMORY((const void*)(#{pre}#{expected}), (const void*)(#{actual_arg}), (UNITY_UINT32)(#{depth_name}), cmock_line, CMockStringMismatch); }\n"
else
lines << " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, CMockStringMismatch);\n"
lines << " #{unity_func}(#{pre}#{expected}, #{actual_arg}, cmock_line, CMockStringMismatch);\n"
end
end
lines << " }\n"
+5
View File
@@ -95,6 +95,11 @@ extern const char* CMockStringMismatch;
#define CMOCK_MEM_SIZE (32768)
#endif
/* Cast a volatile pointer to void* for use with CMOCK_MEMCPY or Unity assertion
* macros. Routing through CMOCK_MEM_PTR_AS_INT (a pointer-sized integer) avoids
* -Wcast-qual without requiring compiler-specific pragmas or C99 intptr_t. */
#define CMOCK_DEVOLATILE_PTR(p) ((void*)(CMOCK_MEM_PTR_AS_INT)(p))
/* memory copy/set functions used by CMock internals and generated mocks.
* Override to use custom implementations on targets without standard libc. */
#if !defined(CMOCK_MEMCPY) || !defined(CMOCK_MEMSET)
-1
View File
@@ -14,7 +14,6 @@
- './system/generated/'
:include:
- './system/generated/'
- '../examples/test/'
- '../src/'
- '../vendor/unity/src/'
- '../vendor/c_exception/lib/'
@@ -200,9 +200,7 @@
:code: |
test()
{
const char* constretval = "This is a\0 silly string";
char* retval = (char*)constretval;
bars_ExpectAndReturn(retval);
bars_ExpectAndReturn("This is a\0 silly string");
foos_Expect("This is a\0 wacky string");
function_c();
@@ -213,9 +211,7 @@
:code: |
test()
{
const char* constretval = "This is a silly string";
char* retval = (char*)constretval;
bars_ExpectAndReturn(retval);
bars_ExpectAndReturn("This is a silly string");
foos_Expect("This is a wacky string");
function_c();
@@ -274,9 +270,7 @@
:code: |
test()
{
const char* constretval = "This is a\0 silly string";
char* retval = (char*)constretval;
bars_ExpectAndReturn(retval);
bars_ExpectAndReturn("This is a\0 silly string");
foos_ExpectAndThrow("This is a\0 wacky string", 55);
foos_Expect("err");
@@ -288,9 +282,7 @@
:code: |
test()
{
const char* constretval = "This is a\0 silly string";
char* retval = (char*)constretval;
bars_ExpectAndReturn(retval);
bars_ExpectAndReturn("This is a\0 silly string");
foos_ExpectAndThrow("This is a\0 wacky string", 55);
foos_Expect("wrong error");
@@ -216,7 +216,7 @@
test()
{
const char* retval = "This is a\0 silly string";
bars_ExpectAndReturn((char*)retval);
bars_ExpectAndReturn(retval);
foos_Expect("This is a\0 wacky string");
function_c();
@@ -228,7 +228,7 @@
test()
{
const char* retval = "This is a silly string";
bars_ExpectAndReturn((char*)retval);
bars_ExpectAndReturn(retval);
foos_Expect("This is a wacky string");
function_c();
@@ -288,7 +288,7 @@
test()
{
const char* retval = "This is a\0 silly string";
bars_ExpectAndReturn((char*)retval);
bars_ExpectAndReturn(retval);
foos_ExpectAndThrow("This is a\0 wacky string", 55);
foos_Expect("err");
@@ -301,7 +301,7 @@
test()
{
const char* retval = "This is a\0 silly string";
bars_ExpectAndReturn((char*)retval);
bars_ExpectAndReturn(retval);
foos_ExpectAndThrow("This is a\0 wacky string", 55);
foos_Expect("wrong error");
@@ -96,7 +96,7 @@
test()
{
const char* retval = "moe";
foo_char_strings_ExpectAndReturn("larry", "curly", (char*)retval);
foo_char_strings_ExpectAndReturn("larry", "curly", retval);
TEST_ASSERT_EQUAL_STRING("moe", function_d("larry", "curly"));
}
@@ -68,8 +68,9 @@
:code: |
test()
{
char wrong_param2 = 'X';
foo_Expect( A, B, C );
exercise_const1( (const char*)B, (char * const)A, C );
exercise_const1( (const char*)B, &wrong_param2, C );
}
- :pass: FALSE
@@ -87,7 +88,7 @@
test()
{
bar_Expect( A, B, C );
exercise_const2( A, (char * const)C, (const char *)B );
exercise_const2( C, B, A );
}
@@ -165,7 +165,7 @@
test()
{
const char* retval = "This is a\0 silly string";
bars_ExpectAndReturn((char*)retval);
bars_ExpectAndReturn(retval);
foos_Expect("This is a\0 wacky string");
function_c();
@@ -177,7 +177,7 @@
test()
{
const char* retval = "This is a silly string";
bars_ExpectAndReturn((char*)retval);
bars_ExpectAndReturn(retval);
foos_Expect("This is a wacky string");
function_c();
@@ -233,7 +233,7 @@
test()
{
const char* retval = "This is a\0 silly string";
bars_ExpectAndReturn((char*)retval);
bars_ExpectAndReturn(retval);
foos_Expect("This is a\0 wacky string");
function_b();
@@ -245,7 +245,7 @@
test()
{
const char* retval = "This is a silly string";
bars_ExpectAndReturn((char*)retval);
bars_ExpectAndReturn(retval);
foos_Expect("This is a wacky string");
function_b();
@@ -171,7 +171,7 @@
char r_a_ret[] = "FEEFI";
ptr_ret_array_Expect(r_a, lengthof(r_a));
ptr_ret_array_ReturnArrayThruPtr_r(r_a_ret, (int)strlen(r_a_ret));
ptr_ret_array_ReturnArrayThruPtr_r(r_a_ret, strlen(r_a_ret));
ptr_ret_array(r_a, lengthof(r_a));
TEST_ASSERT_EQUAL_STRING("FEEFIorooboo", r_a);
}
@@ -173,7 +173,7 @@
char r_a_ret[] = "FEEFI";
ptr_ret_array_Expect(r_a, lengthof(r_a));
ptr_ret_array_ReturnArrayThruPtr_r(r_a_ret, (int)strlen(r_a_ret));
ptr_ret_array_ReturnArrayThruPtr_r(r_a_ret, strlen(r_a_ret));
ptr_ret_array(r_a, lengthof(r_a));
TEST_ASSERT_EQUAL_STRING("FEEFIorooboo", r_a);
}
@@ -45,8 +45,8 @@
:code: |
test()
{
char* a = (char*)("Hello");
char* b = (char*)("Hello");
char a[] = "Hello";
char b[] = "Hello";
ret_v_ptr_ExpectAndReturn(a);
get_v_ptr_Expect(b);
get_v_ptr_typedefed_Expect((VOID_PTR)b);
@@ -59,8 +59,8 @@
:code: |
test()
{
char* a = (char*)("Hello");
char* b = (char*)("Hello");
char a[] = "Hello";
char b[] = "Hello";
ret_v_ptr_ExpectAndReturn(a);
get_v_ptr_ExpectWithArray(b,5);
get_v_ptr_typedefed_ExpectWithArray((VOID_PTR)b,5);
@@ -73,8 +73,8 @@
:code: |
test()
{
char* a = (char*)("Hello");
char* b = (char*)("Jello");
char a[] = "Hello";
char b[] = "Jello";
ret_v_ptr_ExpectAndReturn(a);
get_v_ptr_Expect(b);
get_v_ptr_typedefed_Expect((VOID_PTR)b);
@@ -87,8 +87,8 @@
:code: |
test()
{
char* a = (char*)("Hello");
char* b = (char*)("Hella");
char a[] = "Hello";
char b[] = "Hella";
ret_v_ptr_ExpectAndReturn(a);
get_v_ptr_ExpectWithArray(b,5);
get_v_ptr_typedefed_ExpectWithArray((VOID_PTR)b,5);
@@ -54,7 +54,7 @@
:code: |
test()
{
char* a = (char*)("Hello");
char a[] = "Hello";
get_v_ptr_Expect(a);
function_a(a);
}
@@ -84,7 +84,7 @@
:code: |
test()
{
char* a = (char*)("Hello");
char a[] = "Hello";
get_v_ptr_Expect(NULL);
function_a(a);
}
@@ -94,7 +94,7 @@
:code: |
test()
{
char* a = (char*)("Hello");
char a[] = "Hello";
get_const_v_ptr_Expect(a);
function_b(a);
}
@@ -115,7 +115,7 @@
:code: |
test()
{
char* a = (char*)("Hello");
char a[] = "Hello";
get_my_void_ptr_Expect(a);
function_c(a);
}
@@ -43,7 +43,7 @@
:code: |
test()
{
char* a = (char*)("Hello");
char a[] = "Hello";
get_my_void_ptr_Expect(a);
function_a(a);
}
@@ -53,8 +53,8 @@
:code: |
test()
{
char* a = (char*)("Hello");
char* b = (char*)("Hello");
char a[] = "Hello";
char b[] = "Hello";
get_my_void_ptr_ExpectWithArray(a, 5);
function_a(b);
}
@@ -64,8 +64,8 @@
:code: |
test()
{
char* a = (char*)("Hello");
char* b = (char*)("Jello");
char a[] = "Hello";
char b[] = "Jello";
get_my_void_ptr_ExpectWithArray(a, 5);
function_a(b);
}
@@ -84,7 +84,7 @@
:code: |
test()
{
char* a = (char*)("Hello");
char a[] = "Hello";
get_my_void_ptr_ExpectWithArray(a, 0);
function_a(a);
}
@@ -260,7 +260,7 @@ describe CMockGeneratorPluginReturnThruPtr, "Verify CMockGeneratorPluginReturnTh
" if (cmock_call_instance->ReturnThruPtr_foo_handle_Used)\n" +
" {\n" +
" UNITY_TEST_ASSERT_NOT_NULL(foo_handle, cmock_line, CMockStringPtrIsNULL);\n" +
" CMOCK_MEMCPY((void*)foo_handle, (const void*)cmock_call_instance->ReturnThruPtr_foo_handle_Val,\n" +
" CMOCK_MEMCPY(CMOCK_DEVOLATILE_PTR(foo_handle), (const void*)cmock_call_instance->ReturnThruPtr_foo_handle_Val,\n" +
" cmock_call_instance->ReturnThruPtr_foo_handle_Size);\n" +
" }\n"