From 66b00198218ca8103e7c826c4fec6b25a85cedd6 Mon Sep 17 00:00:00 2001 From: mvandervoord Date: Wed, 8 Dec 2010 16:59:32 +0000 Subject: [PATCH] - fixed issue where cmock wanted to treat function pointers as memory compares if they were not typedefs. This was ok on some platforms but not others. git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@197 bf332499-1b4d-0410-844d-d2d48d5cc64c --- lib/cmock_unityhelper_parser.rb | 1 + test/system/test_interactions/function_pointer_handling.yml | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/lib/cmock_unityhelper_parser.rb b/lib/cmock_unityhelper_parser.rb index d4c3ce8..3ddffb3 100644 --- a/lib/cmock_unityhelper_parser.rb +++ b/lib/cmock_unityhelper_parser.rb @@ -24,6 +24,7 @@ class CMockUnityHelperParser lookup = lookup + '*' return [@c_types[lookup], '&'] if (@c_types[lookup]) end + return ['UNITY_TEST_ASSERT_EQUAL_PTR', ''] if (ctype =~ /cmock_\w+_ptr\d+/) raise("Don't know how to test #{ctype} and memory tests are disabled!") unless @config.memcmp_if_unknown return (lookup =~ /\*$/) ? [@fallback, '&'] : [@fallback, ''] end diff --git a/test/system/test_interactions/function_pointer_handling.yml b/test/system/test_interactions/function_pointer_handling.yml index 66c9e5c..61b2a1c 100644 --- a/test/system/test_interactions/function_pointer_handling.yml +++ b/test/system/test_interactions/function_pointer_handling.yml @@ -2,11 +2,15 @@ :cmock: :plugins: - # none + :treat_as: + FUNCTION_T: PTR :systest: :types: | + typedef void (*FUNCTION_T)(void); :mockable: | + void takes_function_type( FUNCTION_T myfunc ); void takes_function_ptr( unsigned int (*func_ptr)(int, char) ); void takes_const_function_ptr( unsigned int (* const)(int, char) ); unsigned short (*returns_function_ptr( const char op_code ))( int, long int );