John Lindgren
ef04f4ab7f
Fix recent const changes to account for special (char*) handling.
2017-09-08 15:20:57 -04:00
John Lindgren
27c5a9cff5
Merge remote-tracking branch 'phonetagger/improve-const-ptr-handling'
2017-09-08 15:20:34 -04:00
Mark VanderVoord
43fa31380d
- Renamed :strict_mock_calling option to :fail_on_unexpected_calls for clarity.
2017-09-08 14:54:55 -04:00
Mark VanderVoord
413c803543
Merge pull request #120 from shreyasbharath/fix-multi-threading-bug
...
Fixed race condition that occurs when 'requiring' plugins (Thanks @shreyasbharath !)
2017-09-08 13:12:55 -04:00
Mark VanderVoord
699563e503
Merge pull request #140 from jlindgren90/master
...
Remove dead code (unity_msg is not used since 647876644b ). (Thanks @jlindgren90 )
2017-09-08 13:05:31 -04:00
Mark VanderVoord
454fcfb7a3
Merge pull request #141 from jlindgren90/fix-const-parsing
...
Fix const determination for pointer-to-pointer types. (Thanks John! (@jlindgren90) )
2017-09-08 13:03:27 -04:00
laurensmiers
9c9f08c48b
Add 'strict_mock_calling' option
...
- By default set to true to maintain the default behaviour of CMock
- When mocked function is called and no Except/Ignor called,
test will fail
- When set to false:
- if test calls mocked function,
and user did not specify Except/Ignore/...
test will not fail because of this,
all calls to mocked functions are ignored
2017-09-06 00:28:37 +02:00
John Lindgren
55462aef40
Fix parsing of declarations like "int const* doStuff(void)".
...
The "const" in this case was not correctly stripped from the return type,
leading to a double const in generated typedefs, i.e.:
typedef const int const* (* doStuff_CALLBACK)(int cmock_num_calls);
Add a test for these cases.
2017-09-01 12:30:11 -04:00
John Lindgren
42dab4836d
Fix handling of string arguments.
...
Since 2f0a44d7ce , string arguments were being tested with
UNITY_TEST_ASSERT_EQUAL_PTR, not UNITY_TEST_ASSERT_EQUAL_STRING.
Before that change, we would call divine_ptr(arg_type) where
arg_type had the argument name stripped, i.e. "const char *".
Now we are passing it the name as well, i.e. "const char *str"
and it was not prepared to handle that.
2017-08-31 17:44:08 -04:00
John Lindgren
693c658780
Fix const determination for pointer-to-pointer types.
...
For example, consider: void function(const int **ret_ptr).
This function stores a (const int *) at the address passed in.
We'd want to test it with function_ReturnThruPtr_ret_ptr, but
CMock was incorrectly considering the (const int **) a constant
argument, and thus did not generate the ReturnThruPtr function.
Add a test to ensure that all permutations of constants and
pointers work as expected.
2017-08-31 16:33:21 -04:00
John Lindgren
7eb7e14fbc
Remove trailing whitespace.
2017-08-30 16:03:45 -04:00
John Lindgren
9e69cfb9b1
Remove an extra newline.
2017-08-30 15:50:20 -04:00
John Lindgren
53d6a7c0e4
Remove a commented-out function (it confuses yard otherwise).
2017-08-30 15:49:14 -04:00
John Lindgren
a604fb71a4
Remove dead code (unity_msg is not used since 647876644b).
2017-08-30 10:28:53 -04:00
John Lindgren
295fe3be4e
Fix typo (typepdef/typedef)
2017-08-22 12:26:45 -04:00
phonetagger
73a6aa003b
Oops, removed duplicate line.
2017-08-22 11:28:27 -04:00
phonetagger
725bfd93a0
On some embedded platforms (real or simulated), when RAM and ROM are separate address spaces or RAM pointers are smaller than ROM pointers, the C keyword 'const' may (depending on compiler) be critical for differentiating between assembly code pointer types without having to use compiler-specific attribute flags to pick which address space a pointer refers to. (E.g. the M16C/R8C IAR C/C++ compiler in the Near (default) data model, where 'const char*' is a 3-byte pointer that can point anywhere in ROM or RAM, but 'char*' is a 2-byte pointer that can only point to RAM.)
...
This change causes CMock to preserve 'const' in argument types so that pointers-to-const continue to point to const data in the mocked code, while still removing the 'const' attribute from the pointers themselves.
2017-08-21 19:12:48 -04:00
Mark VanderVoord
0b303dba29
Support version 1.9.3 again (with slightly less awesome brace matching)
2017-08-18 23:46:15 -04:00
krsk
08b255868a
Push and pop GCC diagnostics to maintain scope for changed warning flags
2017-08-02 13:14:09 +02:00
balaksh
b58f15d0be
Fixed race condition that occurs when 'requiring' plugins
2017-05-02 10:29:16 +12:00
WojciechJasko
648f3960ff
Improve handling of braces in function definition
2017-04-05 20:38:59 +02:00
Tim Bates
d2fc813b51
Suppress warning when returning thru const or volatile ptr
...
GCC gives a warning:
warning: passing argument 1 of 'memcpy' discards 'const volatile'
qualifier from pointer target type
and the same for argument 2. These additional casts suppress the
warning.
2017-04-03 11:19:16 +09:30
Mark VanderVoord
dd791fe407
Remove support for versions of Ruby before 2.0 (as Rubylang doesn’t even support them anymore)
2017-03-20 16:18:09 -04:00
Andrew Setter
ebf4ae274a
Allow for whitespace between parens and brackets
2017-03-03 13:30:22 -05:00
Andrew Setter
a55efdba19
Improve handling of brackets in function params
...
During header parsing, #define substitutions in fixed-length array
function parameters can have parentheses in them which can cause a
failure in the bracket->asterisk conversion that happens during the
mocking process. This change updates the regex to also match for
parentheses in the function parameter brackets to ensure they get
swapped out.
2017-03-03 13:12:04 -05:00
Oscar Edvardsson
9e49bace32
Before memcpy'ing when returning through pointer, check that destination is not NULL.
2017-02-16 17:05:35 +01:00
Tim Bates
39e99e9803
Fix system test
...
Generator for callback plugin now checks for existence of ignore plugin
to know what code to generate
2017-02-13 17:36:20 +10:30
Tim Bates
30064aa63c
Fix generator test
...
Also fix indentation (tabs bad)
2017-02-13 17:19:55 +10:30
Timothy Fosdike
c719dff1ad
Clear Ignore flag when StubWithCallback is called
2017-02-13 11:57:33 +10:30
Dmitry Ledentsov
242fd73d3e
C89 conforming declaration of `cmock_call_instance
2016-11-28 17:11:29 +01:00
Mark VanderVoord
c5ea034965
Merge pull request #80 from austinglaser/master
...
cmock handles multiple helper headers
2016-10-27 10:17:56 -04:00
Mark VanderVoord
d2819592a7
Merge pull request #95 from SteinHeselmans/master
...
Add config option that allows for weak mocked functions
2016-10-27 10:16:15 -04:00
Stein Heselmans
c910393cca
More configuration options for weak symbols
2016-10-14 14:46:33 +02:00
Stein Heselmans
6c8054dc34
Add config option that allows for weak mocked functions
2016-10-14 13:43:02 +02:00
Mark VanderVoord
25f4c65ecf
Merge branch 'master' of https://github.com/ThrowTheSwitch/CMock
2016-08-11 12:40:18 -04:00
Daniel Murdin
a8b2497fe6
Pragma fix for TMS470 compilers.
2016-07-13 12:31:22 +02:00
Mark VanderVoord
2f0a44d7ce
Attempting to be smarter about recognizing pointer placement in the return values (though we're not going to officially system test some of the illegal combinations)
2016-06-05 14:12:37 -04:00
Mark VanderVoord
5de74001eb
Attempt to fix (once and for all) the way CMock handles const in arguments and return values.
2016-05-06 21:26:25 -04:00
Dixon
a18e537b37
Two small fixes to shell integration points.
...
1. Fixing bug where environment variable was being ignored.
2. Adding "UNITY_DIR" to allow a path to unity specified by the environment.
2016-05-04 14:16:18 -07:00
Austin Glaser
6545913260
arrayify helper path within cmock
2016-04-21 17:31:26 -06:00
Austin Glaser
02b0838086
cmock handles multiple helper headers
2016-04-21 16:12:11 -06:00
Mark VanderVoord
4ced2e4710
Strip out nested pairs of braces in order to protect against function definitions in the header files (inline or otherwise).
2016-03-17 07:52:19 -04:00
Mark VanderVoord
a20b14a575
Allow extern "C" to have no whitespace between end of quotes and start of opening brace
2016-03-14 07:06:29 -04:00
Michael Robertson
7ee610eb37
Fix for const to allow returnThruPtr to be generated for const pointers with mutable data
2016-03-09 11:22:45 +13:00
Stein Heselmans
9e36dc07b1
add mock_suffix configuration option
...
Same as mock_prefix configuration option. A suffix is easier to work with, if
cmock generation is done from an external GNU makefile.
2016-03-01 16:18:22 +01:00
Mark VanderVoord
c7d7e761a5
- CMock should now automatically create root mock directory if it doesn't exist (issue #68 )
2016-02-24 16:24:09 -05:00
Mark VanderVoord
17898f5078
Normalize all the line endings
2016-01-07 14:11:52 -05:00
Mark VanderVoord
d6efa5b88a
Fix numerous small errors concerning precedence of plugins, particularly related to callbacks, return_thru_ptr, and expect_any_args
2016-01-07 13:38:59 -05:00
Mark VanderVoord
26d56f39e8
Merge pull request #54 from johngun3/support_dashes_in_option_values
...
Support dashes in command line option values (Thanks for the patch, johngun3. Thanks for the reminder, combsjy)
2016-01-05 17:18:48 -05:00
Mark VanderVoord
2ac0ccb27b
fixed white space
2016-01-04 20:00:32 -05:00