mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-06-05 21:15:20 +00:00
550e141c59a7bcb88fe73ca0f3604b5927271b65
When a inline function was declared in a file, we would find the declaration and remove the function body. However, since it is a declaration, there is NO function body, so we were deleting a random piece of code that was between square brackets in the file. To properly handle this, we have to detect if we are dealing with a function declaration or a function definition. If we are dealing with a function declaration, a semicolon will come BEFORE the first square bracket. If we are dealing with a function definition, a square bracket will come BEFORE the first semicolon (the first semicolon will be in the inline function body, so between the square brackets). So we determine the location of the first semicolon and the first square bracket after the function name and apply the logic described above to handle function declarations. If we are dealing with a function declaration, we don't do anything, we just move to the next match. This will result in redeclarations of the inline function, but this is allowed in C and I'd rather not touch the file anymore than necessary.
CMock - Mock/stub generator for C
Getting Started
If you're using Ceedling, there is no need to install CMock. It will handle it for you. For everyone else, the simplest way is to grab it off github. You can also download it as a zip if you prefer. The Github method looks something like this:
> git clone --recursive https://github.com/throwtheswitch/cmock.git
> cd cmock
> bundle install # Ensures you have all RubyGems needed
If you plan to help with the development of CMock (or just want to verify that it can perform its self tests on your system) then you can enter the test directory and then ask it to test:
> cd test
> rake # Run all CMock self tests
API Documentation
- Not sure what you're doing?
- Interested in our MIT-style license?
- Are there examples?
- They are all in /examples
- Any other resources to check out?
- Definitely! Check out our developer portal on ThrowTheSwitch.org
Description
Languages
C
58.9%
Ruby
23.2%
Assembly
9.5%
Tcl
7.9%
Batchfile
0.4%
