Commit Graph

245 Commits

Author SHA1 Message Date
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
Mark VanderVoord 3fa4de14be -fix whitespace 2016-01-04 19:27:48 -05:00
Mark VanderVoord d1ab630308 - Added a couple more tests to our details test
- Added a gitattributes file to force line endings to be correct.
2015-12-30 16:33:33 -05:00
Mark VanderVoord cda8d3a7e1 - push the internal function and argument names into a single each per mock to further reduce const overhead. 2015-12-12 12:24:38 -05:00
Mark VanderVoord 647876644b - Centralized error strings to a few constants.
- Made use of the new UNITY_SET_DETAILS feature to background set up function & argument details for messages
- CMock now takes up a lot less memory! woo!
2015-12-10 16:58:10 -05:00
Mark VanderVoord 4fcca4bab7 - Moved the "Out of Memory" string into a const to stop repeating it.
- Added test for Out of Memory error
- reorder the way we handle includes in CMock internals to match the way it works in Unity
2015-12-10 11:09:26 -05:00
Mark VanderVoord ce07ce98be - Fixed error where structs and such passed by reference were getting checked for null, which isn't valid. 2015-12-08 21:55:05 -05:00
Mark VanderVoord 1fdfb61891 Support void* arguments as arrays of bytes by default instead of pointers. 2015-08-18 13:28:29 -04:00
Mark VanderVoord f17d1a933b Stop casting unless necessary for custom types or const when returning values. 2015-08-18 07:45:45 -04:00
Mark VanderVoord 13029cad64 Reintroduce fix to "comparison between pointer and integer" warning accidentally reverted in fcc6a40581. (Thanks for noticing, Steven) 2015-06-19 12:48:00 -04:00
John Gunnison 6e7a0b9be7 Support dashes in command line option values 2015-04-24 15:51:22 -07:00
Eivind Tagseth 2b89990106 Add support for subdirs (ref issue #1)
New option :subdir has been added.  Creating a mock for
e.g. sys/types.h using cmock_generator.rb with this option
set in config file, or more likely, command line parameter
--subdir=sys makes cmock create the files
:cmock_path/:subdir/:cmock_prefix+"types.[ch]"

The generated mock file will include the original header
file using #include <sys/types.h> as expected.

Only the generating code has been changed, the example
code with scripts for creating makefiles/creating mocks
using rake was too much work for me, and I didn't need any
of it.
2015-04-10 22:31:32 +02:00
Greg Williams 53fb943c58 Changed Dir.exist? to File.exist? for compatibility with Ruby 1.8.7 2015-03-12 12:50:23 -04:00
Greg Williams e3859b2838 Fixed issue in cmock_generator which was causing unity/auto/type_sanitizer to not be found from within Ceedling 2015-03-12 11:57:52 -04:00
Greg Williams 422077c929 Updated to pull in latest Unity to get type_sanitizer to commonize converting a file name to a valid C identifier for use as mock names, since was duplicated in Unity, CMock and Ceedling. 2015-03-12 11:06:34 -04:00
Greg Williams 3494561c6c Fixed issue with mock generation for a file that contains a period before the final extension (e.g. some_protobuf.pb-c.h) 2015-03-12 08:38:26 -04:00
Mark VanderVoord d4a0132117 - array plugin now handles const the way other plugins do. 2014-12-18 13:48:56 -05:00
Mark VanderVoord d7a448b12f Merge pull request #42 from gruzdev/pragmas
Add ifdef guards around GCC diagnostic pragmas (Thanks Mikhail! sorry it took me so long to get to this!)
2014-12-16 14:50:13 -05:00
Mark VanderVoord 04cb1b0194 - header parser now properly removes multi-line inline function and normal function declarations 2014-12-16 12:44:53 -05:00
Mark VanderVoord 0bd786dfa1 - fixed issue with duplicate variable assignments (thanks for pointing it out, Karsten) 2014-12-16 10:48:40 -05:00
Mark VanderVoord 62574632d0 Merge pull request #43 from jlesage/call_instance_init
Issue #40: Initialize newly allocated call instances. (Thanks Jocelyn - I found the message thread that this was in response to.)
2014-12-09 10:05:23 -05:00