Commit Graph

675 Commits

Author SHA1 Message Date
Michael Brockus 4d0ea1afda Update meson.build 2020-01-27 23:18:39 -08:00
Michael Brockus a1b6da1773 Update meson.build 2020-01-27 23:17:18 -08:00
Mark VanderVoord bd5fbc30eb Merge pull request #271 from jvcdk/maintenance/update-submodules
Update submodule unity to current master.
2019-12-06 06:10:36 -05:00
Jørn Villesen Christensen 81345af180 Update submodule unity to current master. 2019-12-06 10:15:09 +01:00
mvandervoord 649005a917 Verify multiline functions are being parsed properly. 2019-12-05 09:15:47 -05:00
Mark VanderVoord 1e6634ca93 Merge pull request #270 from michaelbadcrumble/meson_support
Keep Meson support back to 0.50.0:
2019-12-04 06:03:07 -05:00
Michael Brockus ddf9030b9a Keep Meson support back to version 0.50.0 2019-12-03 22:49:15 -08:00
Michael Brockus 532ddd2c3d Update root meson.build 2019-12-03 22:45:39 -08:00
mvandervoord 7035578605 Grab the latest vendor tools 2019-12-03 18:48:28 -05:00
mvandervoord 91d5e578d8 Add support for function pointers using the shorthand notation 2019-11-18 09:09:42 -05:00
Mark VanderVoord 2afdebd228 Merge pull request #268 from jlindgren90/master
Allow arbitrary parentheses within length of array arguments.
2019-11-17 13:18:03 -05:00
John Lindgren 615b3874b8 Allow arbitrary parentheses within length of array arguments.
Previously, CMock would fail to parse a function like this one:

    void broken(uint8_t arg[((uint8_t)8)]);
2019-11-15 16:55:05 -05:00
Mark VanderVoord a6ec9f968a Merge pull request #267 from jlindgren90/master
Revert "Add quick pointer check before memory comparisons (#224)"
2019-11-15 13:11:19 -05:00
John Lindgren 03ddcb9bad Revert "Add quick pointer check before memory comparisons (#224)"
It didn't add direct comparisons only for pointer arguments, but
also other types of arguments like structs, which can't be compared
with '==' and cause a compiler error instead.

To reproduce, just enable the :array plugin in
system/test_interactions/expect_and_return_custom_types.yml:

In function ‘foo’:
error: invalid operands to binary != (have ‘EXAMPLE_STRUCT_T’ {aka
‘struct _EXAMPLE_STRUCT_T’} and ‘EXAMPLE_STRUCT_T’ {aka ‘struct
 _EXAMPLE_STRUCT_T’})
   59 |     if (cmock_call_instance->Expected_a != a) {
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~

This reverts commit 4df532afcc.
2019-11-15 12:46:28 -05:00
Mark VanderVoord 7dcb78c629 Merge pull request #265 from laurensmiers/master
User provided patterns for inline function mocking
2019-11-15 11:56:32 -05:00
laurens c0162e1ea6 Remove double unit test for inline_function_patterns 2019-11-15 16:25:23 +01:00
laurens 02cf882d36 Update documentation of :inline_function_patterns 2019-11-15 09:34:50 +01:00
laurens cb55b73522 Simplify inline function removal during source/function parsing
- If inlines are included, we don't do anything since they are
  disguised already as normal functions
- If inlines are NOT included, we remove anything that has inline in
  it
2019-11-14 13:38:10 +01:00
laurens 0f6e4604ff Remove inline specific keywords before starting function parsing 2019-11-14 13:37:57 +01:00
laurens 31244992db Add test for including mocks for user defined inline functions
- Failing now
2019-11-14 13:15:39 +01:00
laurens 56bad95cf7 Make test default inline_function_patterns the default value
- Tests that test the user provided patterns should define them in the
  test itself and not rely on the global one being set
2019-11-14 13:06:33 +01:00
laurens d5a8fcb6a2 Add documentation on configuring build system for :treat_includes 2019-11-13 16:21:49 +01:00
laurens 27002370dd Add documentation for :inline_function_patterns 2019-11-13 13:33:19 +01:00
laurens 9bc3f25281 Remove internal regex for inline functions and make them fully user-defined
- We set the defaults but the user is free to add his own.
  This will overwrite our defaults but they will be added to the
  documentation as reference for the user
2019-11-13 13:33:16 +01:00
laurens 8a7c45c20b Take into account user-provided inline function patterns 2019-11-13 12:44:40 +01:00
laurens 73fa7a6bb2 Add unit test for inline_function_patterns (failing now) 2019-11-13 12:28:28 +01:00
laurens 21e37780fa Add :inline_function_patterns configuration option 2019-11-13 12:08:52 +01:00
mvandervoord 543c230f33 bump version v2.5.1 2019-11-12 18:27:33 -05:00
Mark VanderVoord 968d3f6ec4 Merge pull request #263 from laurensmiers/master
Inline function mocking refactor
2019-11-12 18:26:32 -05:00
laurens 0c45d26a28 Rename total_levels to total_pairs
- We are counting pairs of braces, not levels of indentation
2019-11-13 00:03:52 +01:00
laurens 811b85e1b1 Use <counter>.times iso until <condition> 2019-11-13 00:03:30 +01:00
laurens 759d1826c8 Add test with no braces in source
- Should return 0 since no braces in source
2019-11-12 20:28:08 +01:00
laurens 60a1829acf Fix comments 2019-11-12 20:04:30 +01:00
laurens 8ba3ed99a1 Extract count_number_of_pairs_of_braces_in_function method 2019-11-12 20:01:09 +01:00
laurens 0af0e20d15 Refactor transform_inline_functions
- Just looking for static|inline in the gsub is a bit too aggressive.
  Instead, look for the "static inline" and parse it:
  - Everything before the match should just be copied, we don't want
    to touch anything but the inline functions.
  - Remove the implementation of the inline function (this is enclosed
    in square brackets) and replace it with ";" to complete the
    transformation to normal/non-inline function.
  - Copy everything after the inline function implementation

Repeat the above step until we can't find "static inline" anymore

- To remove the inline implementation,
  we count the number of square-bracket 'levels' in the inline function
  and remove every pair. This ensures that constructs like:
  inline void func(void) {
      if (...) {
        //NOP
      }
      else
      {
        //NOP
      }
  }
  will not end up leaving the 'else' keyword unremoved:
  inline void func(void);
      else
  If we count the number of levels, we don't end up in this scenario
  since we remove 3 'pairs', the if-one, the else-one and finally the
  main body.
2019-11-12 20:01:04 +01:00
laurens 2def6c4f21 Fix compile warnings on inline.h test header 2019-11-12 12:10:27 +01:00
Mark VanderVoord d403eb88c8 Merge pull request #258 from jlindgren90/master
Fix compile error when :unity_helper_path is relative.
2019-11-11 08:38:14 -05:00
Mark VanderVoord 18b2deca85 Merge pull request #261 from laurensmiers/master
Inline function mocking
2019-11-11 08:36:21 -05:00
laurens bd91eb4cca Refactor calling of transform_inline_functions
- This way, @normalized_source will always be defined, which it should
  because we are referencing it a few lines down, thanks to
  @mvandervoord for the suggestion
2019-11-11 14:26:29 +01:00
laurens fe829f2d8a Expand transform_inline_functions unit test with more usecases 2019-11-11 13:26:40 +01:00
laurens 5650b79dcd Replace NOP with actual operations to test inline.h compilation 2019-11-11 13:22:00 +01:00
laurens 9908930bc5 Fix multi-line each + use gsub! iso gsub 2019-11-11 13:14:18 +01:00
laurens b256013c5e Only normalize source if treat_inlines is enabled 2019-11-11 13:12:15 +01:00
laurens 927ca1bec0 Extract method to remove_nested_pair_of_braces in cmock_header_parser 2019-11-10 20:55:02 +01:00
laurens e1c6851492 Rename normalize_source to transform_inline_functions 2019-11-10 20:13:35 +01:00
laurens e0a61d484e Add unit tests for normalize_source
- Refactor normalize_source to do the minimum amount that is
  necessary.
  For now, this is just removing inline functions.
2019-11-10 20:11:27 +01:00
laurens 431c5c678a Refactor cleanup actions when normalizing source 2019-11-10 19:35:27 +01:00
laurens 3a07201a3f Add treat_inlines to all_plugins_coexist test 2019-11-10 18:44:20 +01:00
laurens 11dfb9c668 osek.h does not need to be executable 2019-11-10 18:39:35 +01:00
laurens 27e89dd05e Rename treat_inline to treat_inlines 2019-11-10 18:39:35 +01:00